170 references to TensorPrimitives
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 (155)
System\Numerics\Tensors\netcore\ReadOnlyTensorDimensionSpan_1.cs (1)
31_length = TensorPrimitives.Product(tensor.Lengths[..dimension]);
System\Numerics\Tensors\netcore\Tensor.cs (8)
1350nint tempLinear = TensorPrimitives.Product(newLengths); 1423nint tempLinear = TensorPrimitives.Product(newLengths); 1500nint tempLinear = TensorPrimitives.Product(newLengths); 1549nint newSize = TensorPrimitives.Product(lengths); 3532return TensorPrimitives.IndexOfMax(span); 3544return TensorPrimitives.IndexOfMaxMagnitude(span); 3555return TensorPrimitives.IndexOfMin(span); 3568return TensorPrimitives.IndexOfMinMagnitude(span);
System\Numerics\Tensors\netcore\TensorDimensionSpan_1.cs (1)
28_length = TensorPrimitives.Product(tensor.Lengths[..dimension]);
System\Numerics\Tensors\netcore\TensorOperation.cs (119)
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); 964TensorPrimitives.Decrement(x, destination); 979TensorPrimitives.DegreesToRadians(x, destination); 996TensorPrimitives.Divide(x, y, destination); 1006TensorPrimitives.Divide(x, y, destination); 1015TensorPrimitives.Divide(x, y, destination); 1030destination[0] += TensorPrimitives.Dot(x, y); 1045TensorPrimitives.Exp(x, destination); 1060TensorPrimitives.Exp10(x, destination); 1075TensorPrimitives.Exp10M1(x, destination); 1090TensorPrimitives.Exp2(x, destination); 1105TensorPrimitives.Exp2M1(x, destination); 1120TensorPrimitives.ExpM1(x, destination); 1135TensorPrimitives.Floor(x, destination); 1150TensorPrimitives.Hypot(x, y, destination); 1167TensorPrimitives.Ieee754Remainder(x, y, destination); 1177TensorPrimitives.Ieee754Remainder(x, y, destination); 1186TensorPrimitives.Ieee754Remainder(x, y, destination); 1201TensorPrimitives.ILogB(x, destination); 1217TensorPrimitives.Increment(x, destination); 1232TensorPrimitives.LeadingZeroCount(x, destination); 1249TensorPrimitives.Log(x, destination); 1259TensorPrimitives.Log(x, y, destination); 1269TensorPrimitives.Log(x, y, destination); 1284TensorPrimitives.Log10(x, destination); 1299TensorPrimitives.Log10P1(x, destination); 1314TensorPrimitives.Log2(x, destination); 1329TensorPrimitives.Log2P1(x, destination); 1344TensorPrimitives.LogP1(x, destination); 1361destination = TensorPrimitives.Max(x); 1371TensorPrimitives.Max(x, y, destination); 1381TensorPrimitives.Max(x, y, destination); 1398destination = TensorPrimitives.MaxMagnitude(x); 1408TensorPrimitives.MaxMagnitude(x, y, destination); 1418TensorPrimitives.MaxMagnitude(x, y, destination); 1435destination = TensorPrimitives.MaxMagnitudeNumber(x); 1445TensorPrimitives.MaxMagnitudeNumber(x, y, destination); 1455TensorPrimitives.MaxMagnitudeNumber(x, y, destination); 1472destination = TensorPrimitives.MaxNumber(x); 1482TensorPrimitives.MaxNumber(x, y, destination); 1492TensorPrimitives.MaxNumber(x, y, destination); 1509destination = TensorPrimitives.Min(x); 1519TensorPrimitives.Min(x, y, destination); 1529TensorPrimitives.Min(x, y, destination); 1546destination = TensorPrimitives.MinMagnitude(x); 1556TensorPrimitives.MinMagnitude(x, y, destination); 1566TensorPrimitives.MinMagnitude(x, y, destination); 1583destination = TensorPrimitives.MinMagnitudeNumber(x); 1593TensorPrimitives.MinMagnitudeNumber(x, y, destination); 1603TensorPrimitives.MinMagnitudeNumber(x, y, destination); 1620destination = TensorPrimitives.MinNumber(x); 1630TensorPrimitives.MinNumber(x, y, destination); 1640TensorPrimitives.MinNumber(x, y, destination); 1656TensorPrimitives.Multiply(x, y, destination); 1666TensorPrimitives.Multiply(x, y, destination); 1681TensorPrimitives.Negate(x, destination); 1696TensorPrimitives.OnesComplement(x, destination); 1711TensorPrimitives.PopCount(x, destination); 1728TensorPrimitives.Pow(x, y, destination); 1738TensorPrimitives.Pow(x, y, destination); 1748TensorPrimitives.Pow(x, y, destination); 1763destination = TensorPrimitives.Product(x); 1778TensorPrimitives.RadiansToDegrees(x, destination); 1793TensorPrimitives.Reciprocal(x, destination); 1808TensorPrimitives.RootN(x, y, destination); 1822TensorPrimitives.RotateLeft(x, y, destination); 1836TensorPrimitives.RotateRight(x, y, destination); 1852TensorPrimitives.Round(x, destination); 1862TensorPrimitives.Round(x, y.Item1, y.Item2, destination); 1877TensorPrimitives.ShiftLeft(x, shiftAmount, destination); 1892TensorPrimitives.ShiftRightArithmetic(x, shiftAmount, destination); 1907TensorPrimitives.ShiftRightLogical(x, shiftAmount, destination); 1922TensorPrimitives.Sigmoid(x, destination); 1937TensorPrimitives.Sin(x, destination); 1952TensorPrimitives.Sinh(x, destination); 1967TensorPrimitives.SinPi(x, destination); 2019TensorPrimitives.Sqrt(x, destination); 2036TensorPrimitives.Subtract(x, y, destination); 2046TensorPrimitives.Subtract(x, y, destination); 2056TensorPrimitives.Subtract(x, y, destination); 2071destination += TensorPrimitives.Sum(x); 2116destination += TensorPrimitives.SumOfSquares(x); 2131TensorPrimitives.Tan(x, destination); 2146TensorPrimitives.Tanh(x, destination); 2161TensorPrimitives.TanPi(x, destination); 2176TensorPrimitives.TrailingZeroCount(x, destination); 2191TensorPrimitives.Truncate(x, destination); 2207TensorPrimitives.Xor(x, y, destination); 2217TensorPrimitives.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>;