187 references to TensorPrimitives
Microsoft.Data.Analysis (23)
Computations\Arithmetic.net8.cs (23)
76public static void And(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.BitwiseAnd(x, y, destination); 77public static void And(ReadOnlySpan<T> x, T y, Span<T> destination) => TensorPrimitives.BitwiseAnd(x, y, destination); 78public static void And(T x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.BitwiseAnd(y, x, destination); 79public static void Or(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.BitwiseOr(x, y, destination); 80public static void Or(ReadOnlySpan<T> x, T y, Span<T> destination) => TensorPrimitives.BitwiseOr(x, y, destination); 81public static void Or(T x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.BitwiseOr(y, x, destination); 82public static void Xor(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.Xor(x, y, destination); 83public static void Xor(ReadOnlySpan<T> x, T y, Span<T> destination) => TensorPrimitives.Xor(x, y, destination); 84public static void Xor(T x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.Xor(y, x, destination); 90public static void LeftShift(ReadOnlySpan<T> x, int shiftAmount, Span<T> destination) => TensorPrimitives.ShiftLeft(x, shiftAmount, destination); 91public static void RightShift(ReadOnlySpan<T> x, int shiftAmount, Span<T> destination) => TensorPrimitives.ShiftRightArithmetic(x, shiftAmount, destination); 97public static void Add(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.Add(x, y, destination); 98public static void Add(ReadOnlySpan<T> x, T y, Span<T> destination) => TensorPrimitives.Add(x, y, destination); 99public static void Add(T x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.Add(y, x, destination); 100public static void Subtract(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.Subtract(x, y, destination); 101public static void Subtract(ReadOnlySpan<T> x, T y, Span<T> destination) => TensorPrimitives.Subtract(x, y, destination); 102public static void Subtract(T x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.Subtract(x, y, destination); 103public static void Multiply(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.Multiply(x, y, destination); 104public static void Multiply(ReadOnlySpan<T> x, T y, Span<T> destination) => TensorPrimitives.Multiply(x, y, destination); 105public static void Multiply(T x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.Multiply(y, x, destination); 106public static void Divide(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.Divide(x, y, destination); 107public static void Divide(ReadOnlySpan<T> x, T y, Span<T> destination) => TensorPrimitives.Divide(x, y, destination); 108public static void Divide(T x, ReadOnlySpan<T> y, Span<T> destination) => TensorPrimitives.Divide(x, y, destination);
Microsoft.Extensions.AI.Integration.Tests (3)
EmbeddingGeneratorIntegrationTests.cs (2)
154distances[i, j] = TensorPrimitives.HammingBitDistance<byte>(ToArray(embeddings[i].Vector), ToArray(embeddings[j].Vector)); 198distances[i, j] = TensorPrimitives.CosineSimilarity(embeddings[i].Vector.Span, embeddings[j].Vector.Span);
QuantizationEmbeddingGenerator.cs (1)
83TensorPrimitives.ConvertToHalf(vector, result);
Microsoft.ML.CpuMath (12)
CpuMathUtils.cs (11)
24TensorPrimitives.Add(destination, value, destination); 36TensorPrimitives.Multiply(destination, value, destination); 56TensorPrimitives.Multiply(source.Slice(0, count), value, destination); 75TensorPrimitives.MultiplyAdd(source.Slice(0, count), scale, destination.Slice(0, count), destination); 97TensorPrimitives.MultiplyAdd(source.Slice(0, count), scale, destination.Slice(0, count), result.Slice(0, count)); 115TensorPrimitives.Add(source.Slice(0, count), destination.Slice(0, count), destination.Slice(0, count)); 136TensorPrimitives.Multiply(left.Slice(0, count), right.Slice(0, count), destination.Slice(0, count)); 149return TensorPrimitives.Sum(source); 162return TensorPrimitives.SumOfSquares(source); 175return TensorPrimitives.SumOfMagnitudes(source); 194return TensorPrimitives.Dot(left.Slice(0, count), right.Slice(0, count));
CpuMathUtils.netcoreapp.cs (1)
443var value = TensorPrimitives.Distance(left.Slice(0, count), right.Slice(0, count));
System.Numerics.Tensors (149)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBooleanUnaryOperator.cs (1)
8using static System.Numerics.Tensors.TensorPrimitives;
System\Numerics\Tensors\netcore\Tensor.cs (8)
1466nint tempLinear = TensorPrimitives.Product(newLengths); 1539nint tempLinear = TensorPrimitives.Product(newLengths); 1616nint tempLinear = TensorPrimitives.Product(newLengths); 1665nint newSize = TensorPrimitives.Product(lengths); 3929return TensorPrimitives.IndexOfMax(span); 3941return TensorPrimitives.IndexOfMaxMagnitude(span); 3952return TensorPrimitives.IndexOfMin(span); 3965return TensorPrimitives.IndexOfMinMagnitude(span);
System\Numerics\Tensors\netcore\TensorOperation.cs (114)
507TensorPrimitives.Abs(x, destination); 522TensorPrimitives.Acos(x, destination); 537TensorPrimitives.Acosh(x, destination); 552TensorPrimitives.AcosPi(x, destination); 568TensorPrimitives.Add(x, y, destination); 578TensorPrimitives.Add(x, y, destination); 593TensorPrimitives.Asin(x, destination); 608TensorPrimitives.Asinh(x, destination); 623TensorPrimitives.AsinPi(x, destination); 638TensorPrimitives.Atan(x, destination); 667TensorPrimitives.Atan2(x, y, destination); 696TensorPrimitives.Atan2Pi(x, y, destination); 711TensorPrimitives.Atanh(x, destination); 726TensorPrimitives.AtanPi(x, destination); 742TensorPrimitives.BitwiseAnd(x, y, destination); 752TensorPrimitives.BitwiseAnd(x, y, destination); 768TensorPrimitives.BitwiseOr(x, y, destination); 778TensorPrimitives.BitwiseOr(x, y, destination); 793TensorPrimitives.Cbrt(x, destination); 808TensorPrimitives.Ceiling(x, destination); 824TensorPrimitives.ConvertChecked(x, destination); 840TensorPrimitives.ConvertSaturating(x, destination); 856TensorPrimitives.ConvertTruncating(x, destination); 872TensorPrimitives.CopySign(x, y, destination); 882TensorPrimitives.CopySign(x, y, destination); 897TensorPrimitives.Cos(x, destination); 912TensorPrimitives.Cosh(x, destination); 931destination[0].Item1 += TensorPrimitives.Dot(x, y); 932destination[0].Item2 += TensorPrimitives.SumOfSquares(x); 933destination[0].Item3 += TensorPrimitives.SumOfSquares(y); 948TensorPrimitives.CosPi(x, destination); 963TensorPrimitives.DegreesToRadians(x, destination); 980TensorPrimitives.Divide(x, y, destination); 990TensorPrimitives.Divide(x, y, destination); 999TensorPrimitives.Divide(x, y, destination); 1014destination[0] += TensorPrimitives.Dot(x, y); 1029TensorPrimitives.Exp(x, destination); 1044TensorPrimitives.Exp10(x, destination); 1059TensorPrimitives.Exp10M1(x, destination); 1074TensorPrimitives.Exp2(x, destination); 1089TensorPrimitives.Exp2M1(x, destination); 1104TensorPrimitives.ExpM1(x, destination); 1119TensorPrimitives.Floor(x, destination); 1134TensorPrimitives.Hypot(x, y, destination); 1151TensorPrimitives.Ieee754Remainder(x, y, destination); 1161TensorPrimitives.Ieee754Remainder(x, y, destination); 1170TensorPrimitives.Ieee754Remainder(x, y, destination); 1185TensorPrimitives.ILogB(x, destination); 1200TensorPrimitives.LeadingZeroCount(x, destination); 1217TensorPrimitives.Log(x, destination); 1227TensorPrimitives.Log(x, y, destination); 1237TensorPrimitives.Log(x, y, destination); 1252TensorPrimitives.Log10(x, destination); 1267TensorPrimitives.Log10P1(x, destination); 1282TensorPrimitives.Log2(x, destination); 1297TensorPrimitives.Log2P1(x, destination); 1312TensorPrimitives.LogP1(x, destination); 1329destination = TensorPrimitives.Max(x); 1339TensorPrimitives.Max(x, y, destination); 1349TensorPrimitives.Max(x, y, destination); 1366destination = TensorPrimitives.MaxMagnitude(x); 1376TensorPrimitives.MaxMagnitude(x, y, destination); 1386TensorPrimitives.MaxMagnitude(x, y, destination); 1403destination = TensorPrimitives.MaxMagnitudeNumber(x); 1413TensorPrimitives.MaxMagnitudeNumber(x, y, destination); 1423TensorPrimitives.MaxMagnitudeNumber(x, y, destination); 1440destination = TensorPrimitives.MaxNumber(x); 1450TensorPrimitives.MaxNumber(x, y, destination); 1460TensorPrimitives.MaxNumber(x, y, destination); 1477destination = TensorPrimitives.Min(x); 1487TensorPrimitives.Min(x, y, destination); 1497TensorPrimitives.Min(x, y, destination); 1514destination = TensorPrimitives.MinMagnitude(x); 1524TensorPrimitives.MinMagnitude(x, y, destination); 1534TensorPrimitives.MinMagnitude(x, y, destination); 1551destination = TensorPrimitives.MinMagnitudeNumber(x); 1561TensorPrimitives.MinMagnitudeNumber(x, y, destination); 1571TensorPrimitives.MinMagnitudeNumber(x, y, destination); 1588destination = TensorPrimitives.MinNumber(x); 1598TensorPrimitives.MinNumber(x, y, destination); 1608TensorPrimitives.MinNumber(x, y, destination); 1624TensorPrimitives.Multiply(x, y, destination); 1634TensorPrimitives.Multiply(x, y, destination); 1649TensorPrimitives.Negate(x, destination); 1664TensorPrimitives.OnesComplement(x, destination); 1679TensorPrimitives.PopCount(x, destination); 1696TensorPrimitives.Pow(x, y, destination); 1706TensorPrimitives.Pow(x, y, destination); 1716TensorPrimitives.Pow(x, y, destination); 1731destination = TensorPrimitives.Product(x); 1746TensorPrimitives.RadiansToDegrees(x, destination); 1761TensorPrimitives.Reciprocal(x, destination); 1776TensorPrimitives.RootN(x, y, destination); 1790TensorPrimitives.RotateLeft(x, y, destination); 1804TensorPrimitives.RotateRight(x, y, destination); 1820TensorPrimitives.Round(x, destination); 1830TensorPrimitives.Round(x, y.Item1, y.Item2, destination); 1845TensorPrimitives.Sigmoid(x, destination); 1860TensorPrimitives.Sin(x, destination); 1875TensorPrimitives.Sinh(x, destination); 1890TensorPrimitives.SinPi(x, destination); 1942TensorPrimitives.Sqrt(x, destination); 1959TensorPrimitives.Subtract(x, y, destination); 1969TensorPrimitives.Subtract(x, y, destination); 1979TensorPrimitives.Subtract(x, y, destination); 1994destination += TensorPrimitives.Sum(x); 2039destination += TensorPrimitives.SumOfSquares(x); 2054TensorPrimitives.Tan(x, destination); 2069TensorPrimitives.Tanh(x, destination); 2084TensorPrimitives.TanPi(x, destination); 2099TensorPrimitives.TrailingZeroCount(x, destination); 2114TensorPrimitives.Truncate(x, destination); 2130TensorPrimitives.Xor(x, y, destination); 2140TensorPrimitives.Xor(x, y, destination);
System\Numerics\Tensors\netcore\TensorPrimitives.Single.netcore.cs (26)
9global using AbsoluteOperator_Single = System.Numerics.Tensors.TensorPrimitives.AbsoluteOperator<float>; 10global using AddOperator_Single = System.Numerics.Tensors.TensorPrimitives.AddOperator<float>; 11global using AddMultiplyOperator_Single = System.Numerics.Tensors.TensorPrimitives.AddMultiplyOperator<float>; 12global using CoshOperator_Single = System.Numerics.Tensors.TensorPrimitives.CoshOperator<float>; 13global using SubtractSquaredOperator_Single = System.Numerics.Tensors.TensorPrimitives.SubtractSquaredOperator<float>; 14global using DivideOperator_Single = System.Numerics.Tensors.TensorPrimitives.DivideOperator<float>; 15global using MultiplyOperator_Single = System.Numerics.Tensors.TensorPrimitives.MultiplyOperator<float>; 16global using ExpOperator_Single = System.Numerics.Tensors.TensorPrimitives.ExpOperator<float>; 17global using IndexOfMaxOperator_Single = System.Numerics.Tensors.TensorPrimitives.IndexOfMaxOperator<float>; 18global using IndexOfMaxMagnitudeOperator_Single = System.Numerics.Tensors.TensorPrimitives.IndexOfMaxMagnitudeOperator<float>; 19global using IndexOfMinOperator_Single = System.Numerics.Tensors.TensorPrimitives.IndexOfMinOperator<float>; 20global using IndexOfMinMagnitudeOperator_Single = System.Numerics.Tensors.TensorPrimitives.IndexOfMinMagnitudeOperator<float>; 21global using LogOperator_Single = System.Numerics.Tensors.TensorPrimitives.LogOperator<float>; 22global using Log2Operator_Single = System.Numerics.Tensors.TensorPrimitives.Log2Operator<float>; 23global using MaxOperator_Single = System.Numerics.Tensors.TensorPrimitives.MaxOperator<float>; 24global using MaxMagnitudeOperator_Single = System.Numerics.Tensors.TensorPrimitives.MaxMagnitudeOperator<float>; 25global using MinOperator_Single = System.Numerics.Tensors.TensorPrimitives.MinOperator<float>; 26global using MinMagnitudeOperator_Single = System.Numerics.Tensors.TensorPrimitives.MinMagnitudeOperator<float>; 27global using MultiplyAddOperator_Single = System.Numerics.Tensors.TensorPrimitives.MultiplyAddOperator<float>; 28global using NegateOperator_Single = System.Numerics.Tensors.TensorPrimitives.NegateOperator<float>; 29global using IdentityOperator_Single = System.Numerics.Tensors.TensorPrimitives.IdentityOperator<float>; 30global using SubtractOperator_Single = System.Numerics.Tensors.TensorPrimitives.SubtractOperator<float>; 31global using SigmoidOperator_Single = System.Numerics.Tensors.TensorPrimitives.SigmoidOperator<float>; 32global using SinhOperator_Single = System.Numerics.Tensors.TensorPrimitives.SinhOperator<float>; 33global using SquaredOperator_Single = System.Numerics.Tensors.TensorPrimitives.SquaredOperator<float>; 34global using TanhOperator_Single = System.Numerics.Tensors.TensorPrimitives.TanhOperator<float>;