Exemplo n.º 1
0
 def test_Sub1D_int_float(self):
     npr = np.subtract(self.np_int_a, self.np_float_b)
     dcr = dc.sub(self.dc_int_a, self.dc_float_b)
     np.testing.assert_allclose(npr,
                                np.array(dcr.data()),
                                rtol=1e-3,
                                atol=1e-3)
Exemplo n.º 2
0
 def test_Sub1D_double_bool(self):
     npr = np.subtract(self.np_double_a, self.np_bool_b)
     dcr = dc.sub(self.dc_double_a, self.dc_bool_b)
     np.testing.assert_allclose(npr,
                                np.array(dcr.data()),
                                rtol=1e-3,
                                atol=1e-3)
Exemplo n.º 3
0
 def test_Sub4D_double_double(self):
     np_double_a = np.reshape(self.np_double_a, (4, 2, 2, 3))
     np_double_b = np.reshape(self.np_double_b, (4, 2, 2, 3))
     dc_double_a = dc.reshape(self.dc_double_a, (4, 2, 2, 3))
     dc_double_b = dc.reshape(self.dc_double_b, (4, 2, 2, 3))
     npr = np.subtract(np_double_a, np_double_b)
     dcr = dc.sub(dc_double_a, dc_double_b)
     np.testing.assert_allclose(npr.flatten(),
                                np.array(dcr.data()),
                                rtol=1e-3,
                                atol=1e-3)
Exemplo n.º 4
0
 def test_Sub3D_float_float(self):
     np_float_a = np.reshape(self.np_float_a, (4, 4, 3))
     np_float_b = np.reshape(self.np_float_b, (4, 4, 3))
     dc_float_a = dc.reshape(self.dc_float_a, (4, 4, 3))
     dc_float_b = dc.reshape(self.dc_float_b, (4, 4, 3))
     npr = np.subtract(np_float_a, np_float_b)
     dcr = dc.sub(dc_float_a, dc_float_b)
     np.testing.assert_allclose(npr.flatten(),
                                np.array(dcr.data()),
                                rtol=1e-3,
                                atol=1e-3)