Skip to content
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

Add approved TensorPrimitives surface area #112933

Merged
merged 3 commits into from
Mar 3, 2025
Merged

Conversation

stephentoub
Copy link
Member

Adds all of the approved TensorPrimitives surface area from:
#103611
#104117

Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-numerics-tensors
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR adds the approved surface area for TensorPrimitives by introducing a variety of new element‐wise operations (e.g. average, is complex, is finite, bitwise and arithmetic increments/decrements, division with remainder, and clamping) for numeric tensors. Key changes include the implementation of new static methods in TensorPrimitives for common numeric operations, the introduction of vectorized operator overloads, and several overloads to support both span and scalar inputs.

Reviewed Changes

File Description
TensorPrimitives.Average.cs Adds a method to compute the average of elements.
TensorPrimitives.IsComplexNumber.cs Adds methods for checking complex number properties.
TensorPrimitives.IsFinite.cs Implements methods to check finiteness with vectorized operations.
TensorPrimitives.BitDecrement.cs Provides bit decrement functionality.
TensorPrimitives.IsEvenInteger.cs Introduces methods for identifying even integral numbers.
TensorPrimitives.ConvertToIntegerNative.cs Implements platform-specific native conversion to integer.
TensorPrimitives.IsCanonical.cs Adds canonical form checks with vectorized shortcuts.
TensorPrimitives.ConvertToInteger.cs Implements saturating integer conversion.
TensorPrimitives.BitIncrement.cs Provides bit increment operations.
TensorPrimitives.Increment.cs Adds element-wise increment functionality.
TensorPrimitives.Decrement.cs Adds element-wise decrement functionality.
TensorPrimitives.DivRem.cs Implements division with remainder for spans and scalars.
TensorPrimitives.Clamp.cs Provides multiple overloads for clamping tensor values.

Copilot reviewed 45 out of 45 changed files in this pull request and generated 3 comments.

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more

@stephentoub stephentoub merged commit dfac023 into dotnet:main Mar 3, 2025
77 of 81 checks passed
@stephentoub stephentoub deleted the moretp branch March 3, 2025 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants