[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 in
c02edba863/torch/fx/graph.py (L215),
c02edba863/torch/testing/_internal/common_utils.py (L5226)
 and c02edba863/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:
Nikita Shulga
2025-04-28 03:52:47 +00:00
committed by PyTorch MergeBot
parent 899eec665c
commit 13966d0bf5
8 changed files with 36 additions and 69 deletions

View File

@ -7,6 +7,7 @@ import os
import numpy as np
from enum import Enum
from torch.overrides import resolve_name
from torch.utils._dtype_abbrs import dtype_abbrs
from torch.utils._pytree import tree_map, tree_map_only, tree_flatten, tree_unflatten
from torch.utils import _pytree as pytree
from torch._subclasses.meta_utils import MetaConverter, assert_metadata_eq, is_sparse_any
@ -22,7 +23,6 @@ from torch.testing._internal.common_utils import (
suppress_warnings,
TEST_WITH_TORCHDYNAMO,
run_tests,
dtype_abbrs,
parametrize,
xfailIfTorchDynamo,
)