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