ones_like¶
- paddle.fluid.layers.tensor. ones_like ( x, out=None ) [source]
- 
         ones_like This function creates a ones tensor which has identical shape and dtype with x. - Parameters
- 
           - x (Variable) – The input tensor which specifies shape and dtype. 
- out (Variable) – The output tensor. 
 
- Returns
- 
           The tensor variable storing the output. 
- Return type
- 
           out(Variable) 
 Examples import paddle.fluid as fluid x = fluid.layers.data(name='x', dtype='float32', shape=[3], append_batch_size=False) data = fluid.layers.ones_like(x) # [1.0, 1.0, 1.0] 
