def test_sin_scalar(self): x1 = xnd(1.2, type="float64") y1 = fn.sin(x1) x2 = xnd(1.23e1, type="float32") y2 = fn.sin(x2) if np is not None: a1 = np.array(1.2, dtype="float64") b1 = np.sin(a1) a2 = np.array(1.23e1, dtype="float32") b2 = np.sin(a2) np.testing.assert_equal(y1.value, b1) np.testing.assert_equal(y2.value, b2)
def test_sin(self): for lst, t, dtype in TEST_CASES: x = xnd(lst, type=t) y = fn.sin(x) if np is not None: a = np.array(lst, dtype=dtype) b = np.sin(a) np.testing.assert_equal(y, b)
def test_sin(self): s = math.sin lst = [[[1.0], [2.0, 3.0], [4.0, 5.0, 6.0]], [[7.0], [8.0, 9.0], [10.0, 11.0, 12.0]]] ans = [[[s(1.0)], [s(2.0), s(3.0)], [s(4.0), s(5.0), s(6.0)]], [[s(7.0)], [s(8.0), s(9.0)], [s(10.0), s(11.0), s(12.0)]]] x = xnd(lst) y = fn.sin(x) self.assertEqual(y.value, ans)
def test_sin_strided(self): for lst, t, dtype in TEST_CASES: x = xnd(lst, type=t) if x.type.ndim < 2: continue y = x[::-2, ::-2] z = fn.sin(y) if np is not None: a = np.array(lst, dtype=dtype) b = a[::-2, ::-2] c = np.sin(b) np.testing.assert_equal(z, c)