[dynamo] Trace torch.typename (#144163)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/144163
Approved by: https://github.com/yanboliang, https://github.com/williamwen42, https://github.com/jansel
ghstack dependencies: #144129, #144130, #144141, #144158
This commit is contained in:
Animesh Jain
2025-01-03 12:14:07 -08:00
committed by PyTorch MergeBot
parent 3292220c43
commit 087c625261
2 changed files with 8 additions and 1 deletions

View File

@ -15,6 +15,7 @@ import inspect
import itertools
import os
import random
import typing
import unittest
import warnings
import weakref
@ -6497,6 +6498,13 @@ def forward(self, s0 : torch.SymInt, s1 : torch.SymInt, L_x_ : torch.Tensor):
with mock.patch("torch._dynamo.eval_frame._maybe_set_eval_frame", bad):
fn(torch.ones(3))
def test_torchname(self):
def fn(obj):
return torch.typename(obj)
opt_fn = torch.compile(fn, backend="eager")
self.assertEqual(fn(typing.Any), opt_fn(typing.Any))
instantiate_parametrized_tests(ReproTests)

View File

@ -2853,7 +2853,6 @@ torch_non_c_binding_in_graph_functions = dict.fromkeys(
"torch.sym_min",
"torch.sym_not",
"torch.tensordot",
"torch.typename",
"torch.unique_consecutive",
"torch.use_deterministic_algorithms",
],