mighty.utils.common.clone_cpu

mighty.utils.common.clone_cpu(tensor)[source]

Clones a tensor, followed by to CPU transfer.

If the input tensor is bounded to GPU, no extra copy is made.

Parameters:
tensortorch.Tensor

An input tensor.

Returns:
torch.Tensor

A CPU-bounded tensor copy.