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