You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you were to replace A with A = view([1 2 3 1; 4 5 6 1; 7 8 9 1], 1:2, 1:3)
you would find that it works. The general rule is that views are supported, if they are sliced with ranges. If you slice with arbitrary vectors, you could do things like view(some_array, [1,3,4,13,14,6], ...)
with completely unpredictable memory layout for the elements of the resulting view. Technically, such a view would not have a strided memory layout. Only views with a strided memory layout are supported, which are those that you can make by only using ranges (and single integers, and colons) for indexing/slicing.
Rigth, then I guess what I'm asking for is a fallback implementation for objects without a strided memory layout. Tensor operations are still well defined even on general views, right?
Forgetting the performance implications for a moment, would that be possible?
That would indeed be possible, a simple implementation based on loops could indeed be provided. The need for this was never very high. There are also some tricky (but not insurmountable) issues with dispatch.
Is it possible to support views into arrays? It seems the api might be too specific.
e.g. a Matrix works as expected:
An equivalent view into a matrix throws a
MethodError: no method matching sview
errorSimply doing
collect
works as expected.Thank You
The text was updated successfully, but these errors were encountered: