예제 #1
0
    def test_invalid_shape(self, shape):

        dp_array1 = dpnp.arange(10, dtype=dpnp.float64)
        dp_array2 = dpnp.arange(5, 15, dtype=dpnp.float64)
        dp_out = dpnp.empty(shape, dtype=dpnp.float64)

        with pytest.raises(ValueError):
            dpnp.power(dp_array1, dp_array2, out=dp_out)
예제 #2
0
def test_power(array, val, data_type, val_type):
    a = numpy.array(array, dtype=data_type)
    ia = inp.array(a)
    val_ = val_type(val)
    result = inp.power(ia, val_)
    expected = numpy.power(ia, val_)
    numpy.testing.assert_array_equal(expected, result)
예제 #3
0
def test_power(array, val, data_type, val_type):
    np_a = numpy.array(array, dtype=data_type)
    dpnp_a = dpnp.array(array, dtype=data_type)
    val_ = val_type(val)
    result = dpnp.power(dpnp_a, val_)
    expected = numpy.power(np_a, val_)
    numpy.testing.assert_array_equal(expected, result)
예제 #4
0
    def test_power(self):
        array1_data = numpy.arange(10)
        array2_data = numpy.arange(5, 15)
        out = numpy.empty(10, dtype=numpy.float64)

        # DPNP
        dp_array1 = dpnp.array(array1_data, dtype=dpnp.float64)
        dp_array2 = dpnp.array(array2_data, dtype=dpnp.float64)
        dp_out = dpnp.array(out, dtype=dpnp.float64)
        result = dpnp.power(dp_array1, dp_array2, out=dp_out)

        # original
        np_array1 = numpy.array(array1_data, dtype=numpy.float64)
        np_array2 = numpy.array(array2_data, dtype=numpy.float64)
        expected = numpy.power(np_array1, np_array2, out=out)

        numpy.testing.assert_array_equal(expected, result)
예제 #5
0
파일: dpnp_array.py 프로젝트: densmirn/dpnp
 def __pow__(self, other):
     return dpnp.power(self, other)