-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
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
Added array_equal function and tests #87
Conversation
[1, 1], | ||
[1, 1] | ||
]) | ||
assert tp.array_equal(a, b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert
s are stripped from docs. Probably want:
assert tp.array_equal(a, b) | |
# doc: print-locals a b is_equal | |
is_equal = tp.array_equal(a, b) | |
assert is_equal |
(the comment could go at the top of the example)
1ea72fd
to
873c90a
Compare
@pranavm-nvidia Should we auto-convert input tensors to |
I'm not entirely sure. You could make this argument for pretty much all Tripy APIs. Let's discuss offline. |
873c90a
to
76426e2
Compare
Due to a lack of support for constructing memrefs with negative strides
Constructing a tp.Tensor over np.broadcast_to is problematic.
76426e2
to
44f901c
Compare
if a.dtype != b.dtype: | ||
b = cast(b, a.dtype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we return False here?
Superseded by #375 |
While working on #37, noticed that we were using
tp.allclose
in contexts where we should probably be using something similar tonp.array_equal
instead. This MR will:tp.array_equal
tp.allclose
(we should probably only be usingtp.allclose
when working with float tensors)np.array_equal(cp.from_dlpack(_).get()
trick to usetp.array_equal