-
Notifications
You must be signed in to change notification settings - Fork 236
Open
Labels
triageNeeds the team's attentionNeeds the team's attention
Milestone
Description
Since strides in SMV are defined as counts of itemsize, they are a subset of what Numpy can handle and we should make sure arrays we can't handle are properly rejected. It seems that this is /mostly/ the case, but due to the lazy construction, the exception happens a little later than ideal. For example:
def test_from_array_interface_exception(init_cuda):
# Create an array with strides that aren't a multiple of itemsize
x = np.array([(1, 2.0), (3, 4.0)], dtype=[("a", "i4"), ("b", "f8")])["b"]
# with pytest.raises(ValueError) as e:
smv = StridedMemoryView.from_array_interface(x)
with pytest.raises(ValueError) as e:
smv.strides
assert "strides must be divisible by itemsize" in str(e)
In user code, this could make it harder for the user to find the source of the error.
But given this is a latent bug that I think also applies to CAI, and not introduced by this PR, I'd be fine with (a) adding this test above, (b) creating a follow-up issue to detect this case during construction.
Originally posted by @mdboom in #1428 (comment)
Metadata
Metadata
Assignees
Labels
triageNeeds the team's attentionNeeds the team's attention