We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I was trying to implement array_equal() for Cupy and was thinking along these lines
def array_equal(a1, a2): try: a1, a2 = cupy.asarray(a1), cupy.asarray(a2) except Exception: return False if a1.shape != a2.shape: return False return bool(cupy.asarray(a1 == a2).all())
Should I move forward with this ? I would be grateful if someone could guide me.
The text was updated successfully, but these errors were encountered:
Hello, thanks for being interested in contributing to CuPy!.
1st is that asarray checks are not needed, since cupy functions accepts only cupy arrays. https://docs-cupy.chainer.org/en/stable/reference/difference.html#universal-functions-only-work-with-cupy-array-or-scalar
asarray
2nd is that this function currently synchronizes the device when you do return bool(...) just doing a return (a1==a2).all() should be fine.
return bool(...)
return (a1==a2).all()
The function can be added to the cupy/logic/comparison.py file.
cupy/logic/comparison.py
For sending a PR you will need to add a docstring to the function and also add tests for the external behavior.
Sorry, something went wrong.
are you interested in opening a PR? @portfoliocreator Otherwise, I would be fine doing it!
@rushabh-v Yes , sure go ahead.
array_equal
emcastillo
Successfully merging a pull request may close this issue.
I was trying to implement array_equal() for Cupy and was thinking along these lines
Should I move forward with this ? I would be grateful if someone could guide me.
The text was updated successfully, but these errors were encountered: