clone

Tensor.clone(auto_copy: bool = True)

Allocates memory for a new current Tensor object that is a copy of the current Tensor object if auto_copy is true.

Parameters:

auto_copy (bool, default) --

Determines if the data stored in the buffer is copied to the new Tensor object.

  • If set to true (default), a new buffer is allocated, and both the data stored in the buffer and its associated metadata (such as size and memory type) are copied to the new buffer.

  • If set to false, a new buffer is allocated, and only the metadata (such as size and memory type) is copied to the new buffer, but its memory is uninitialized and does not contain the original data.