File tree 1 file changed +6
-8
lines changed
python/paddle/jit/sot/opcode_translator/executor/variables
1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change 14
14
15
15
from __future__ import annotations
16
16
17
- import collections
18
17
import dis
19
18
import functools
20
19
import inspect
@@ -422,18 +421,17 @@ def _get_numpy_ufuncs(cls):
422
421
@VariableFactory .register_from_value (successor = "BuiltinVariable" )
423
422
def from_value (value : Any , graph : FunctionGraph , tracker : Tracker ):
424
423
# TODO(wangmingkai02): support other numpy api.
425
- if (
426
- ENV_SOT_TRACE_NUMPY .get ()
427
- and isinstance (value , collections .abc .Hashable )
428
- and (
424
+ try :
425
+ if ENV_SOT_TRACE_NUMPY .get () and (
429
426
value in NUMPY_API_SUPPORTED_DICT
430
427
or any (
431
428
value in ufuncs
432
429
for ufuncs in NumpyApiVariable ._get_numpy_ufuncs ()
433
430
)
434
- )
435
- ):
436
- return NumpyApiVariable (value , graph , tracker )
431
+ ):
432
+ return NumpyApiVariable (value , graph , tracker )
433
+ except Exception :
434
+ return None
437
435
return None
438
436
439
437
@property
You can’t perform that action at this time.
0 commit comments