MCPcopy Create free account
hub / github.com/numpy/numpy / bitwise_or

Function bitwise_or

numpy/array_api/_elementwise_functions.py:178–192  ·  view source on GitHub ↗

Array API compatible wrapper for :py:func:`np.bitwise_or `. See its docstring for more information.

(x1: Array, x2: Array, /)

Source from the content-addressed store, hash-verified

176
177
178def bitwise_or(x1: Array, x2: Array, /) -> Array:
179 """
180 Array API compatible wrapper for :py:func:`np.bitwise_or <numpy.bitwise_or>`.
181
182 See its docstring for more information.
183 """
184 if (
185 x1.dtype not in _integer_or_boolean_dtypes
186 or x2.dtype not in _integer_or_boolean_dtypes
187 ):
188 raise TypeError("Only integer or boolean dtypes are allowed in bitwise_or")
189 # Call result type here just to raise on disallowed type combinations
190 _result_type(x1.dtype, x2.dtype)
191 x1, x2 = Array._normalize_two_args(x1, x2)
192 return Array._new(np.bitwise_or(x1._array, x2._array))
193
194
195# Note: the function name is different here

Callers 3

__or__Method · 0.85
__ror__Method · 0.85
__ior__Method · 0.85

Calls 3

_result_typeFunction · 0.85
_normalize_two_argsMethod · 0.80
_newMethod · 0.80

Tested by

no test coverage detected