提交 c3974d96 编写于 作者: L lelelelelez

fix function-redefined

上级 44e4d57b
...@@ -517,7 +517,7 @@ class TestBicubicOpError(unittest.TestCase): ...@@ -517,7 +517,7 @@ class TestBicubicOpError(unittest.TestCase):
out = interpolate( out = interpolate(
x, size={2, 2}, mode='bicubic', align_corners=False) 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") x = fluid.data(name="x", shape=[2, 1, 0, 0], dtype="float32")
out = interpolate( out = interpolate(
x, size=[3, 3], mode="bicubic", align_corners=False) x, size=[3, 3], mode="bicubic", align_corners=False)
...@@ -539,7 +539,7 @@ class TestBicubicOpError(unittest.TestCase): ...@@ -539,7 +539,7 @@ class TestBicubicOpError(unittest.TestCase):
self.assertRaises(ValueError, test_size_and_scale) self.assertRaises(ValueError, test_size_and_scale)
self.assertRaises(ValueError, test_size_and_scale2) self.assertRaises(ValueError, test_size_and_scale2)
self.assertRaises(TypeError, test_size_type) self.assertRaises(TypeError, test_size_type)
self.assertRaises(ValueError, test_input_shape) self.assertRaises(ValueError, test_input_shape_1)
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -23,12 +23,6 @@ from test_softmax_with_cross_entropy_op import cross_entropy ...@@ -23,12 +23,6 @@ from test_softmax_with_cross_entropy_op import cross_entropy
from paddle.fluid import Program, program_guard 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): def log_softmax(x, axis=-1):
softmax_out = np.apply_along_axis(stable_softmax, axis, x) softmax_out = np.apply_along_axis(stable_softmax, axis, x)
return np.log(softmax_out) return np.log(softmax_out)
......
...@@ -418,7 +418,7 @@ class TestGlooWithCloudRoleMaker(unittest.TestCase): ...@@ -418,7 +418,7 @@ class TestGlooWithCloudRoleMaker(unittest.TestCase):
self.clean(tmp) self.clean(tmp)
class TestGlooWithCloudRoleMaker(unittest.TestCase): class TestGlooWithCloudRoleMaker1(unittest.TestCase):
def setUp(self): def setUp(self):
os.environ["PADDLE_TRAINERS_NUM"] = "1" os.environ["PADDLE_TRAINERS_NUM"] = "1"
os.environ["PADDLE_PSERVERS_IP_PORT_LIST"] = "127.0.0.1:36001" os.environ["PADDLE_PSERVERS_IP_PORT_LIST"] = "127.0.0.1:36001"
......
...@@ -133,10 +133,10 @@ class TestLinspaceOpError(unittest.TestCase): ...@@ -133,10 +133,10 @@ class TestLinspaceOpError(unittest.TestCase):
self.assertRaises(TypeError, test_dtype) self.assertRaises(TypeError, test_dtype)
def test_dtype(): def test_dtype1():
fluid.layers.linspace(0, 10, 1.33, dtype="int32") fluid.layers.linspace(0, 10, 1.33, dtype="int32")
self.assertRaises(TypeError, test_dtype) self.assertRaises(TypeError, test_dtype1)
def test_start_type(): def test_start_type():
fluid.layers.linspace([0], 10, 1, dtype="float32") fluid.layers.linspace([0], 10, 1, dtype="float32")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册