提交 937061a4 编写于 作者: Q qiaolongfei

update test_initializer.py

上级 8aeac782
...@@ -132,20 +132,13 @@ class TestUniformInitializer(unittest.TestCase): ...@@ -132,20 +132,13 @@ class TestUniformInitializer(unittest.TestCase):
lod_level=0, lod_level=0,
name="param", name="param",
initializer=initializer.UniformInitializer(-4.2, float(i), 123)) initializer=initializer.UniformInitializer(-4.2, float(i), 123))
self.assertEqual(len(block.ops), 2) self.assertEqual(len(block.ops), 1)
init_op0 = block.ops[0] init_op0 = block.ops[0]
self.assertEqual(init_op0.type, 'uniform_random') self.assertEqual(init_op0.type, 'uniform_random')
self.assertAlmostEqual(init_op0.attr('min'), -4.2, delta=DELTA) self.assertAlmostEqual(init_op0.attr('min'), -4.2, delta=DELTA)
self.assertAlmostEqual(init_op0.attr('max'), 1.0, delta=DELTA) self.assertAlmostEqual(init_op0.attr('max'), 1.0, delta=DELTA)
self.assertEqual(init_op0.attr('seed'), 123) self.assertEqual(init_op0.attr('seed'), 123)
self.assertEqual(len(block.ops), 2)
init_op1 = block.ops[1]
self.assertEqual(init_op1.type, 'uniform_random')
self.assertAlmostEqual(init_op1.attr('min'), -4.2, delta=DELTA)
self.assertAlmostEqual(init_op1.attr('max'), 0.0, delta=DELTA)
self.assertEqual(init_op1.attr('seed'), 123)
class TestNormalInitializer(unittest.TestCase): class TestNormalInitializer(unittest.TestCase):
def test_normal_initializer_default_value(self): def test_normal_initializer_default_value(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册