sxjscience commented on a change in pull request #16009: [Numpy] Numpy compatible bitwise_and operator URL: https://github.com/apache/incubator-mxnet/pull/16009#discussion_r323518818
########## File path: python/mxnet/symbol/numpy/_symbol.py ########## @@ -2328,4 +2329,38 @@ def get_list(arrays): return _npi.stack(*arrays, axis=axis, out=out) +@set_module('mxnet.symbol.numpy') +def bitwise_and(x1, x2, out=None): + """ + Computes the bit-wise AND of the underlying binary representation of + the integers in the input arrays. This method implements the C/Python + operator ``&``. + + Parameters + ---------- + x1, x2 : _Symbol + out : _Symbol or None, optional + Dummy parameter to keep the consistency with the ndarray counterpart. + + Returns + ------- + y : _Symbol of integer dtypes + + See Also + -------- + bitwise_or + bitwise_xor + + Notes + ------- + This function differs from the original `numpy.bitwise_and + <https://docs.scipy.org/doc/numpy/reference/generated/numpy.bitwise_and.html>`_ in + the following aspects: + - Input type currently does not support Python native iterables(list, tuple, ...). + - Input type currently does not support boolean arrays. + + """ Review comment: Make sure that we raise some error message for float types: ```python import numpy as np a = np.bitwise_and(1.0, 1.0) # TypeError: ufunc 'bitwise_and' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'' ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services