oneflow.zeros_like

oneflow.zeros_like(input) is equivalent to flow.zeros(input.shape, dtype=input.dtype)
Parameters

other (Tensor) – The size of input will determine size of the output tensor.

For example:

>>> import oneflow as flow
>>> import numpy as np
>>> x = flow.tensor(np.random.rand(5), dtype=flow.float32)
>>> y = flow.zeros_like(x)
>>> y
tensor([0., 0., 0., 0., 0.], dtype=oneflow.float32)