fn
clone
→Tensorclone(input: Tensor)Return a deep copy of input with its own storage.
The clone shares no memory with the source. Autograd state is
preserved: gradients flow back through clone as the identity. To
detach from the graph as well, compose with detach.
Parameters
inputTensorSource tensor.
Returns
TensorNewly-allocated tensor with the same shape, dtype, device and
contents as input.
Notes
Use clone (not contiguous) when you specifically need
a fresh buffer regardless of the input's current layout — for example
before in-place mutation that must not alias the source.
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0])
>>> y = lucid.clone(x)
>>> y.data_ptr() == x.data_ptr()
False