torch.Tensor.type_as¶ Tensor.type_as(tensor) → Tensor¶ 返回將此 tensor 轉換為給定 tensor 型別的結果。 如果此 tensor 已是正確的型別,則此操作無效。這等價於 self.type(tensor.type()) 引數 tensor (Tensor) – 具有所需型別的 tensor