torch.Tensor.type_as

Tensor.type_as(tensor) Tensor

将此张量转换为指定类型并返回。

如果张量已经是正确类型,此操作将不会执行任何操作。这等同于 self.type(tensor.type())

参数

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

本页目录