170 references to TensorPrimitives
Microsoft.Extensions.AI.Integration.Tests (3)
EmbeddingGeneratorIntegrationTests.cs (2)
154
distances[i, j] =
TensorPrimitives
.HammingBitDistance<byte>(ToArray(embeddings[i].Vector), ToArray(embeddings[j].Vector));
198
distances[i, j] =
TensorPrimitives
.CosineSimilarity(embeddings[i].Vector.Span, embeddings[j].Vector.Span);
QuantizationEmbeddingGenerator.cs (1)
83
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\ReadOnlyTensorDimensionSpan_1.cs (1)
31
_length =
TensorPrimitives
.Product(tensor.Lengths[..dimension]);
System\Numerics\Tensors\netcore\Tensor.cs (8)
1350
nint tempLinear =
TensorPrimitives
.Product(newLengths);
1423
nint tempLinear =
TensorPrimitives
.Product(newLengths);
1500
nint tempLinear =
TensorPrimitives
.Product(newLengths);
1549
nint newSize =
TensorPrimitives
.Product(lengths);
3532
return
TensorPrimitives
.IndexOfMax(span);
3544
return
TensorPrimitives
.IndexOfMaxMagnitude(span);
3555
return
TensorPrimitives
.IndexOfMin(span);
3568
return
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)
507
TensorPrimitives
.Abs(x, destination);
522
TensorPrimitives
.Acos(x, destination);
537
TensorPrimitives
.Acosh(x, destination);
552
TensorPrimitives
.AcosPi(x, destination);
568
TensorPrimitives
.Add(x, y, destination);
578
TensorPrimitives
.Add(x, y, destination);
593
TensorPrimitives
.Asin(x, destination);
608
TensorPrimitives
.Asinh(x, destination);
623
TensorPrimitives
.AsinPi(x, destination);
638
TensorPrimitives
.Atan(x, destination);
667
TensorPrimitives
.Atan2(x, y, destination);
696
TensorPrimitives
.Atan2Pi(x, y, destination);
711
TensorPrimitives
.Atanh(x, destination);
726
TensorPrimitives
.AtanPi(x, destination);
742
TensorPrimitives
.BitwiseAnd(x, y, destination);
752
TensorPrimitives
.BitwiseAnd(x, y, destination);
768
TensorPrimitives
.BitwiseOr(x, y, destination);
778
TensorPrimitives
.BitwiseOr(x, y, destination);
793
TensorPrimitives
.Cbrt(x, destination);
808
TensorPrimitives
.Ceiling(x, destination);
824
TensorPrimitives
.ConvertChecked(x, destination);
840
TensorPrimitives
.ConvertSaturating(x, destination);
856
TensorPrimitives
.ConvertTruncating(x, destination);
872
TensorPrimitives
.CopySign(x, y, destination);
882
TensorPrimitives
.CopySign(x, y, destination);
897
TensorPrimitives
.Cos(x, destination);
912
TensorPrimitives
.Cosh(x, destination);
931
destination[0].Item1 +=
TensorPrimitives
.Dot(x, y);
932
destination[0].Item2 +=
TensorPrimitives
.SumOfSquares(x);
933
destination[0].Item3 +=
TensorPrimitives
.SumOfSquares(y);
948
TensorPrimitives
.CosPi(x, destination);
964
TensorPrimitives
.Decrement(x, destination);
979
TensorPrimitives
.DegreesToRadians(x, destination);
996
TensorPrimitives
.Divide(x, y, destination);
1006
TensorPrimitives
.Divide(x, y, destination);
1015
TensorPrimitives
.Divide(x, y, destination);
1030
destination[0] +=
TensorPrimitives
.Dot(x, y);
1045
TensorPrimitives
.Exp(x, destination);
1060
TensorPrimitives
.Exp10(x, destination);
1075
TensorPrimitives
.Exp10M1(x, destination);
1090
TensorPrimitives
.Exp2(x, destination);
1105
TensorPrimitives
.Exp2M1(x, destination);
1120
TensorPrimitives
.ExpM1(x, destination);
1135
TensorPrimitives
.Floor(x, destination);
1150
TensorPrimitives
.Hypot(x, y, destination);
1167
TensorPrimitives
.Ieee754Remainder(x, y, destination);
1177
TensorPrimitives
.Ieee754Remainder(x, y, destination);
1186
TensorPrimitives
.Ieee754Remainder(x, y, destination);
1201
TensorPrimitives
.ILogB(x, destination);
1217
TensorPrimitives
.Increment(x, destination);
1232
TensorPrimitives
.LeadingZeroCount(x, destination);
1249
TensorPrimitives
.Log(x, destination);
1259
TensorPrimitives
.Log(x, y, destination);
1269
TensorPrimitives
.Log(x, y, destination);
1284
TensorPrimitives
.Log10(x, destination);
1299
TensorPrimitives
.Log10P1(x, destination);
1314
TensorPrimitives
.Log2(x, destination);
1329
TensorPrimitives
.Log2P1(x, destination);
1344
TensorPrimitives
.LogP1(x, destination);
1361
destination =
TensorPrimitives
.Max(x);
1371
TensorPrimitives
.Max(x, y, destination);
1381
TensorPrimitives
.Max(x, y, destination);
1398
destination =
TensorPrimitives
.MaxMagnitude(x);
1408
TensorPrimitives
.MaxMagnitude(x, y, destination);
1418
TensorPrimitives
.MaxMagnitude(x, y, destination);
1435
destination =
TensorPrimitives
.MaxMagnitudeNumber(x);
1445
TensorPrimitives
.MaxMagnitudeNumber(x, y, destination);
1455
TensorPrimitives
.MaxMagnitudeNumber(x, y, destination);
1472
destination =
TensorPrimitives
.MaxNumber(x);
1482
TensorPrimitives
.MaxNumber(x, y, destination);
1492
TensorPrimitives
.MaxNumber(x, y, destination);
1509
destination =
TensorPrimitives
.Min(x);
1519
TensorPrimitives
.Min(x, y, destination);
1529
TensorPrimitives
.Min(x, y, destination);
1546
destination =
TensorPrimitives
.MinMagnitude(x);
1556
TensorPrimitives
.MinMagnitude(x, y, destination);
1566
TensorPrimitives
.MinMagnitude(x, y, destination);
1583
destination =
TensorPrimitives
.MinMagnitudeNumber(x);
1593
TensorPrimitives
.MinMagnitudeNumber(x, y, destination);
1603
TensorPrimitives
.MinMagnitudeNumber(x, y, destination);
1620
destination =
TensorPrimitives
.MinNumber(x);
1630
TensorPrimitives
.MinNumber(x, y, destination);
1640
TensorPrimitives
.MinNumber(x, y, destination);
1656
TensorPrimitives
.Multiply(x, y, destination);
1666
TensorPrimitives
.Multiply(x, y, destination);
1681
TensorPrimitives
.Negate(x, destination);
1696
TensorPrimitives
.OnesComplement(x, destination);
1711
TensorPrimitives
.PopCount(x, destination);
1728
TensorPrimitives
.Pow(x, y, destination);
1738
TensorPrimitives
.Pow(x, y, destination);
1748
TensorPrimitives
.Pow(x, y, destination);
1763
destination =
TensorPrimitives
.Product(x);
1778
TensorPrimitives
.RadiansToDegrees(x, destination);
1793
TensorPrimitives
.Reciprocal(x, destination);
1808
TensorPrimitives
.RootN(x, y, destination);
1822
TensorPrimitives
.RotateLeft(x, y, destination);
1836
TensorPrimitives
.RotateRight(x, y, destination);
1852
TensorPrimitives
.Round(x, destination);
1862
TensorPrimitives
.Round(x, y.Item1, y.Item2, destination);
1877
TensorPrimitives
.ShiftLeft(x, shiftAmount, destination);
1892
TensorPrimitives
.ShiftRightArithmetic(x, shiftAmount, destination);
1907
TensorPrimitives
.ShiftRightLogical(x, shiftAmount, destination);
1922
TensorPrimitives
.Sigmoid(x, destination);
1937
TensorPrimitives
.Sin(x, destination);
1952
TensorPrimitives
.Sinh(x, destination);
1967
TensorPrimitives
.SinPi(x, destination);
2019
TensorPrimitives
.Sqrt(x, destination);
2036
TensorPrimitives
.Subtract(x, y, destination);
2046
TensorPrimitives
.Subtract(x, y, destination);
2056
TensorPrimitives
.Subtract(x, y, destination);
2071
destination +=
TensorPrimitives
.Sum(x);
2116
destination +=
TensorPrimitives
.SumOfSquares(x);
2131
TensorPrimitives
.Tan(x, destination);
2146
TensorPrimitives
.Tanh(x, destination);
2161
TensorPrimitives
.TanPi(x, destination);
2176
TensorPrimitives
.TrailingZeroCount(x, destination);
2191
TensorPrimitives
.Truncate(x, destination);
2207
TensorPrimitives
.Xor(x, y, destination);
2217
TensorPrimitives
.Xor(x, y, destination);
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>;