Shortcuts

torch.Tensor.type_as

Tensor.type_as(tensor) 张量

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

如果张量已经是正确的类型,则此操作为空操作。这等价于 self.type(tensor.type())

Parameters

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