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