Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions test/legacy_test/test_softmax_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def test_dygraph_check(self):
for r in [out1, out2]:
np.testing.assert_allclose(out_ref, r.numpy(), rtol=1e-05)

# explicilty use float32 for ROCm, as MIOpen does not yet support float64
# explicitly use float32 for ROCm, as MIOpen does not yet support float64
if core.is_compiled_with_rocm():
out = self.softmax(x, dtype=np.float32)
out_ref = ref_softmax(self.x_np, axis=-1, dtype=np.float32)
Expand All @@ -558,6 +558,7 @@ def test_dygraph_check(self):

paddle.enable_static()

@test_with_pir_api
def test_error(self):
with static_guard():
Comment thread
enkilee marked this conversation as resolved.
Resolved
with paddle.static.program_guard(paddle.static.Program()):
Expand All @@ -568,11 +569,12 @@ def test_error(self):
name='x_int32', shape=[2, 3], dtype='int32'
)
self.assertRaises(TypeError, self.softmax, x_int32)
# support the input dtype is float16
x_fp16 = paddle.static.data(
Comment thread
enkilee marked this conversation as resolved.
Resolved
name='x_fp16', shape=[2, 3], dtype='float16'
)
self.softmax(x_fp16)

if core.is_compiled_with_cuda():
x_fp16 = paddle.static.data(
name='x_fp16', shape=[2, 3], dtype='float16'
)
self.softmax(x_fp16)


class TestSoftmaxAPI_ZeroDim(unittest.TestCase):
Expand Down