예제 #1
0
파일: test_absolute.py 프로젝트: shssf/dpnp
def test_absolute_float_3(type):
    a = numpy.array([[[-2., 3.], [9.1, 0.2]], [[-2., 5.0], [-2, -1.2]], [[1.0, -2.], [5.0, -1.1]]])
    ia = inp.array(a)

    result = inp.absolute(ia)
    expected = numpy.absolute(a)
    numpy.testing.assert_array_equal(expected, result)
예제 #2
0
파일: test_absolute.py 프로젝트: shssf/dpnp
def test_absolute_int(type):
    a = numpy.array([1, 0, 2, -3, -1, 2, 21, -9])
    ia = inp.array(a)

    result = inp.absolute(ia)
    expected = numpy.absolute(a)
    numpy.testing.assert_array_equal(expected, result)
예제 #3
0
파일: test_absolute.py 프로젝트: shssf/dpnp
def test_absolute_float(type):
    a = numpy.array([[-2., 3., 9.1], [-2., 5.0, -2], [1.0, -2., 5.0]])
    ia = inp.array(a)

    result = inp.absolute(ia)
    expected = numpy.absolute(a)
    numpy.testing.assert_array_equal(expected, result)
예제 #4
0
def abs(*args, **kwargs):
    """
    Calculate the absolute value element-wise.

    .. seealso:: :obj:`numpy.add`

    """

    return dpnp.absolute(*args, **kwargs)
예제 #5
0
def abs(*args, **kwargs):
    """
    Calculate the absolute value element-wise.

    For full documentation refer to :obj:`numpy.absolute`.

    Notes
    -----
    "obj:`dpnp.abs` is a shorthand for :obj:`dpnp.absolute`.

    Examples
    --------
    >>> import dpnp as np
    >>> a = np.array([-1.2, 1.2])
    >>> result = np.abs(a)
    >>> [x for x in result]
    [1.2, 1.2]

    """

    return dpnp.absolute(*args, **kwargs)