-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[API Proposal]: Extend System.Numerics.Tensors.TensorPrimitives with primitive types other than float #93474
Comments
Tagging subscribers to this area: @dotnet/area-system-numerics Issue DetailsBackground and motivationWith the implementation of #89639 a new non-generic static API for the main arithmetic and conversion operators was added into the API Proposal
Methods affected: namespace System.Numerics.Tensors;
public static partial class TensorPrimitives
{
public static void Abs(ReadOnlySpan<float> x, Span<float> destination);
public static void Add(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination);
public static void Add(ReadOnlySpan<float> x, float y, Span<float> destination);
public static void Divide(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination);
public static void Divide(ReadOnlySpan<float> x, float y, Span<float> destination);
public static float Max(ReadOnlySpan<float> value);
public static float Min(ReadOnlySpan<float> value);
public static void Multiply(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination);
public static void Multiply(ReadOnlySpan<float> x, float y, Span<float> destination);
public static void Negate(ReadOnlySpan<float> values, Span<float> destination);
public static void Subtract(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination);
public static void Subtract(ReadOnlySpan<float> x, float y, Span<float> destination);
}
New methods (for all primitive types): namespace System.Numerics.Tensors;
public static partial class TensorPrimitives
{
public static void Divide(float x, ReadOnlySpan<float> y, Span<float> destination);
public static void Subtract(float x, ReadOnlySpan<float> y, Span<float> destination);
}
New methods (for all primitive types): namespace System.Numerics.Tensors;
public static partial class TensorPrimitives
{
public static void Equals(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<bool> destination);
public static bool EqualsAll(ReadOnlySpan<float> x, ReadOnlySpan<float> y);
public static bool EqualsAny(ReadOnlySpan<float> x, ReadOnlySpan<float> y);
public static void GreaterThan(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<bool> destination);
public static void GreaterThanOrEqual(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<bool> destination);
public static void LessThan(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<bool> destination);
public static void LessThanOrEqual(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<bool> destination);
} API UsageThe same as for the existing API proposed in #89639 Alternative DesignsNo response RisksNo response
|
Tagging subscribers to this area: @dotnet/area-system-numerics-tensors Issue DetailsBackground and motivationWith the implementation of #89639 a new non-generic static API for the main arithmetic and conversion operators was added into the API Proposal
Methods affected: namespace System.Numerics.Tensors;
public static partial class TensorPrimitives
{
public static void Abs(ReadOnlySpan<float> x, Span<float> destination);
public static void Add(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination);
public static void Add(ReadOnlySpan<float> x, float y, Span<float> destination);
public static void Divide(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination);
public static void Divide(ReadOnlySpan<float> x, float y, Span<float> destination);
public static float Max(ReadOnlySpan<float> value);
public static float Min(ReadOnlySpan<float> value);
public static void Multiply(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination);
public static void Multiply(ReadOnlySpan<float> x, float y, Span<float> destination);
public static void Negate(ReadOnlySpan<float> values, Span<float> destination);
public static void Subtract(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination);
public static void Subtract(ReadOnlySpan<float> x, float y, Span<float> destination);
}
New methods (for all primitive types): namespace System.Numerics.Tensors;
public static partial class TensorPrimitives
{
public static void Divide(float x, ReadOnlySpan<float> y, Span<float> destination);
public static void Subtract(float x, ReadOnlySpan<float> y, Span<float> destination);
}
New methods (for all primitive types): namespace System.Numerics.Tensors;
public static partial class TensorPrimitives
{
public static void Equals(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<bool> destination);
public static bool EqualsAll(ReadOnlySpan<float> x, ReadOnlySpan<float> y);
public static bool EqualsAny(ReadOnlySpan<float> x, ReadOnlySpan<float> y);
public static void GreaterThan(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<bool> destination);
public static void GreaterThanOrEqual(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<bool> destination);
public static void LessThan(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<bool> destination);
public static void LessThanOrEqual(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<bool> destination);
} API UsageThe same as for the existing API proposed in #89639 Alternative DesignsNo response RisksNo response
|
See #93286. |
(1) is handled via the added generic overloads. (2) is implemented via #96451. @tannergooding, do we want (3)? (generic rather than float-specific) |
Background and motivation
With the implementation of #89639 a new non-generic static API for the main arithmetic and conversion operators was added into the
System.Numerics.Tensors
namespace. This API provides hardware accelerated math onSpan<float>
type of data. Whilefloat
is very often used in AI, other primitive types are also widely used in many areas (for example for data wrangling). Microsoft.Data.Analysis is one of the packages that will benefit from the hardware accelerated math for other primitive types.API Proposal
double
,sbyte
,byte
,short
,ushort
,int
,uint
,long
andulong
types.Methods affected:
New methods (for all primitive types):
New methods (for all primitive types):
API Usage
The same as for the existing API proposed in #89639
Alternative Designs
No response
Risks
No response
The text was updated successfully, but these errors were encountered: