- paddle. clone ( x, name=None )
Returns a copy of input Tensor. It will always have a Tensor copy.
In addition, This function is derivable, so gradients will flow back from the output to input.
x (Tensor) – The input Tensor.
name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.
Returns: A Tensor copied from
import paddle x = paddle.ones() x.stop_gradient = False clone_x = paddle.clone(x) y = clone_x**3 y.backward() print(clone_x.grad) #  print(x.grad) #