"tests-unit/comfy_api_nodes_test/mapper_utils_test.py" did not exist on "394e7a416603d4f9b60e60554ac5194c58f3b359"
test_special.py 715 Bytes
Newer Older
root's avatar
root committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import unittest

import cupy
from cupy import testing


class TestSpecial(unittest.TestCase):

    @testing.for_dtypes(['e', 'f', 'd'])
    @testing.numpy_cupy_allclose(rtol=1e-3)
    def test_i0(self, xp, dtype):
        a = testing.shaped_random((2, 3), xp, dtype)
        return xp.i0(a)

    @testing.for_dtypes(['e', 'f', 'd', 'F', 'D'])
    @testing.numpy_cupy_allclose(atol=1e-3)
    def test_sinc(self, xp, dtype):
        a = testing.shaped_random((2, 3), xp, dtype, scale=1)
        return xp.sinc(a)

    @testing.for_dtypes(['e', 'f', 'd', 'F', 'D'])
    def test_sinc_zero(self, dtype):
        a = cupy.sinc(cupy.zeros(1, dtype=dtype))
        testing.assert_array_equal(a, cupy.ones(1, dtype=dtype))