mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE] Migrate dtype_abbrs into one location (#152229)
Namely `torch.utils._dtype_abbrs.dtype_abbrs` Before that it was defined in various forms of completeness inc02edba863/torch/fx/graph.py (L215)
,c02edba863/torch/testing/_internal/common_utils.py (L5226)
andc02edba863/torch/testing/_internal/logging_tensor.py (L17)
TODO: - Add linter that `torch.testing._internal` module is not referenced from any of the public facing APIs, as it can have extra dependencies such as `expect_test` Fixes https://github.com/pytorch/pytorch/issues/152225 Pull Request resolved: https://github.com/pytorch/pytorch/pull/152229 Approved by: https://github.com/clee2000, https://github.com/Skylion007
This commit is contained in:
committed by
PyTorch MergeBot
parent
899eec665c
commit
13966d0bf5
@ -5223,23 +5223,6 @@ def dtype_name(dtype):
|
||||
return str(dtype).split('.')[1]
|
||||
|
||||
|
||||
dtype_abbrs = {
|
||||
torch.bfloat16: 'bf16',
|
||||
torch.float64: 'f64',
|
||||
torch.float32: 'f32',
|
||||
torch.float16: 'f16',
|
||||
torch.complex32: 'c32',
|
||||
torch.complex64: 'c64',
|
||||
torch.complex128: 'c128',
|
||||
torch.int8: 'i8',
|
||||
torch.int16: 'i16',
|
||||
torch.int32: 'i32',
|
||||
torch.int64: 'i64',
|
||||
torch.bool: 'b8',
|
||||
torch.uint8: 'u8',
|
||||
}
|
||||
|
||||
|
||||
@functools.lru_cache
|
||||
def get_cycles_per_ms() -> float:
|
||||
"""Measure and return approximate number of cycles per millisecond for torch.cuda._sleep
|
||||
|
Reference in New Issue
Block a user