评价此页

torch.Tensor.type_as#

Tensor.type_as(tensor) Tensor#

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

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

参数

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