@@ -47,6 +47,9 @@ def wrapped(
47
47
result = torch_func (* tensors )
48
48
return result
49
49
50
+ wrapped .__qualname__ = torch_func .__name__
51
+ wrapped .__name__ = torch_func .__name__
52
+
50
53
return wrapped
51
54
52
55
@@ -81,6 +84,10 @@ def matmul(
81
84
return result
82
85
83
86
87
+ matmul .__qualname__ = "matmul"
88
+ matmul .__name__ = "matmul"
89
+
90
+
84
91
def divmod (
85
92
x1 : ArrayLike ,
86
93
x2 : ArrayLike ,
@@ -116,16 +123,17 @@ def divmod(
116
123
return quot , rem
117
124
118
125
126
+ divmod .__qualname__ = "divmod"
127
+ divmod .__name__ = "divmod"
128
+
129
+
119
130
#
120
131
# For each torch ufunc implementation, decorate and attach the decorated name
121
132
# to this module. Its contents is then exported to the public namespace in __init__.py
122
133
#
123
134
for name in _binary :
124
135
ufunc = getattr (_binary_ufuncs_impl , name )
125
136
decorated = normalizer (deco_binary_ufunc (ufunc ))
126
-
127
- decorated .__qualname__ = name # XXX: is this really correct?
128
- decorated .__name__ = name
129
137
vars ()[name ] = decorated
130
138
131
139
@@ -134,6 +142,10 @@ def modf(x, /, *args, **kwds):
134
142
return rem , quot
135
143
136
144
145
+ modf .__qualname__ = "modf"
146
+ modf .__name__ = "modf"
147
+
148
+
137
149
_binary = _binary + ["divmod" , "modf" , "matmul" ]
138
150
139
151
@@ -178,6 +190,9 @@ def wrapped(
178
190
result = torch_func (* tensors )
179
191
return result
180
192
193
+ wrapped .__qualname__ = torch_func .__name__
194
+ wrapped .__name__ = torch_func .__name__
195
+
181
196
return wrapped
182
197
183
198
@@ -188,9 +203,6 @@ def wrapped(
188
203
for name in _unary :
189
204
ufunc = getattr (_unary_ufuncs_impl , name )
190
205
decorated = normalizer (deco_unary_ufunc (ufunc ))
191
-
192
- decorated .__qualname__ = name # XXX: is this really correct?
193
- decorated .__name__ = name
194
206
vars ()[name ] = decorated
195
207
196
208
0 commit comments