-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Rewrite of System.Numerics.Tensors to allow for more code sharing, various correctness fixes, and stability improvements #114927
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
Conversation
…qual, and the *All/*Any variants
* Refactor Tensor to be more reusable and validate appropriate state * finishing tensor primitives work --------- Co-authored-by: Tanner Gooding <tagoo@outlook.com>
* only couple left * pausing for food * fixed rented buffer * squeeze/unsqueeze * set slice/ split * only 2 left
…1, so embedded broadcasting works
* Fixing Broadcasting Loop * fixes from pr coments * squeeze fixed * unsqueeze * set slice * more tensor fies
* stack working * more tensor tests working * fix factory create tests
Note regarding the
|
1 similar comment
Note regarding the
|
No idea if the jit will optimize it or not, but just for clarity sake its probably better to store it locally. |
For Concatenate, all dimensions must be exactly the same except for the dimension we are concatenating on. So we skip it in that loop since we don't care if its equal. |
Yeah, here it can be moved out. |
This comment was marked as resolved.
This comment was marked as resolved.
maybe moving this check in the beginning of the else block would be reasonable? just to avoid the creating the spans? of course you can add to the check Refers to: src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Tensor.cs:1430 in eb42165. [](commit_id = eb42165, deletion_comment = False) |
would the values in the dimensions be trusted or it is ok to get out of range when indexing here? Refers to: src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Tensor.cs:1434 in eb42165. [](commit_id = eb42165, deletion_comment = False) |
This comment was marked as resolved.
This comment was marked as resolved.
Good call. Fixed. |
If they provide invalid dimensions its ok for them to get an error. It would probably be more clear though if we explicitly checked and then threw a more helpful error. I'll create an issue/todo for that. |
This is the naming convention that already shipped for these APIs on Thus, the Anything else requires exposing another |
-- As a side note, the way the review comments are being made does not attach them to the code like a normal review comment. This makes it very difficult to actually reply, to find out what was actually being commented on, and to know when something has or hasn't been resolved. |
It's fairly typical for us to not call Returning a rented array to the pool is not required and is simply best practice, but the overhead of the exception, risk for use after free bugs, and other considerations means we typically only return on the success path. |
Sorry about that, I am using codeflow and was assuming putting the comments attached to the code. It is weird as the first comments were correctly attached. I'll try to ensure comments attached to the code. |
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Tensor.cs
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Tensor.cs
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Tensor.cs
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Tensor.cs
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Tensor.cs
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Tensor.cs
Show resolved
Hide resolved
Assert.Equal(94, spanInt[0, 1]); | ||
Assert.Equal(94, spanInt[1, 0]); | ||
Assert.Equal(94, spanInt[1, 1]); | ||
// // TODO: Make sure it works with NIndex |
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.
Will these tests get done before merging?
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.
No, they would be for additional APIs that need to be exposed after the Build preview
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.
Added minor comments, LGTM!
/backport to release/10.0-preview4 |
Started backporting to release/10.0-preview4: https://github.com/dotnet/runtime/actions/runs/14629464290 |
No description provided.