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