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
具有相同的形状。