170 references to TensorPrimitives
Microsoft.Extensions.AI.Integration.Tests (3)
EmbeddingGeneratorIntegrationTests.cs (2)
149distances[i, j] = TensorPrimitives.HammingBitDistance(embeddings[i].Bits.Span, embeddings[j].Bits.Span); 186distances[i, j] = TensorPrimitives.CosineSimilarity(embeddings[i].Vector.Span, embeddings[j].Vector.Span);
QuantizationEmbeddingGenerator.cs (1)
85TensorPrimitives.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\TensorExtensions.cs (128)
3521TensorPrimitives.Subtract(span, mean, output); 3522TensorPrimitives.Abs(output, output); 3523TensorPrimitives.Pow((ReadOnlySpan<T>)output, T.CreateChecked(2), output); 3524T sum = TensorPrimitives.Sum((ReadOnlySpan<T>)output); 3752return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Abs); 3777return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Acos); 3802return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Acosh); 3827return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.AcosPi); 3876return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Add); 3888return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Add); 3913return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Asin); 3938return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Asinh); 3963return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.AsinPi); 3988return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Atan); 4024return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Atan2); 4050return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Atan2); 4076return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination, TensorPrimitives.Atan2); 4112return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Atan2Pi); 4138return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Atan2Pi); 4164return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination, TensorPrimitives.Atan2Pi); 4190return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Atanh); 4215return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.AtanPi); 4251return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.BitwiseAnd); 4277return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.BitwiseAnd); 4313return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.BitwiseOr); 4339return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.BitwiseOr); 4364return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Cbrt); 4389return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Ceiling); 4419return ref TensorPrimitivesHelperSpanInSpanOut(source, destination, TensorPrimitives.ConvertChecked); 4449return ref TensorPrimitivesHelperSpanInSpanOut(source, destination, TensorPrimitives.ConvertSaturating); 4479return ref TensorPrimitivesHelperSpanInSpanOut(source, destination, TensorPrimitives.ConvertTruncating); 4529return ref TensorPrimitivesHelperSpanInTInSpanOut(x, sign, destination, TensorPrimitives.CopySign); 4541return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, sign, destination, TensorPrimitives.CopySign); 4566return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Cos); 4591return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Cosh); 4665values[outputOffset++] = TensorPrimitives.CosineSimilarity(lspan, rspan); 4718return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.CosPi); 4743return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.DegreesToRadians); 4756return TensorPrimitivesHelperTwoSpanInTOut(x, y, TensorPrimitives.Distance); 4819return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Divide); 4831return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination, TensorPrimitives.Divide); 4844return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Divide); 4857return TensorPrimitivesHelperTwoSpanInTOut(x, y, TensorPrimitives.Dot); 4882return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Exp); 4907return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Exp10); 4928return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Exp10M1); 4949return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Exp2); 4970return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Exp2M1); 4991return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.ExpM1); 5012return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Floor); 5050return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Hypot); 5084return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Ieee754Remainder); 5106return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Ieee754Remainder); 5128return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination, TensorPrimitives.Ieee754Remainder); 5149return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.ILogB); 5160return TensorPrimitives.IndexOfMax(span); 5171return TensorPrimitives.IndexOfMaxMagnitude(span); 5182return TensorPrimitives.IndexOfMin(span); 5195return TensorPrimitives.IndexOfMinMagnitude(span); 5220return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.LeadingZeroCount); 5245return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Log); 5275return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Log); 5297return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Log); 5322return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Log10); 5347return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Log10P1); 5372return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Log2); 5397return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Log2P1); 5422return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.LogP1); 5432return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.Max); 5462return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Max); 5483return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Max); 5493return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.MaxMagnitude); 5523return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.MaxMagnitude); 5544return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.MaxMagnitude); 5554return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.MaxMagnitudeNumber); 5584return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.MaxMagnitudeNumber); 5605return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.MaxMagnitudeNumber); 5615return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.MaxNumber); 5645return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.MaxNumber); 5666return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.MaxNumber); 5676return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.Min); 5706return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Min); 5727return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Min); 5737return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.MinMagnitude); 5767return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.MinMagnitude); 5788return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.MinMagnitude); 5798return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.MinMagnitudeNumber); 5828return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.MinMagnitudeNumber); 5849return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.MinMagnitudeNumber); 5859return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.MinNumber); 5889return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.MinNumber); 5910return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.MinNumber); 5962TensorPrimitives.Multiply(span, y, ospan); 5976return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Multiply); 5997return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Negate); 6009return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.Norm); 6030return ref TensorPrimitivesHelperSpanInSpanOut(y, destination, TensorPrimitives.OnesComplement); 6051return ref TensorPrimitivesHelperSpanInSpanOut(y, destination, TensorPrimitives.PopCount); 6083return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Pow); 6105return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Pow); 6127return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination, TensorPrimitives.Pow); 6137return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.Product); 6158return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.RadiansToDegrees); 6179return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Reciprocal); 6207TensorPrimitives.RootN(span, n, ospan); 6238TensorPrimitives.RotateLeft(span, rotateAmount, ospan); 6269TensorPrimitives.RotateRight(span, rotateAmount, ospan); 6291return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Round); 6319TensorPrimitives.Round(span, digits, mode, ospan); 6346TensorPrimitives.Round(span, digits, ospan); 6373TensorPrimitives.Round(span, mode, ospan); 6395return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Sigmoid); 6420return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Sin); 6441return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Sinh); 6462return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.SinPi); 6483return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.SoftMax); 6508return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Sqrt); 6570return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Subtract); 6582return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination, TensorPrimitives.Subtract); 6594return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Subtract); 6607return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.Sum); 6628return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Tan); 6649return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Tanh); 6670return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.TanPi); 6691return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.TrailingZeroCount); 6712return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Truncate); 6744return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Xor); 6769return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Xor);
System\Numerics\Tensors\netcore\TensorHelpers.cs (1)
112if (tensor._shape.Strides[i] != TensorPrimitives.Product(tensor.Lengths.Slice(i + 1, tensor.Lengths.Length - i - 1)))
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>;