-
Notifications
You must be signed in to change notification settings - Fork 5k
Added in non-generic interfaces for Tensors #113401
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
Note regarding the
|
1 similar comment
Note regarding the
|
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.
Pull Request Overview
This PR introduces non-generic tensor interfaces and updates tensor implementations to support basic operations such as index access via object indexers, memory pinning, and filling using object values. Key changes include:
- Replacing the generic IReadOnlyTensor<TSelf, T> with a non-generic IReadOnlyTensor interface.
- Introducing object-based indexers and methods for pinning backing memory.
- Updating tests to cover the new object API and memory pinning functionality.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/IReadOnlyTensor.cs | Replaces the generic interface with a non-generic version and adds new properties/methods (Lengths, Strides, indexers, GetPinnedHandle). |
src/libraries/System.Numerics.Tensors/tests/TensorTests.cs | Adds new tests for object-based filling, index access, and pinned memory handling. |
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ITensor.cs | Updates the ITensor interface to inherit from the non-generic IReadOnlyTensor and includes new signatures for indexers and Fill. |
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Tensor.cs | Adjusts the Tensor implementation to support the new non-generic interfaces and implements the GetPinnedHandle and object-based Fill methods. |
src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs | Updates the reference assemblies to reflect changes in the interfaces and class signatures. |
src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs
Show resolved
Hide resolved
/// <summary> | ||
/// Pins and gets a <see cref="MemoryHandle"/> to the backing memory. | ||
/// </summary> | ||
/// <returns><see cref="MemoryHandle"/></returns> |
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.
Missing return doc.
Fixes #111968 and fixes #111966
Addes in gon-generic interfaces for tensors that let you do basic operations.
Also adds in the ability to pin the backing memory.