torch.Tensor.resize_as_ — PyTorch 2.7 documentation (original) (raw)
Tensor.resize_as_(tensor, memory_format=torch.contiguous_format) → Tensor¶
Resizes the self
tensor to be the same size as the specifiedtensor. This is equivalent to self.resize_(tensor.size())
.
Parameters
memory_format (torch.memory_format, optional) – the desired memory format of Tensor. Default: torch.contiguous_format
. Note that memory format ofself
is going to be unaffected if self.size()
matches tensor.size()
.