From 1107664d6833c0ac03a30a3fd21a3441545088b6 Mon Sep 17 00:00:00 2001 From: lelelelelez Date: Fri, 30 Jul 2021 20:04:48 +0800 Subject: [PATCH] fix function-redefined --- .../fluid/tests/unittests/test_bicubic_interp_v2_op.py | 4 ++-- .../paddle/fluid/tests/unittests/test_cross_entropy_loss.py | 6 ------ python/paddle/fluid/tests/unittests/test_linspace.py | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_bicubic_interp_v2_op.py b/python/paddle/fluid/tests/unittests/test_bicubic_interp_v2_op.py index a517d25524032..43e418addf2bf 100644 --- a/python/paddle/fluid/tests/unittests/test_bicubic_interp_v2_op.py +++ b/python/paddle/fluid/tests/unittests/test_bicubic_interp_v2_op.py @@ -517,7 +517,7 @@ def test_size_type(): out = interpolate( x, size={2, 2}, mode='bicubic', align_corners=False) - def test_input_shape(): + def test_input_shape_1(): x = fluid.data(name="x", shape=[2, 1, 0, 0], dtype="float32") out = interpolate( x, size=[3, 3], mode="bicubic", align_corners=False) @@ -539,7 +539,7 @@ def test_input_shape(): self.assertRaises(ValueError, test_size_and_scale) self.assertRaises(ValueError, test_size_and_scale2) self.assertRaises(TypeError, test_size_type) - self.assertRaises(ValueError, test_input_shape) + self.assertRaises(ValueError, test_input_shape_1) if __name__ == "__main__": diff --git a/python/paddle/fluid/tests/unittests/test_cross_entropy_loss.py b/python/paddle/fluid/tests/unittests/test_cross_entropy_loss.py index 731e4b54e22c3..a4e676901c560 100644 --- a/python/paddle/fluid/tests/unittests/test_cross_entropy_loss.py +++ b/python/paddle/fluid/tests/unittests/test_cross_entropy_loss.py @@ -23,12 +23,6 @@ from paddle.fluid import Program, program_guard -def stable_softmax(x): - shiftx = (x - np.max(x)).clip(-64.) - exps = np.exp(shiftx) - return exps / np.sum(exps) - - def log_softmax(x, axis=-1): softmax_out = np.apply_along_axis(stable_softmax, axis, x) return np.log(softmax_out) diff --git a/python/paddle/fluid/tests/unittests/test_linspace.py b/python/paddle/fluid/tests/unittests/test_linspace.py index 635b3437f70aa..54846e6a14bd2 100644 --- a/python/paddle/fluid/tests/unittests/test_linspace.py +++ b/python/paddle/fluid/tests/unittests/test_linspace.py @@ -133,10 +133,10 @@ def test_dtype(): self.assertRaises(TypeError, test_dtype) - def test_dtype(): + def test_dtype1(): fluid.layers.linspace(0, 10, 1.33, dtype="int32") - self.assertRaises(TypeError, test_dtype) + self.assertRaises(TypeError, test_dtype1) def test_start_type(): fluid.layers.linspace([0], 10, 1, dtype="float32")