Skip to content

Commit e60359f

Browse files
committed
fix function name
1 parent 0239fff commit e60359f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/legacy_test/test_zero_dim_binary_api.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ def test_dygraph_binary(self):
167167
# 1) x is 0D, y is 0D
168168
x_np = np.random.randint(-10, 10, [])
169169
y_np = np.random.randint(-10, 10, [])
170-
out_np = eval(f'np.{api.__name__}(x_np, y_np)')
170+
# Handle C++ binding functions with leading underscore in __name__
171+
api_name = api.__name__.lstrip('_')
172+
out_np = eval(f'np.{api_name}(x_np, y_np)')
171173

172174
x = paddle.to_tensor(x_np)
173175
y = paddle.to_tensor(y_np)
@@ -179,7 +181,7 @@ def test_dygraph_binary(self):
179181
# 2) x is ND, y is 0D
180182
x_np = np.random.randint(-10, 10, [3, 5])
181183
y_np = np.random.randint(-10, 10, [])
182-
out_np = eval(f'np.{api.__name__}(x_np, y_np)')
184+
out_np = eval(f'np.{api_name}(x_np, y_np)')
183185

184186
x = paddle.to_tensor(x_np)
185187
y = paddle.to_tensor(y_np)
@@ -191,7 +193,7 @@ def test_dygraph_binary(self):
191193
# 3) x is 0D , y is ND
192194
x_np = np.random.randint(-10, 10, [])
193195
y_np = np.random.randint(-10, 10, [3, 5])
194-
out_np = eval(f'np.{api.__name__}(x_np, y_np)')
196+
out_np = eval(f'np.{api_name}(x_np, y_np)')
195197

196198
x = paddle.to_tensor(x_np)
197199
y = paddle.to_tensor(y_np)

0 commit comments

Comments
 (0)