torch.promote_types¶
- torch.promote_types(type1, type2) dtype ¶
傳回
torch.dtype
,其具有最小的大小和純量種類,且不大於或低於 type1 或 type2。 有關類型提升邏輯的更多資訊,請參閱類型提升 文件。- 參數
type1 (
torch.dtype
) –type2 (
torch.dtype
) –
範例
>>> torch.promote_types(torch.int32, torch.float32) torch.float32 >>> torch.promote_types(torch.uint8, torch.long) torch.long