torch.Tensor.reshape_as#
- Tensor.reshape_as(other) Tensor #
返回此张量,使其形状与
other
相同。self.reshape_as(other)
等效于self.reshape(other.sizes())
。如果other.sizes()
与当前形状兼容,则此方法返回一个视图。有关何时可以返回视图,请参见torch.Tensor.view()
。请参阅
reshape()
以获取有关reshape
的更多信息。- 参数
other (
torch.Tensor
) – 结果张量的形状与other
相同。