Пример #1
0
def logical_and(x1: ndarray, x2: ndarray):
    new_af_array \
        = _binary_func(x1._af_array,
                       x2._af_array,
                       backend.get().af_and)

    return ndarray(new_af_array)
Пример #2
0
def _as_str(self, dims: bool = True):
    arr_str = c_char_ptr_t(0)
    be = backend.get()
    safe_call(be.af_array_to_string(c_pointer(arr_str), "", self.arr, 4, dims))
    py_str = to_str(arr_str)
    safe_call(be.af_free_host(arr_str))
    return py_str
Пример #3
0
def mod(x1: ndarray, x2: ndarray):
    """
    Return element-wise remainder of division.
    """

    # return _binary_function(a, b, af.rem)
    new_af_array \
        = _arith_binary_func(x1._af_array, x2._af_array, backend.get().af_mod)

    return ndarray(new_af_array)
Пример #4
0
def bitwise_xor(x1: ndarray, x2: ndarray):
    new_af_array \
        = _binary_func(x1._af_array, x2._af_array, backend.get().af_bitxor)
    return ndarray(new_af_array)
Пример #5
0
def invert(x: ndarray):
    if not isinteger(x):
        raise TypeError("invert only supportd integers arguments")
    af_array = x._af_array
    return ndarray(_binary_func(af_array, -1, backend.get().af_bitxor))
Пример #6
0
def logical_not(x: ndarray):
    new_af_array = _arith_unary_func(x._af_array, backend.get().af_not)

    return ndarray(new_af_array)