Beispiel #1
0
 def func(self, place):
     prog = fluid.Program()
     with fluid.program_guard(prog):
         x = layers.create_parameter(dtype="float64", shape=[2, 8], name='x')
         y = layers.create_parameter(dtype="float64", shape=[8, 4], name='y')
         z = layers.mul(x=x, y=y)
         gradient_checker.grad_check([x, y], z, place=place)
Beispiel #2
0
 def func(self, place):
     # use small size since Jacobian gradients is time consuming
     root_data = self.root_data[..., :3, :3]
     prog = fluid.Program()
     with fluid.program_guard(prog):
         root = layers.create_parameter(
             dtype=root_data.dtype, shape=root_data.shape)
         root_t = layers.transpose(root, self.trans_dims)
         x = layers.matmul(x=root, y=root_t) + 1e-05
         out = paddle.cholesky(x, upper=self.attrs["upper"])
         grad_check(root, out, x_init=root_data, place=place)