torch.promote_types¶
- torch.promote_types(type1, type2) dtype¶
返回
torch.dtype,該 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