torch.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
© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/1.13/generated/torch.result_type.html