193 references to TensorPrimitives
Microsoft.Data.Analysis (23)
Computations\Arithmetic.net8.cs (23)
76
public static void And(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) =>
TensorPrimitives
.BitwiseAnd(x, y, destination);
77
public static void And(ReadOnlySpan<T> x, T y, Span<T> destination) =>
TensorPrimitives
.BitwiseAnd(x, y, destination);
78
public static void And(T x, ReadOnlySpan<T> y, Span<T> destination) =>
TensorPrimitives
.BitwiseAnd(y, x, destination);
79
public static void Or(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) =>
TensorPrimitives
.BitwiseOr(x, y, destination);
80
public static void Or(ReadOnlySpan<T> x, T y, Span<T> destination) =>
TensorPrimitives
.BitwiseOr(x, y, destination);
81
public static void Or(T x, ReadOnlySpan<T> y, Span<T> destination) =>
TensorPrimitives
.BitwiseOr(y, x, destination);
82
public static void Xor(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) =>
TensorPrimitives
.Xor(x, y, destination);
83
public static void Xor(ReadOnlySpan<T> x, T y, Span<T> destination) =>
TensorPrimitives
.Xor(x, y, destination);
84
public static void Xor(T x, ReadOnlySpan<T> y, Span<T> destination) =>
TensorPrimitives
.Xor(y, x, destination);
90
public static void LeftShift(ReadOnlySpan<T> x, int shiftAmount, Span<T> destination) =>
TensorPrimitives
.ShiftLeft(x, shiftAmount, destination);
91
public static void RightShift(ReadOnlySpan<T> x, int shiftAmount, Span<T> destination) =>
TensorPrimitives
.ShiftRightArithmetic(x, shiftAmount, destination);
97
public static void Add(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) =>
TensorPrimitives
.Add(x, y, destination);
98
public static void Add(ReadOnlySpan<T> x, T y, Span<T> destination) =>
TensorPrimitives
.Add(x, y, destination);
99
public static void Add(T x, ReadOnlySpan<T> y, Span<T> destination) =>
TensorPrimitives
.Add(y, x, destination);
100
public static void Subtract(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) =>
TensorPrimitives
.Subtract(x, y, destination);
101
public static void Subtract(ReadOnlySpan<T> x, T y, Span<T> destination) =>
TensorPrimitives
.Subtract(x, y, destination);
102
public static void Subtract(T x, ReadOnlySpan<T> y, Span<T> destination) =>
TensorPrimitives
.Subtract(x, y, destination);
103
public static void Multiply(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) =>
TensorPrimitives
.Multiply(x, y, destination);
104
public static void Multiply(ReadOnlySpan<T> x, T y, Span<T> destination) =>
TensorPrimitives
.Multiply(x, y, destination);
105
public static void Multiply(T x, ReadOnlySpan<T> y, Span<T> destination) =>
TensorPrimitives
.Multiply(y, x, destination);
106
public static void Divide(ReadOnlySpan<T> x, ReadOnlySpan<T> y, Span<T> destination) =>
TensorPrimitives
.Divide(x, y, destination);
107
public static void Divide(ReadOnlySpan<T> x, T y, Span<T> destination) =>
TensorPrimitives
.Divide(x, y, destination);
108
public 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)
151
distances[i, j] =
TensorPrimitives
.HammingBitDistance(embeddings[i].Bits.Span, embeddings[j].Bits.Span);
188
distances[i, j] =
TensorPrimitives
.CosineSimilarity(embeddings[i].Vector.Span, embeddings[j].Vector.Span);
QuantizationEmbeddingGenerator.cs (1)
82
TensorPrimitives
.ConvertToHalf(vector, result);
Microsoft.ML.CpuMath (12)
CpuMathUtils.cs (11)
24
TensorPrimitives
.Add(destination, value, destination);
36
TensorPrimitives
.Multiply(destination, value, destination);
56
TensorPrimitives
.Multiply(source.Slice(0, count), value, destination);
75
TensorPrimitives
.MultiplyAdd(source.Slice(0, count), scale, destination.Slice(0, count), destination);
97
TensorPrimitives
.MultiplyAdd(source.Slice(0, count), scale, destination.Slice(0, count), result.Slice(0, count));
115
TensorPrimitives
.Add(source.Slice(0, count), destination.Slice(0, count), destination.Slice(0, count));
136
TensorPrimitives
.Multiply(left.Slice(0, count), right.Slice(0, count), destination.Slice(0, count));
149
return
TensorPrimitives
.Sum(source);
162
return
TensorPrimitives
.SumOfSquares(source);
175
return
TensorPrimitives
.SumOfMagnitudes(source);
194
return
TensorPrimitives
.Dot(left.Slice(0, count), right.Slice(0, count));
CpuMathUtils.netcoreapp.cs (1)
443
var value =
TensorPrimitives
.Distance(left.Slice(0, count), right.Slice(0, count));
System.Numerics.Tensors (155)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBooleanUnaryOperator.cs (1)
8
using static System.Numerics.Tensors.
TensorPrimitives
;
System\Numerics\Tensors\netcore\TensorExtensions.cs (127)
3764
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Abs);
3789
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Acos);
3814
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Acosh);
3839
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.AcosPi);
3888
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.Add);
3900
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.Add);
3925
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Asin);
3950
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Asinh);
3975
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.AsinPi);
4000
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Atan);
4036
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.Atan2);
4062
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.Atan2);
4088
return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination,
TensorPrimitives
.Atan2);
4124
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.Atan2Pi);
4150
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.Atan2Pi);
4176
return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination,
TensorPrimitives
.Atan2Pi);
4202
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Atanh);
4227
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.AtanPi);
4240
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.Average);
4276
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.BitwiseAnd);
4302
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.BitwiseAnd);
4338
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.BitwiseOr);
4364
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.BitwiseOr);
4389
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Cbrt);
4414
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Ceiling);
4444
return ref TensorPrimitivesHelperSpanInSpanOut(source, destination,
TensorPrimitives
.ConvertChecked);
4474
return ref TensorPrimitivesHelperSpanInSpanOut(source, destination,
TensorPrimitives
.ConvertSaturating);
4504
return ref TensorPrimitivesHelperSpanInSpanOut(source, destination,
TensorPrimitives
.ConvertTruncating);
4554
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, sign, destination,
TensorPrimitives
.CopySign);
4566
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, sign, destination,
TensorPrimitives
.CopySign);
4591
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Cos);
4616
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Cosh);
4690
values[outputOffset++] =
TensorPrimitives
.CosineSimilarity(lspan, rspan);
4743
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.CosPi);
4768
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.DegreesToRadians);
4781
return TensorPrimitivesHelperTwoSpanInTOut(x, y,
TensorPrimitives
.Distance);
4844
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.Divide);
4856
return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination,
TensorPrimitives
.Divide);
4869
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.Divide);
4882
return TensorPrimitivesHelperTwoSpanInTOut(x, y,
TensorPrimitives
.Dot);
4907
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Exp);
4932
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Exp10);
4953
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Exp10M1);
4974
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Exp2);
4995
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Exp2M1);
5016
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.ExpM1);
5037
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Floor);
5075
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.Hypot);
5109
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.Ieee754Remainder);
5131
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.Ieee754Remainder);
5153
return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination,
TensorPrimitives
.Ieee754Remainder);
5174
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.ILogB);
5185
return
TensorPrimitives
.IndexOfMax(span);
5196
return
TensorPrimitives
.IndexOfMaxMagnitude(span);
5207
return
TensorPrimitives
.IndexOfMin(span);
5220
return
TensorPrimitives
.IndexOfMinMagnitude(span);
5245
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.LeadingZeroCount);
5270
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Log);
5300
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.Log);
5322
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.Log);
5347
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Log10);
5372
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Log10P1);
5397
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Log2);
5422
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Log2P1);
5447
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.LogP1);
5457
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.Max);
5487
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.Max);
5508
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.Max);
5518
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.MaxMagnitude);
5548
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.MaxMagnitude);
5569
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.MaxMagnitude);
5579
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.MaxMagnitudeNumber);
5609
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.MaxMagnitudeNumber);
5630
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.MaxMagnitudeNumber);
5640
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.MaxNumber);
5670
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.MaxNumber);
5691
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.MaxNumber);
5701
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.Min);
5731
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.Min);
5752
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.Min);
5762
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.MinMagnitude);
5792
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.MinMagnitude);
5813
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.MinMagnitude);
5823
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.MinMagnitudeNumber);
5853
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.MinMagnitudeNumber);
5874
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.MinMagnitudeNumber);
5884
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.MinNumber);
5914
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.MinNumber);
5935
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.MinNumber);
5987
TensorPrimitives
.Multiply(span, y, ospan);
6001
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.Multiply);
6022
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Negate);
6034
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.Norm);
6055
return ref TensorPrimitivesHelperSpanInSpanOut(y, destination,
TensorPrimitives
.OnesComplement);
6076
return ref TensorPrimitivesHelperSpanInSpanOut(y, destination,
TensorPrimitives
.PopCount);
6108
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.Pow);
6130
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.Pow);
6152
return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination,
TensorPrimitives
.Pow);
6162
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.Product);
6183
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.RadiansToDegrees);
6204
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Reciprocal);
6232
TensorPrimitives
.RootN(span, n, ospan);
6263
TensorPrimitives
.RotateLeft(span, rotateAmount, ospan);
6294
TensorPrimitives
.RotateRight(span, rotateAmount, ospan);
6316
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Round);
6344
TensorPrimitives
.Round(span, digits, mode, ospan);
6371
TensorPrimitives
.Round(span, digits, ospan);
6398
TensorPrimitives
.Round(span, mode, ospan);
6420
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Sigmoid);
6445
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Sin);
6466
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Sinh);
6487
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.SinPi);
6508
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.SoftMax);
6533
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Sqrt);
6546
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.StdDev);
6608
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.Subtract);
6620
return ref TensorPrimitivesHelperTInSpanInSpanOut(x, y, destination,
TensorPrimitives
.Subtract);
6632
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.Subtract);
6645
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.Sum);
6658
return TensorPrimitivesHelperSpanInTOut(x,
TensorPrimitives
.SumOfSquares);
6679
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Tan);
6700
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Tanh);
6721
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.TanPi);
6742
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.TrailingZeroCount);
6763
return ref TensorPrimitivesHelperSpanInSpanOut(x, destination,
TensorPrimitives
.Truncate);
6795
return ref TensorPrimitivesHelperTwoSpanInSpanOut(x, y, destination,
TensorPrimitives
.Xor);
6820
return ref TensorPrimitivesHelperSpanInTInSpanOut(x, y, destination,
TensorPrimitives
.Xor);
System\Numerics\Tensors\netcore\TensorHelpers.cs (1)
110
if (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)
9
global using AbsoluteOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.AbsoluteOperator<float>;
10
global using AddOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.AddOperator<float>;
11
global using AddMultiplyOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.AddMultiplyOperator<float>;
12
global using CoshOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.CoshOperator<float>;
13
global using SubtractSquaredOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.SubtractSquaredOperator<float>;
14
global using DivideOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.DivideOperator<float>;
15
global using MultiplyOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.MultiplyOperator<float>;
16
global using ExpOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.ExpOperator<float>;
17
global using IndexOfMaxOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.IndexOfMaxOperator<float>;
18
global using IndexOfMaxMagnitudeOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.IndexOfMaxMagnitudeOperator<float>;
19
global using IndexOfMinOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.IndexOfMinOperator<float>;
20
global using IndexOfMinMagnitudeOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.IndexOfMinMagnitudeOperator<float>;
21
global using LogOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.LogOperator<float>;
22
global using Log2Operator_Single = System.Numerics.Tensors.
TensorPrimitives
.Log2Operator<float>;
23
global using MaxOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.MaxOperator<float>;
24
global using MaxMagnitudeOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.MaxMagnitudeOperator<float>;
25
global using MinOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.MinOperator<float>;
26
global using MinMagnitudeOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.MinMagnitudeOperator<float>;
27
global using MultiplyAddOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.MultiplyAddOperator<float>;
28
global using NegateOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.NegateOperator<float>;
29
global using IdentityOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.IdentityOperator<float>;
30
global using SubtractOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.SubtractOperator<float>;
31
global using SigmoidOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.SigmoidOperator<float>;
32
global using SinhOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.SinhOperator<float>;
33
global using SquaredOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.SquaredOperator<float>;
34
global using TanhOperator_Single = System.Numerics.Tensors.
TensorPrimitives
.TanhOperator<float>;