コード例 #1
0
ファイル: test_polynomial.py プロジェクト: carterbox/cupy
 def test_poly1d_numpy_poly1d_variable(self, xp, dtype):
     array = testing.shaped_arange((5, ), numpy, dtype)
     a = numpy.poly1d(array, variable='z')
     with cupyx.allow_synchronize(False):
         out = xp.poly1d(a, variable=self.variable)
     assert out.variable == (self.variable or 'z')
     return out
コード例 #2
0
ファイル: test_polynomial.py プロジェクト: carterbox/cupy
 def test_poly1d_zero_size(self, xp, dtype):
     a = testing.shaped_arange((0, ), xp, dtype)
     with cupyx.allow_synchronize(False):
         out = xp.poly1d(a, variable=self.variable)
     assert out.variable == (self.variable or 'x')
     return out
コード例 #3
0
ファイル: test_polynomial.py プロジェクト: carterbox/cupy
 def test_poly1d_list(self, xp):
     with cupyx.allow_synchronize(False):
         out = xp.poly1d([1, 2, 3, 4], variable=self.variable)
     assert out.variable == (self.variable or 'x')
     return out
コード例 #4
0
ファイル: test_polynomial.py プロジェクト: carterbox/cupy
 def test_poly1d_setitem_leading_zeros(self, xp, dtype):
     a = xp.array([0, 0, 0, 2, 3, 0], dtype)
     b = xp.poly1d(a)
     with cupyx.allow_synchronize(False):
         b[1] = 10
     return b
コード例 #5
0
ファイル: test_polynomial.py プロジェクト: carterbox/cupy
 def test_poly1d_numpy_array(self, xp, dtype):
     a = numpy.arange(5, dtype=dtype)
     with cupyx.allow_synchronize(False):
         out = xp.poly1d(a, variable=self.variable)
     assert out.variable == (self.variable or 'x')
     return out
コード例 #6
0
ファイル: test_polynomial.py プロジェクト: carterbox/cupy
 def test_poly1d_setitem(self, xp, dtype):
     a = testing.shaped_arange((10, ), xp, dtype)
     b = xp.poly1d(a)
     with cupyx.allow_synchronize(False):
         b[100] = 20
     return b
コード例 #7
0
ファイル: test_polynomial.py プロジェクト: carterbox/cupy
 def test_poly1d_getitem4(self, xp, dtype):
     a = xp.array([0, 0, 1, 2, 3, 0], dtype)
     with cupyx.allow_synchronize(False):
         return xp.poly1d(a)[2]
コード例 #8
0
ファイル: test_polynomial.py プロジェクト: carterbox/cupy
 def test_poly1d_getitem3(self, xp, dtype):
     a = testing.shaped_arange((10, ), xp, dtype)
     with cupyx.allow_synchronize(False):
         return xp.poly1d(a)[100]
コード例 #9
0
 def test_disallowed(self):
     a = cupy.array([2, 3])
     with cupyx.allow_synchronize(False):
         with pytest.raises(cupyx.DeviceSynchronized):
             a.get()
コード例 #10
0
 def test_nested_allowed(self):
     a = cupy.array([2, 3])
     with cupyx.allow_synchronize(False):
         with cupyx.allow_synchronize(True):
             a.get()