评价此页

torch.Tensor.type_as#

Tensor.type_as(tensor) Tensor#

返回此张量转换为给定张量的类型。

如果张量已是正确的类型,则此操作无效。此操作等同于 self.type(tensor.type())

参数

tensor (Tensor) – 具有所需类型的张量