187 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)
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 (149)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBooleanUnaryOperator.cs (1)
8
using static System.Numerics.Tensors.
TensorPrimitives
;
System\Numerics\Tensors\netcore\Tensor.cs (8)
1466
nint tempLinear =
TensorPrimitives
.Product(newLengths);
1539
nint tempLinear =
TensorPrimitives
.Product(newLengths);
1616
nint tempLinear =
TensorPrimitives
.Product(newLengths);
1665
nint newSize =
TensorPrimitives
.Product(lengths);
3929
return
TensorPrimitives
.IndexOfMax(span);
3941
return
TensorPrimitives
.IndexOfMaxMagnitude(span);
3952
return
TensorPrimitives
.IndexOfMin(span);
3965
return
TensorPrimitives
.IndexOfMinMagnitude(span);
System\Numerics\Tensors\netcore\TensorOperation.cs (114)
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);
963
TensorPrimitives
.DegreesToRadians(x, destination);
980
TensorPrimitives
.Divide(x, y, destination);
990
TensorPrimitives
.Divide(x, y, destination);
999
TensorPrimitives
.Divide(x, y, destination);
1014
destination[0] +=
TensorPrimitives
.Dot(x, y);
1029
TensorPrimitives
.Exp(x, destination);
1044
TensorPrimitives
.Exp10(x, destination);
1059
TensorPrimitives
.Exp10M1(x, destination);
1074
TensorPrimitives
.Exp2(x, destination);
1089
TensorPrimitives
.Exp2M1(x, destination);
1104
TensorPrimitives
.ExpM1(x, destination);
1119
TensorPrimitives
.Floor(x, destination);
1134
TensorPrimitives
.Hypot(x, y, destination);
1151
TensorPrimitives
.Ieee754Remainder(x, y, destination);
1161
TensorPrimitives
.Ieee754Remainder(x, y, destination);
1170
TensorPrimitives
.Ieee754Remainder(x, y, destination);
1185
TensorPrimitives
.ILogB(x, destination);
1200
TensorPrimitives
.LeadingZeroCount(x, destination);
1217
TensorPrimitives
.Log(x, destination);
1227
TensorPrimitives
.Log(x, y, destination);
1237
TensorPrimitives
.Log(x, y, destination);
1252
TensorPrimitives
.Log10(x, destination);
1267
TensorPrimitives
.Log10P1(x, destination);
1282
TensorPrimitives
.Log2(x, destination);
1297
TensorPrimitives
.Log2P1(x, destination);
1312
TensorPrimitives
.LogP1(x, destination);
1329
destination =
TensorPrimitives
.Max(x);
1339
TensorPrimitives
.Max(x, y, destination);
1349
TensorPrimitives
.Max(x, y, destination);
1366
destination =
TensorPrimitives
.MaxMagnitude(x);
1376
TensorPrimitives
.MaxMagnitude(x, y, destination);
1386
TensorPrimitives
.MaxMagnitude(x, y, destination);
1403
destination =
TensorPrimitives
.MaxMagnitudeNumber(x);
1413
TensorPrimitives
.MaxMagnitudeNumber(x, y, destination);
1423
TensorPrimitives
.MaxMagnitudeNumber(x, y, destination);
1440
destination =
TensorPrimitives
.MaxNumber(x);
1450
TensorPrimitives
.MaxNumber(x, y, destination);
1460
TensorPrimitives
.MaxNumber(x, y, destination);
1477
destination =
TensorPrimitives
.Min(x);
1487
TensorPrimitives
.Min(x, y, destination);
1497
TensorPrimitives
.Min(x, y, destination);
1514
destination =
TensorPrimitives
.MinMagnitude(x);
1524
TensorPrimitives
.MinMagnitude(x, y, destination);
1534
TensorPrimitives
.MinMagnitude(x, y, destination);
1551
destination =
TensorPrimitives
.MinMagnitudeNumber(x);
1561
TensorPrimitives
.MinMagnitudeNumber(x, y, destination);
1571
TensorPrimitives
.MinMagnitudeNumber(x, y, destination);
1588
destination =
TensorPrimitives
.MinNumber(x);
1598
TensorPrimitives
.MinNumber(x, y, destination);
1608
TensorPrimitives
.MinNumber(x, y, destination);
1624
TensorPrimitives
.Multiply(x, y, destination);
1634
TensorPrimitives
.Multiply(x, y, destination);
1649
TensorPrimitives
.Negate(x, destination);
1664
TensorPrimitives
.OnesComplement(x, destination);
1679
TensorPrimitives
.PopCount(x, destination);
1696
TensorPrimitives
.Pow(x, y, destination);
1706
TensorPrimitives
.Pow(x, y, destination);
1716
TensorPrimitives
.Pow(x, y, destination);
1731
destination =
TensorPrimitives
.Product(x);
1746
TensorPrimitives
.RadiansToDegrees(x, destination);
1761
TensorPrimitives
.Reciprocal(x, destination);
1776
TensorPrimitives
.RootN(x, y, destination);
1790
TensorPrimitives
.RotateLeft(x, y, destination);
1804
TensorPrimitives
.RotateRight(x, y, destination);
1820
TensorPrimitives
.Round(x, destination);
1830
TensorPrimitives
.Round(x, y.Item1, y.Item2, destination);
1845
TensorPrimitives
.Sigmoid(x, destination);
1860
TensorPrimitives
.Sin(x, destination);
1875
TensorPrimitives
.Sinh(x, destination);
1890
TensorPrimitives
.SinPi(x, destination);
1942
TensorPrimitives
.Sqrt(x, destination);
1959
TensorPrimitives
.Subtract(x, y, destination);
1969
TensorPrimitives
.Subtract(x, y, destination);
1979
TensorPrimitives
.Subtract(x, y, destination);
1994
destination +=
TensorPrimitives
.Sum(x);
2039
destination +=
TensorPrimitives
.SumOfSquares(x);
2054
TensorPrimitives
.Tan(x, destination);
2069
TensorPrimitives
.Tanh(x, destination);
2084
TensorPrimitives
.TanPi(x, destination);
2099
TensorPrimitives
.TrailingZeroCount(x, destination);
2114
TensorPrimitives
.Truncate(x, destination);
2130
TensorPrimitives
.Xor(x, y, destination);
2140
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>;