190 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)
151distances[i, j] = TensorPrimitives.HammingBitDistance(embeddings[i].Bits.Span, embeddings[j].Bits.Span); 188distances[i, j] = TensorPrimitives.CosineSimilarity(embeddings[i].Vector.Span, embeddings[j].Vector.Span);
QuantizationEmbeddingGenerator.cs (1)
84TensorPrimitives.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 (152)
System\Numerics\Tensors\netcore\TensorExtensions.cs (125)
3797return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Abs); 3822return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Acos); 3847return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Acosh); 3872return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.AcosPi); 3921return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Add); 3933return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Add); 3958return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Asin); 3983return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Asinh); 4008return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.AsinPi); 4033return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Atan); 4069return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Atan2); 4095return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Atan2); 4121return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination, TensorPrimitives.Atan2); 4157return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Atan2Pi); 4183return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Atan2Pi); 4209return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination, TensorPrimitives.Atan2Pi); 4235return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Atanh); 4260return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.AtanPi); 4296return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.BitwiseAnd); 4322return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.BitwiseAnd); 4358return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.BitwiseOr); 4384return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.BitwiseOr); 4409return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Cbrt); 4434return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Ceiling); 4464return ref TensorPrimitivesHelperSpanInSpanOut(source, destination, TensorPrimitives.ConvertChecked); 4494return ref TensorPrimitivesHelperSpanInSpanOut(source, destination, TensorPrimitives.ConvertSaturating); 4524return ref TensorPrimitivesHelperSpanInSpanOut(source, destination, TensorPrimitives.ConvertTruncating); 4574return ref TensorPrimitivesHelperSpanInTInSpanOut(x, sign, destination, TensorPrimitives.CopySign); 4586return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, sign, destination, TensorPrimitives.CopySign); 4611return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Cos); 4636return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Cosh); 4710values[outputOffset++] = TensorPrimitives.CosineSimilarity(lspan, rspan); 4763return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.CosPi); 4788return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.DegreesToRadians); 4801return TensorPrimitivesHelperTwoSpanInTOut(x, y, TensorPrimitives.Distance); 4864return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Divide); 4876return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination, TensorPrimitives.Divide); 4889return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Divide); 4902return TensorPrimitivesHelperTwoSpanInTOut(x, y, TensorPrimitives.Dot); 4927return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Exp); 4952return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Exp10); 4973return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Exp10M1); 4994return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Exp2); 5015return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Exp2M1); 5036return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.ExpM1); 5057return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Floor); 5095return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Hypot); 5129return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Ieee754Remainder); 5151return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Ieee754Remainder); 5173return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination, TensorPrimitives.Ieee754Remainder); 5194return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.ILogB); 5205return TensorPrimitives.IndexOfMax(span); 5216return TensorPrimitives.IndexOfMaxMagnitude(span); 5227return TensorPrimitives.IndexOfMin(span); 5240return TensorPrimitives.IndexOfMinMagnitude(span); 5265return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.LeadingZeroCount); 5290return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Log); 5320return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Log); 5342return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Log); 5367return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Log10); 5392return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Log10P1); 5417return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Log2); 5442return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Log2P1); 5467return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.LogP1); 5477return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.Max); 5507return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Max); 5528return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Max); 5538return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.MaxMagnitude); 5568return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.MaxMagnitude); 5589return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.MaxMagnitude); 5599return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.MaxMagnitudeNumber); 5629return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.MaxMagnitudeNumber); 5650return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.MaxMagnitudeNumber); 5660return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.MaxNumber); 5690return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.MaxNumber); 5711return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.MaxNumber); 5721return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.Min); 5751return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Min); 5772return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Min); 5782return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.MinMagnitude); 5812return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.MinMagnitude); 5833return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.MinMagnitude); 5843return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.MinMagnitudeNumber); 5873return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.MinMagnitudeNumber); 5894return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.MinMagnitudeNumber); 5904return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.MinNumber); 5934return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.MinNumber); 5955return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.MinNumber); 6007TensorPrimitives.Multiply(span, y, ospan); 6021return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Multiply); 6042return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Negate); 6054return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.Norm); 6075return ref TensorPrimitivesHelperSpanInSpanOut(y, destination, TensorPrimitives.OnesComplement); 6096return ref TensorPrimitivesHelperSpanInSpanOut(y, destination, TensorPrimitives.PopCount); 6128return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Pow); 6150return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Pow); 6172return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination, TensorPrimitives.Pow); 6182return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.Product); 6203return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.RadiansToDegrees); 6224return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Reciprocal); 6252TensorPrimitives.RootN(span, n, ospan); 6283TensorPrimitives.RotateLeft(span, rotateAmount, ospan); 6314TensorPrimitives.RotateRight(span, rotateAmount, ospan); 6336return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Round); 6364TensorPrimitives.Round(span, digits, mode, ospan); 6391TensorPrimitives.Round(span, digits, ospan); 6418TensorPrimitives.Round(span, mode, ospan); 6440return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Sigmoid); 6465return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Sin); 6486return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Sinh); 6507return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.SinPi); 6528return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.SoftMax); 6553return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Sqrt); 6615return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Subtract); 6627return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination, TensorPrimitives.Subtract); 6639return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Subtract); 6652return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.Sum); 6665return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.SumOfSquares); 6686return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Tan); 6707return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Tanh); 6728return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.TanPi); 6749return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.TrailingZeroCount); 6770return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.Truncate); 6802return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination, TensorPrimitives.Xor); 6827return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination, TensorPrimitives.Xor);
System\Numerics\Tensors\netcore\TensorHelpers.cs (1)
110if (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>;