File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -99,14 +99,12 @@ def str_for_potential_or_deterministic(
99
99
100
100
101
101
def _str_for_input_var (var : Variable , formatting : str ) -> str :
102
- # note we're dispatching both on type(var) and on type(var.owner.op) so cannot
103
- # use the standard functools.singledispatch
104
-
105
102
def _is_potential_or_determinstic (var : Variable ) -> bool :
106
- return (
107
- hasattr (var , "str_repr" )
108
- and var .str_repr .__func__ .func is str_for_potential_or_deterministic
109
- )
103
+ try :
104
+ return var .str_repr .__func__ .func is str_for_potential_or_deterministic
105
+ except AttributeError :
106
+ # in case other code overrides str_repr, fallback
107
+ return False
110
108
111
109
if isinstance (var , TensorConstant ):
112
110
return _str_for_constant (var , formatting )
You can’t perform that action at this time.
0 commit comments