Commit ad9bc92
Fix torch-incompatible assertions in TestViewCudaArrayInterfaceGPU (#1999)
* Fix torch-incompatible assertions in TestViewCudaArrayInterfaceGPU
The _check_view method in TestViewCudaArrayInterfaceGPU was missed
during the tensor bridge refactor (#1894) and still used raw numpy
attributes (in_arr.size, in_arr.strides, in_arr.flags, etc.) that
don't work with torch tensors. Use the _arr_* helpers that #1894
added for torch/numpy compatibility.
Caught by the nightly optional-dependency CI (#1987).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix strides assertion for torch CAI: allow explicit C-contiguous strides
torch's __cuda_array_interface__ always reports strides, even for
C-contiguous tensors. Use the same assertion pattern as the other
_check_view methods: allow strides to equal the C-contiguous values
instead of requiring None.
Verified locally: 7/7 torch CAI tests pass.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Unify strides assertion pattern across all _check_view methods
Use the same if/else pattern with `in (None, strides_in_counts)` in
all three _check_view methods for consistency. Previously TestViewCPU
and TestViewCudaArrayInterfaceGPU used a one-liner that was harder
to read and behaved slightly differently.
Verified locally: 66/66 tests pass across TestViewCPU, TestViewGPU,
and TestViewCudaArrayInterfaceGPU (including all torch variants).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Address review: flip strides assertion, add _arr_dtype, merge main
Per @rwgk's review:
- Flip strides check to branch on view.strides (all 3 _check_view)
- Add _arr_dtype helper using __cuda_array_interface__["typestr"]
for torch tensors, restore dtype assertion in CAI _check_view
- Merge main to pick up #1998 (numba flags fix)
Verified locally: 76/76 tests pass across all three test classes.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 371fa42 commit ad9bc92
1 file changed
Lines changed: 20 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
114 | 120 | | |
115 | 121 | | |
116 | 122 | | |
| |||
171 | 177 | | |
172 | 178 | | |
173 | 179 | | |
174 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
175 | 184 | | |
176 | 185 | | |
177 | 186 | | |
| |||
277 | 286 | | |
278 | 287 | | |
279 | 288 | | |
280 | | - | |
281 | | - | |
| 289 | + | |
| 290 | + | |
282 | 291 | | |
283 | 292 | | |
284 | 293 | | |
| |||
343 | 352 | | |
344 | 353 | | |
345 | 354 | | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
352 | 362 | | |
353 | 363 | | |
354 | | - | |
| 364 | + | |
355 | 365 | | |
356 | 366 | | |
357 | 367 | | |
| |||
0 commit comments