- paddle.fluid.layers.tensor. zeros_like ( x, out=None )
This OP creates a zeros tensor which has identical shape and dtype with x.
x (Variable) – The input tensor which specifies shape and dtype, the input data dtype could be bool, float32, float64, int32, int64.
out (Variable, optional) – If is
None, the op will create the variable as output, the data type and shape of this variable will be same as input
x. If is a tensor, the data type and shape need to be same as input
x. The default value is
- The N-D tensor, the element in tensor is related to input
data type, if the input data type is bool, the output value is False, otherwise is zero. The output shape is the same as the input.
- Return type
import paddle.fluid as fluid x = fluid.data(name='x', dtype='float32', shape=) data = fluid.layers.zeros_like(x) # [0.0, 0.0, 0.0]