評價此頁

torch.Tensor.type_as#

Tensor.type_as(tensor) Tensor#

返回此張量轉換為給定張量型別的張量。

如果張量已經是正確的型別,則此操作無效。這等同於 self.type(tensor.type())

引數

tensor (Tensor) – 具有所需型別的張量