Skip to content

Commit 953e32a

Browse files
authored
update error type (#2606)
* fix error type * fix * rollback apibase
1 parent 069d4df commit 953e32a

12 files changed

+17
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.DS_Store
22
*.DS_Store
3+
__pycache__

framework/api/nn/test_functional_hardshrink.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@ def test_hardshrink4():
9191
x = np.array([-1, -0.01, 2.5])
9292
threshold = "1"
9393
# res = np.array([-1, -0.01, 2.5])
94-
obj.exception(etype="InvalidArgumentError", x=x, threshold=threshold)
94+
obj.exception(etype="InvalidType", x=x, threshold=threshold)

framework/api/nn/test_functional_hardtanh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,4 @@ def test_hardtanh7():
133133
paddle_max = "-3.3"
134134
paddle_min = 3.3
135135
# res = np.minimum(np.maximum(x, paddle_min), paddle_max)
136-
obj.exception(etype="InvalidArgumentError", x=x, max=paddle_max, min=paddle_min)
136+
obj.exception(etype="InvalidType", x=x, max=paddle_max, min=paddle_min)

framework/api/nn/test_functional_logsoftmax.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def test_logsoftmax5():
109109
# 算法
110110
res = x.transpose(2, 0, 1).reshape(4, 6)
111111
res = np.log((np.exp(res) / sum(np.exp(res))).reshape(4, 2, 3).transpose(1, 2, 0))
112-
obj.exception(etype="InvalidArgumentError", x=x, axis=3)
112+
obj.exception(etype="InvalidArgument", x=x, axis=3)
113113

114114

115115
@pytest.mark.api_nn_log_softmax_exception
@@ -121,7 +121,7 @@ def test_logsoftmax6():
121121
# 算法
122122
res = x.transpose(2, 0, 1).reshape(4, 6)
123123
res = np.log((np.exp(res) / sum(np.exp(res))).reshape(4, 2, 3).transpose(1, 2, 0))
124-
obj.exception(etype="InvalidArgumentError", x=x, axis="3")
124+
obj.exception(etype="InvalidType", x=x, axis="3")
125125

126126

127127
@pytest.mark.api_nn_log_softmax_parameters

framework/api/nn/test_hardshrink.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@ def test_hardshrink4():
9191
x = np.array([-1, -0.01, 2.5])
9292
threshold = "1"
9393
# res = np.array([-1, -0.01, 2.5])
94-
obj.exception(etype="InvalidArgumentError", data=x, threshold=threshold)
94+
obj.exception(etype="InvalidType", data=x, threshold=threshold)

framework/api/nn/test_hardtanh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,4 @@ def test_hardtanh7():
133133
paddle_max = "-3.3"
134134
paddle_min = 3.3
135135
# res = np.minimum(np.maximum(x, paddle_min), paddle_max)
136-
obj.exception(etype="InvalidArgumentError", data=x, max=paddle_max, min=paddle_min)
136+
obj.exception(etype="InvalidType", data=x, max=paddle_max, min=paddle_min)

framework/api/nn/test_logsoftmax.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_logsoftmax5():
108108
# 算法
109109
res = x.transpose(2, 0, 1).reshape(4, 6)
110110
res = np.log((np.exp(res) / sum(np.exp(res))).reshape(4, 2, 3).transpose(1, 2, 0))
111-
obj.exception(etype="InvalidArgumentError", data=x, axis=3)
111+
obj.exception(etype="InvalidArgument", data=x, axis=3)
112112

113113

114114
@pytest.mark.api_nn_LogSoftmax_exception
@@ -120,4 +120,4 @@ def test_logsoftmax6():
120120
# 算法
121121
res = x.transpose(2, 0, 1).reshape(4, 6)
122122
res = np.log((np.exp(res) / sum(np.exp(res))).reshape(4, 2, 3).transpose(1, 2, 0))
123-
obj.exception(etype="InvalidArgumentError", data=x, axis="3")
123+
obj.exception(etype="InvalidType", data=x, axis="3")

framework/api/paddlebase/test_diag.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def test_diag24():
311311
x=2-D,x_shape=[3,3,3],c++error,static ValueError
312312
"""
313313
x = np.zeros([3, 3, 3])
314-
obj.exception(mode="c", x=x, etype="InvalidArgumentError")
314+
obj.exception(mode="c", x=x, etype="InvalidArgument")
315315

316316

317317
@pytest.mark.api_base_diag_exception
@@ -321,7 +321,7 @@ def test_diag25():
321321
"""
322322
x = np.array([1, 2])
323323
offset = 2.5
324-
obj.exception(mode="c", x=x, offset=offset, etype="InvalidArgumentError")
324+
obj.exception(mode="c", x=x, offset=offset, etype="InvalidType")
325325

326326

327327
# @pytest.mark.api_base_diag_exception

framework/api/paddlebase/test_expand.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def test_expand17():
220220
"""
221221
x = np.array([1, 2]).astype(np.int64)
222222
shape = [[1], [2], [3]]
223-
obj.exception(x=x, shape=shape, mode="c", etype="InvalidArgument")
223+
obj.exception(x=x, shape=shape, mode="c", etype="InvalidType")
224224

225225

226226
# def test_expand18():

framework/api/paddlebase/test_index_select.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,4 @@ def test_index_select9():
156156
x = np.arange(6).reshape(2, 3).astype("int32")
157157
index = np.array([0, 2])
158158
axis = 1.3
159-
obj1.exception(mode="c", etype="InvalidArgument", x=x, index=index, axis=axis)
159+
obj1.exception(mode="c", etype="InvalidType", x=x, index=index, axis=axis)

0 commit comments

Comments
 (0)