result_type#
- torch.result_type(tensor1, tensor2) dtype #
返回执行算术运算后将生成的结果
torch.dtype
。有关类型提升逻辑的更多信息,请参阅类型提升 文档。示例
>>> torch.result_type(torch.tensor([1, 2], dtype=torch.int), 1.0) torch.float32 >>> torch.result_type(torch.tensor([1, 2], dtype=torch.uint8), torch.tensor(1)) torch.uint8