def test_Cos4D (self): np_a = np.reshape(self.np_a, (2,2,2,3)) dc_a = dc.reshape(self.dc_a, (2,2,2,3)) npr = np.cos(np_a) dcr = dc.cos(dc_a) np.testing.assert_allclose(npr.flatten(), np.array(dcr.data()).astype(np.float32), rtol=1e-3, atol=1e-3)
def test_Cos1D(self): npr = np.cos(self.np_a) dcr = dc.cos(self.dc_a) np.testing.assert_allclose(npr, np.array(dcr.data()).astype(np.float32), rtol=1e-3, atol=1e-3)
def test_nnScalar_cos (self): np.testing.assert_allclose(np.cos(self.random_number1), dc.cos(self.random_number1), rtol=1e-3, atol=1e-3) np.testing.assert_allclose(np.cos(self.random_number2), dc.cos(self.random_number2), rtol=1e-3, atol=1e-3) np.testing.assert_allclose(np.cos(self.random_number3), dc.cos(self.random_number3), rtol=1e-3, atol=1e-3)