def test_bilinear_initializer(self):
     """Test the bilinear initializer with supplied arguments
     """
     program = framework.Program()
     block = program.global_block()
     block.create_parameter(dtype="float32",
                            shape=[8, 1, 3, 3],
                            lod_level=0,
                            name="param",
                            initializer=initializer.BilinearInitializer())
     self.assertEqual(len(block.ops), 1)
     init_op = block.ops[0]
     self.assertEqual(init_op.type, 'assign_value')
Example #2
0
 def test_bilinear_initializer(self, dtype="float32"):
     """Test the bilinear initializer with supplied arguments
     """
     program = framework.Program()
     block = program.global_block()
     for _ in range(2):
         block.create_parameter(
             dtype=dtype,
             shape=[8, 1, 3, 3],
             lod_level=0,
             name="param",
             initializer=initializer.BilinearInitializer())
     num_ops = 2 if dtype == "float16" else 1
     self.assertEqual(len(block.ops), num_ops)
     init_op = block.ops[0]
     self.assertEqual(init_op.type, 'assign_value')
     return block