14 instantiations of Tensor
System.Numerics.Tensors (14)
System\Numerics\Tensors\netcore\Tensor.cs (6)
99
return new
Tensor
<T>(values, lengths.ToArray(), pinned);
112
return new
Tensor
<T>(values, lengths.ToArray(), strides.ToArray(), pinned);
124
return new
Tensor
<T>(values, lengths.ToArray(), pinned);
137
return new
Tensor
<T>(values, lengths.ToArray(), strides.ToArray(), pinned);
144
public static Tensor<T> Empty { get; } =
new
();
467
var outTensor = new
Tensor
<T>(values, s.Lengths.ToArray(), _isPinned);
System\Numerics\Tensors\netcore\TensorExtensions.cs (8)
236
return new
Tensor
<T>(input._values, lengths, false);
262
Tensor<T> output = new
Tensor
<T>(input._values, lengths, strides);
2678
outTensor = new
Tensor
<T>(values, lengths, Array.Empty<nint>(), tensor._isPinned);
2789
return new
Tensor
<T>(tensor._values, arrLengths, strides);
2944
Tensor<T> output = new
Tensor
<T>(values, lengths, false);
3235
outputs[i] = new
Tensor
<T>(values, newShape);
3317
return new
Tensor
<T>(tensor._values, lengths, strides);
3678
return new
Tensor
<T>(tensor._values, lengths, strides);
533 references to Tensor
System.Numerics.Tensors (533)
System\Numerics\Tensors\netcore\Tensor.cs (63)
26
: ITensor<
Tensor
<T>, T>
91
/// Creates a <see cref="
Tensor
{T}"/> and initializes it with the default value of T. If <paramref name="pinned"/> is true, the memory will be pinned.
95
static
Tensor
<T> ITensor<
Tensor
<T>, T>.Create(ReadOnlySpan<nint> lengths, bool pinned)
103
/// Creates a <see cref="
Tensor
{T}"/> and initializes it with the default value of T. If <paramref name="pinned"/> is true, the memory will be pinned.
108
static
Tensor
<T> ITensor<
Tensor
<T>, T>.Create(ReadOnlySpan<nint> lengths, ReadOnlySpan<nint> strides, bool pinned)
116
/// Creates a <see cref="
Tensor
{T}"/> and does not initialize it. If <paramref name="pinned"/> is true, the memory will be pinned.
120
static
Tensor
<T> ITensor<
Tensor
<T>, T>.CreateUninitialized(ReadOnlySpan<nint> lengths, bool pinned)
128
/// Creates a <see cref="
Tensor
{T}"/> and does not initialize it. If <paramref name="pinned"/> is true, the memory will be pinned.
133
static
Tensor
<T> ITensor<
Tensor
<T>, T>.CreateUninitialized(ReadOnlySpan<nint> lengths, ReadOnlySpan<nint> strides, bool pinned)
144
public static
Tensor
<T> Empty { get; } = new();
147
/// Gets a value indicating whether this <see cref="
Tensor
{T}"/> is empty.
153
/// Gets a value indicating whether the backing memory of the <see cref="
Tensor
{T}"/> is pinned."/>
159
/// Gets a value indicating the rank, or number of dimensions, of this <see cref="
Tensor
{T}"/>.
165
/// The number of items in the <see cref="
Tensor
{T}"/>.
171
/// Gets the length of each dimension in this <see cref="
Tensor
{T}"/>.
177
/// Gets the length of each dimension in this <see cref="
Tensor
{T}"/>.
180
ReadOnlySpan<nint> IReadOnlyTensor<
Tensor
<T>, T>.Lengths => _lengths;
184
/// Gets the strides of each dimension in this <see cref="
Tensor
{T}"/>.
190
/// Gets the strides of each dimension in this <see cref="
Tensor
{T}"/>.
193
ReadOnlySpan<nint> IReadOnlyTensor<
Tensor
<T>, T>.Strides => _strides;
195
bool ITensor<
Tensor
<T>, T>.IsReadOnly => false;
225
public
Tensor
<T> this[params ReadOnlySpan<NRange> ranges]
261
T ITensor<
Tensor
<T>, T>.this[params ReadOnlySpan<nint> indexes]
281
T ITensor<
Tensor
<T>, T>.this[params ReadOnlySpan<NIndex> indexes]
301
T IReadOnlyTensor<
Tensor
<T>, T>.this[params ReadOnlySpan<nint> indexes] => AsReadOnlyTensorSpan()[indexes];
311
T IReadOnlyTensor<
Tensor
<T>, T>.this[params ReadOnlySpan<NIndex> indexes] => AsReadOnlyTensorSpan()[indexes];
321
Tensor
<T> IReadOnlyTensor<
Tensor
<T>, T>.this[params ReadOnlySpan<NRange> ranges]
339
public
Tensor
<T> this[
Tensor
<bool> filter]
372
/// Defines an implicit conversion of an array to a <see cref="
Tensor
{T}"/>.
374
public static implicit operator
Tensor
<T>(T[] array) => new Tensor<T>(array, [array.Length]);
377
/// Defines an implicit conversion of a <see cref="
Tensor
{T}"/> to a <see cref="TensorSpan{T}"/>.
379
public static implicit operator TensorSpan<T>(
Tensor
<T> value) => new TensorSpan<T>(ref MemoryMarshal.GetArrayDataReference(value._values), value._lengths, value._strides, value._flattenedLength);
382
/// Defines an implicit conversion of a <see cref="
Tensor
{T}"/> to a <see cref="TensorSpan{T}"/>.
384
public static implicit operator ReadOnlyTensorSpan<T>(
Tensor
<T> value) => new ReadOnlyTensorSpan<T>(ref MemoryMarshal.GetArrayDataReference(value._values), value._lengths, value._strides, value.FlattenedLength);
387
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="TensorSpan{T}"/> pointing to the same backing memory."/>
393
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="TensorSpan{T}"/> pointing to the same backing memory based on the provided ranges."/>
400
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="TensorSpan{T}"/> pointing to the same backing memory based on the provided start locations."/>
407
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="TensorSpan{T}"/> pointing to the same backing memory based on the provided start indexes."/>
414
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="ReadOnlyTensorSpan{T}"/> pointing to the same backing memory."/>
420
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="ReadOnlyTensorSpan{T}"/> pointing to the same backing memory based on the provided ranges."/>
427
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="ReadOnlyTensorSpan{T}"/> pointing to the same backing memory based on the provided start locations."/>
434
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="ReadOnlyTensorSpan{T}"/> pointing to the same backing memory based on the provided start indexes."/>
452
ref readonly T IReadOnlyTensor<
Tensor
<T>, T>.GetPinnableReference() => ref AsReadOnlyTensorSpan().GetPinnableReference();
458
/// <returns><see cref="
Tensor
{T}"/> as a copy of the provided ranges.</returns>
460
public
Tensor
<T> Slice(params ReadOnlySpan<NRange> start)
467
var
outTensor = new Tensor<T>(values, s.Lengths.ToArray(), _isPinned);
476
/// <returns><see cref="
Tensor
{T}"/> as a copy of the provided ranges.</returns>
478
public
Tensor
<T> Slice(params ReadOnlySpan<nint> start)
492
/// <returns><see cref="
Tensor
{T}"/> as a copy of the provided ranges.</returns>
494
public
Tensor
<T> Slice(params ReadOnlySpan<NIndex> startIndex)
552
/// Gets an <see cref="IEnumerator{T}"/> for the <see cref="
Tensor
{T}"/>.
559
/// Gets an <see cref="IEnumerator{T}"/> for the <see cref="
Tensor
{T}"/>.
565
/// Gets an <see cref="IEnumerator"/> for the <see cref="
Tensor
{T}"/>."/>
573
private readonly
Tensor
<T> _tensor;
583
internal Enumerator(
Tensor
<T> tensor)
630
/// Gets the hash code for the <see cref="
Tensor
{T}"/>.
671
/// <returns>A <see cref="string"/> representation of the <see cref="
Tensor
{T}"/></returns>
System\Numerics\Tensors\netcore\Tensor.Factory.cs (24)
21
/// Creates a <see cref="
Tensor
{T}"/> and initializes it with the default value of T. If <paramref name="pinned"/> is true, the memory will be pinned.
25
public static
Tensor
<T> Create<T>(scoped ReadOnlySpan<nint> lengths, bool pinned = false)
33
/// Creates a <see cref="
Tensor
{T}"/> and initializes it with the default value of T. If <paramref name="pinned"/> is true, the memory will be pinned.
38
public static
Tensor
<T> Create<T>(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned = false)
46
/// Creates a <see cref="
Tensor
{T}"/> from the provided <paramref name="values"/>. If the product of the
53
public static
Tensor
<T> Create<T>(T[] values, scoped ReadOnlySpan<nint> lengths, bool pinned = false)
57
/// Creates a <see cref="
Tensor
{T}"/> from the provided <paramref name="values"/>. If the product of the
65
public static
Tensor
<T> Create<T>(T[] values, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned = false)
71
/// Creates a <see cref="
Tensor
{T}"/> and initializes it with the data from <paramref name="values"/>.
77
public static
Tensor
<T> Create<T>(IEnumerable<T> values, scoped ReadOnlySpan<nint> lengths, bool pinned = false)
84
/// Creates a <see cref="
Tensor
{T}"/> and initializes it with the data from <paramref name="values"/>.
90
public static
Tensor
<T> Create<T>(IEnumerable<T> values, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned = false)
98
/// Creates a <see cref="
Tensor
{T}"/> and initializes it with random data in a gaussian normal distribution.
101
public static
Tensor
<T> CreateAndFillGaussianNormalDistribution<T>(params scoped ReadOnlySpan<nint> lengths)
108
/// Creates a <see cref="
Tensor
{T}"/> and initializes it with random data in a gaussian normal distribution.
112
public static
Tensor
<T> CreateAndFillGaussianNormalDistribution<T>(Random random, params scoped ReadOnlySpan<nint> lengths)
135
/// Creates a <see cref="
Tensor
{T}"/> and initializes it with random data uniformly distributed.
138
public static
Tensor
<T> CreateAndFillUniformDistribution<T>(params scoped ReadOnlySpan<nint> lengths)
145
/// Creates a <see cref="
Tensor
{T}"/> and initializes it with random data uniformly distributed.
149
public static
Tensor
<T> CreateAndFillUniformDistribution<T>(Random random, params scoped ReadOnlySpan<nint> lengths)
161
/// Creates a <see cref="
Tensor
{T}"/> and does not initialize it. If <paramref name="pinned"/> is true, the memory will be pinned.
165
public static
Tensor
<T> CreateUninitialized<T>(scoped ReadOnlySpan<nint> lengths, bool pinned = false)
169
/// Creates a <see cref="
Tensor
{T}"/> and does not initialize it. If <paramref name="pinned"/> is true, the memory will be pinned.
174
public static
Tensor
<T> CreateUninitialized<T>(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned = false)
System\Numerics\Tensors\netcore\TensorExtensions.cs (442)
65
/// Broadcast the data from <paramref name="source"/> to the smallest broadcastable shape compatible with <paramref name="lengthsSource"/>. Creates a new <see cref="
Tensor
{T}"/> and allocates new memory.
67
/// <param name="source">Input <see cref="
Tensor
{T}"/>.</param>
68
/// <param name="lengthsSource">Other <see cref="
Tensor
{T}"/> to make shapes broadcastable.</param>
69
public static
Tensor
<T> Broadcast<T>(scoped in ReadOnlyTensorSpan<T> source, scoped in ReadOnlyTensorSpan<T> lengthsSource)
75
/// Broadcast the data from <paramref name="source"/> to the new shape <paramref name="lengths"/>. Creates a new <see cref="
Tensor
{T}"/> and allocates new memory.
78
/// <param name="source">Input <see cref="
Tensor
{T}"/>.</param>
81
public static
Tensor
<T> Broadcast<T>(scoped in ReadOnlyTensorSpan<T> source, scoped ReadOnlySpan<nint> lengths)
86
Tensor
<T> output = Tensor.CreateUninitialized<T>(intermediate.Lengths);
98
public static void BroadcastTo<T>(this
Tensor
<T> source, in TensorSpan<T> destination)
140
/// Broadcast the data from <paramref name="input"/> to the new shape <paramref name="shape"/>. Creates a new <see cref="
Tensor
{T}"/>
183
/// Broadcast the data from <paramref name="input"/> to the new shape <paramref name="shape"/>. Creates a new <see cref="
Tensor
{T}"/>
226
/// Broadcast the data from <paramref name="input"/> to the new shape <paramref name="lengths"/>. Creates a new <see cref="
Tensor
{T}"/>
230
/// <param name="input">Input <see cref="
Tensor
{T}"/>.</param>
233
internal static
Tensor
<T> LazyBroadcast<T>(
Tensor
<T> input, ReadOnlySpan<nint> lengths)
262
Tensor
<T> output = new Tensor<T>(input._values, lengths, strides);
273
public static
Tensor
<T> Concatenate<T>(params scoped ReadOnlySpan<
Tensor
<T>> tensors)
283
public static
Tensor
<T> ConcatenateOnDimension<T>(int dimension, params scoped ReadOnlySpan<
Tensor
<T>> tensors)
317
Tensor
<T> tensor;
339
public static ref readonly TensorSpan<T> Concatenate<T>(scoped ReadOnlySpan<
Tensor
<T>> tensors, in TensorSpan<T> destination)
351
public static ref readonly TensorSpan<T> ConcatenateOnDimension<T>(int dimension, scoped ReadOnlySpan<
Tensor
<T>> tensors, in TensorSpan<T> destination)
454
public static
Tensor
<bool> Equals<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
457
Tensor
<bool> result;
535
public static
Tensor
<bool> Equals<T>(in ReadOnlyTensorSpan<T> x, T y)
538
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
758
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
784
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
815
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
820
/// <returns>A <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> and
822
public static
Tensor
<bool> GreaterThan<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
825
Tensor
<bool> result;
843
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
849
/// <returns>A <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> and
901
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
906
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
908
public static
Tensor
<bool> GreaterThan<T>(in ReadOnlyTensorSpan<T> x, T y)
911
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
918
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
924
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
961
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
966
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
968
public static
Tensor
<bool> GreaterThan<T>(T x, in ReadOnlyTensorSpan<T> y)
971
Tensor
<bool> result = Tensor.Create<bool>(y.Lengths, false);
978
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
984
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1024
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1029
/// <returns>A <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> and
1031
public static
Tensor
<bool> GreaterThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
1034
Tensor
<bool> result;
1052
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1058
/// <returns>A <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> and
1110
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1115
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1117
public static
Tensor
<bool> GreaterThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, T y)
1120
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
1127
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1133
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1170
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1175
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1177
public static
Tensor
<bool> GreaterThanOrEqual<T>(T x, in ReadOnlyTensorSpan<T> y)
1180
Tensor
<bool> result = Tensor.Create<bool>(y.Lengths, false);
1187
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1193
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1727
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1732
/// <returns>A <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> and
1734
public static
Tensor
<bool> LessThan<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
1737
Tensor
<bool> result;
1755
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1761
/// <returns>A <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> and
1812
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
1813
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1816
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
1818
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1820
public static
Tensor
<bool> LessThan<T>(in ReadOnlyTensorSpan<T> x, T y)
1823
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
1829
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
1830
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1833
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
1836
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1872
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
1873
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1876
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
1878
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1880
public static
Tensor
<bool> LessThan<T>(T x, in ReadOnlyTensorSpan<T> y)
1883
Tensor
<bool> result = Tensor.Create<bool>(y.Lengths, false);
1889
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
1890
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1893
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
1896
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1936
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1941
/// <returns>A <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> and
1943
public static
Tensor
<bool> LessThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
1946
Tensor
<bool> result;
1964
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1970
/// <returns>A <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> and
2021
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
2022
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2025
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
2027
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2029
public static
Tensor
<bool> LessThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, T y)
2032
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
2038
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
2039
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2042
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
2045
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2081
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
2082
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2085
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
2087
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2089
public static
Tensor
<bool> LessThanOrEqual<T>(T x, in ReadOnlyTensorSpan<T> y)
2092
Tensor
<bool> result = Tensor.Create<bool>(y.Lengths, false);
2098
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
2099
/// It returns a <see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2102
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
2105
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2639
/// If <paramref name="tensor"/> is a 1D tensor, it will return <paramref name="tensor"/>. Otherwise it creates a new <see cref="
Tensor
{T}"/>
2642
/// <param name="tensor">Input <see cref="
Tensor
{T}"/></param>
2644
public static
Tensor
<T> PermuteDimensions<T>(this
Tensor
<T> tensor, params ReadOnlySpan<int> dimensions)
2654
Tensor
<T> outTensor;
2729
/// <param name="tensor"><see cref="
Tensor
{T}"/> you want to reshape.</param>
2731
public static
Tensor
<T> Reshape<T>(this
Tensor
<T> tensor, params ReadOnlySpan<nint> lengths)
2935
/// Creates a new <see cref="
Tensor
{T}"/>, allocates new memory, and copies the data from <paramref name="tensor"/>. If the final shape is smaller all data after
2938
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
2940
public static
Tensor
<T> Resize<T>(
Tensor
<T> tensor, ReadOnlySpan<nint> lengths)
2944
Tensor
<T> output = new Tensor<T>(values, lengths, false);
2959
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
2961
public static void ResizeTo<T>(scoped in
Tensor
<T> tensor, in TensorSpan<T> destination)
3008
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3009
public static
Tensor
<T> Reverse<T>(in ReadOnlyTensorSpan<T> tensor)
3011
Tensor
<T> output = Tensor.Create<T>(tensor.Lengths);
3021
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3023
public static
Tensor
<T> ReverseDimension<T>(in ReadOnlyTensorSpan<T> tensor, int dimension)
3025
Tensor
<T> output = Tensor.Create<T>(tensor.Lengths);
3145
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3148
public static
Tensor
<T> SetSlice<T>(this
Tensor
<T> tensor, in ReadOnlyTensorSpan<T> values, params ReadOnlySpan<NRange> ranges)
3158
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3187
/// Split a <see cref="
Tensor
{T}"/> into <paramref name="splitCount"/> along the given <paramref name="dimension"/>. If the tensor cannot be split
3190
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3193
public static
Tensor
<T>[] Split<T>(scoped in ReadOnlyTensorSpan<T> tensor, int splitCount, nint dimension)
3198
Tensor
<T>[] outputs = new
Tensor
<T>[splitCount];
3267
/// <param name="tensor">The <see cref="
Tensor
{T}"/> to remove all dimensions of length 1.</param>
3268
public static
Tensor
<T> Squeeze<T>(this
Tensor
<T> tensor)
3277
/// <param name="tensor">The <see cref="
Tensor
{T}"/> to remove dimension of length 1.</param>
3279
public static
Tensor
<T> SqueezeDimension<T>(this
Tensor
<T> tensor, int dimension)
3435
/// Join multiple <see cref="
Tensor
{T}"/> along a new dimension that is added at position 0. All tensors must have the same shape.
3437
/// <param name="tensors">Input <see cref="
Tensor
{T}"/>.</param>
3438
public static
Tensor
<T> Stack<T>(params ReadOnlySpan<
Tensor
<T>> tensors)
3444
/// Join multiple <see cref="
Tensor
{T}"/> along a new dimension. The axis parameter specifies the index of the new dimension. All tensors must have the same shape.
3446
/// <param name="tensors">Input <see cref="
Tensor
{T}"/>.</param>
3448
public static
Tensor
<T> StackAlongDimension<T>(int dimension, params ReadOnlySpan<
Tensor
<T>> tensors)
3462
Tensor
<T>[] outputs = new
Tensor
<T>[tensors.Length];
3471
/// Join multiple <see cref="
Tensor
{T}"/> along a new dimension that is added at position 0. All tensors must have the same shape.
3473
/// <param name="tensors">Input <see cref="
Tensor
{T}"/>.</param>
3475
public static ref readonly TensorSpan<T> Stack<T>(scoped in ReadOnlySpan<
Tensor
<T>> tensors, in TensorSpan<T> destination)
3481
/// Join multiple <see cref="
Tensor
{T}"/> along a new dimension. The axis parameter specifies the index of the new dimension. All tensors must have the same shape.
3483
/// <param name="tensors">Input <see cref="
Tensor
{T}"/>.</param>
3486
public static ref readonly TensorSpan<T> StackAlongDimension<T>(scoped ReadOnlySpan<
Tensor
<T>> tensors, in TensorSpan<T> destination, int dimension)
3500
Tensor
<T>[] outputs = new
Tensor
<T>[tensors.Length];
3587
/// Creates a <see cref="string"/> representation of the <see cref="
Tensor
{T}"/>."/>
3592
public static string ToString<T>(this
Tensor
<T> tensor, params ReadOnlySpan<nint> maximumLengths) => ((ReadOnlyTensorSpan<T>)tensor).ToString(maximumLengths);
3600
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3601
public static
Tensor
<T> Transpose<T>(
Tensor
<T> tensor)
3618
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3620
public static bool TryBroadcastTo<T>(this
Tensor
<T> tensor, in TensorSpan<T> destination)
3660
/// <param name="tensor">The <see cref="
Tensor
{T}"/> to add a dimension of length 1.</param>
3662
public static
Tensor
<T> Unsqueeze<T>(this
Tensor
<T> tensor, int dimension)
3733
/// Takes the absolute value of each element of the <see cref="
Tensor
{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3736
public static
Tensor
<T> Abs<T>(in ReadOnlyTensorSpan<T> x)
3739
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3758
/// Takes the inverse cosine of each element of the <see cref="
Tensor
{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3761
public static
Tensor
<T> Acos<T>(in ReadOnlyTensorSpan<T> x)
3764
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3770
/// Takes the inverse cosine of each element of the <see cref="
Tensor
{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3783
/// Takes the inverse hyperbolic cosine of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3786
public static
Tensor
<T> Acosh<T>(in ReadOnlyTensorSpan<T> x)
3789
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3808
/// Takes the inverse hyperbolic cosine divided by pi of each element of the <see cref="
Tensor
{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3811
public static
Tensor
<T> AcosPi<T>(in ReadOnlyTensorSpan<T> x)
3814
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3833
/// Adds each element of <paramref name="x"/> to each element of <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3837
public static
Tensor
<T> Add<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
3840
Tensor
<T> output;
3855
/// Adds <paramref name="y"/> to each element of <paramref name="x"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3859
public static
Tensor
<T> Add<T>(in ReadOnlyTensorSpan<T> x, T y)
3862
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3894
/// Takes the inverse sin of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3897
public static
Tensor
<T> Asin<T>(in ReadOnlyTensorSpan<T> x)
3900
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3919
/// Takes the inverse hyperbolic sine of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3922
public static
Tensor
<T> Asinh<T>(in ReadOnlyTensorSpan<T> x)
3925
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3944
/// Takes the inverse hyperbolic sine divided by pi of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3947
public static
Tensor
<T> AsinPi<T>(in ReadOnlyTensorSpan<T> x)
3950
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3969
/// Takes the arc tangent of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3972
public static
Tensor
<T> Atan<T>(in ReadOnlyTensorSpan<T> x)
3975
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3994
/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3998
public static
Tensor
<T> Atan2<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4001
Tensor
<T> output;
4028
/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4032
public static
Tensor
<T> Atan2<T>(in ReadOnlyTensorSpan<T> x, T y)
4035
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4054
/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4058
public static
Tensor
<T> Atan2<T>(T x, in ReadOnlyTensorSpan<T> y)
4061
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
4082
/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/>, divides each element by pi, and returns a new <see cref="
Tensor
{T}"/> with the result.
4086
public static
Tensor
<T> Atan2Pi<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4089
Tensor
<T> output;
4120
public static
Tensor
<T> Atan2Pi<T>(in ReadOnlyTensorSpan<T> x, T y)
4123
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4146
public static
Tensor
<T> Atan2Pi<T>(T x, in ReadOnlyTensorSpan<T> y)
4149
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
4171
/// Takes the inverse hyperbolic tangent of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4174
public static
Tensor
<T> Atanh<T>(in ReadOnlyTensorSpan<T> x)
4177
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4196
/// Takes the inverse hyperbolic tangent divided by pi of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4199
public static
Tensor
<T> AtanPi<T>(in ReadOnlyTensorSpan<T> x)
4202
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4221
/// Computes the element-wise bitwise and of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4225
public static
Tensor
<T> BitwiseAnd<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4228
Tensor
<T> output;
4255
/// Computes the element-wise bitwise and of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4259
public static
Tensor
<T> BitwiseAnd<T>(in ReadOnlyTensorSpan<T> x, T y)
4262
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4283
/// Computes the element-wise bitwise of of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4287
public static
Tensor
<T> BitwiseOr<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4290
Tensor
<T> output;
4317
/// Computes the element-wise bitwise or of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4321
public static
Tensor
<T> BitwiseOr<T>(in ReadOnlyTensorSpan<T> x, T y)
4324
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4345
/// Computes the element-wise cube root of the input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4348
public static
Tensor
<T> Cbrt<T>(in ReadOnlyTensorSpan<T> x)
4351
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4370
/// Computes the element-wise ceiling of the input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4373
public static
Tensor
<T> Ceiling<T>(in ReadOnlyTensorSpan<T> x)
4376
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4399
public static
Tensor
<TTo> ConvertChecked<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source)
4403
Tensor
<TTo> output = Tensor.Create<TTo>(source.Lengths);
4429
public static
Tensor
<TTo> ConvertSaturating<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source)
4433
Tensor
<TTo> output = Tensor.Create<TTo>(source.Lengths);
4459
public static
Tensor
<TTo> ConvertTruncating<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source)
4463
Tensor
<TTo> output = Tensor.Create<TTo>(source.Lengths);
4489
public static
Tensor
<T> CopySign<T>(in ReadOnlyTensorSpan<T> x, T sign)
4492
Tensor
<T> output = Create<T>(x.Lengths);
4499
/// Computes the element-wise result of copying the sign from one number to another number in the specified tensors and returns a new <see cref="
Tensor
{T}"/> with the result.
4503
public static
Tensor
<T> CopySign<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> sign)
4506
Tensor
<T> output;
4547
/// Takes the cosine of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4550
public static
Tensor
<T> Cos<T>(in ReadOnlyTensorSpan<T> x)
4553
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4572
/// Takes the hyperbolic cosine of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4575
public static
Tensor
<T> Cosh<T>(in ReadOnlyTensorSpan<T> x)
4578
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4601
public static
Tensor
<T> CosineSimilarity<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4618
Tensor
<T> output = Tensor.Create<T>(values, [dim1, dim2]);
4678
/// <summary>Computes the element-wise cosine of the value in the specified tensor that has been multiplied by Pi and returns a new <see cref="
Tensor
{T}"/> with the results.</summary>
4692
public static
Tensor
<T> CosPi<T>(in ReadOnlyTensorSpan<T> x)
4695
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4727
public static
Tensor
<T> DegreesToRadians<T>(in ReadOnlyTensorSpan<T> x)
4730
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4762
/// Divides each element of <paramref name="x"/> by <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4766
public static
Tensor
<T> Divide<T>(in ReadOnlyTensorSpan<T> x, T y)
4769
Tensor
<T> output = Create<T>(x.Lengths);
4775
/// Divides <paramref name="x"/> by each element of <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result."/>
4779
public static
Tensor
<T> Divide<T>(T x, in ReadOnlyTensorSpan<T> y)
4782
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
4793
public static
Tensor
<T> Divide<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4796
Tensor
<T> output;
4866
public static
Tensor
<T> Exp<T>(in ReadOnlyTensorSpan<T> x)
4869
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4891
public static
Tensor
<T> Exp10<T>(in ReadOnlyTensorSpan<T> x)
4894
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4914
public static
Tensor
<T> Exp10M1<T>(in ReadOnlyTensorSpan<T> x)
4917
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4935
public static
Tensor
<T> Exp2<T>(in ReadOnlyTensorSpan<T> x)
4938
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4956
public static
Tensor
<T> Exp2M1<T>(in ReadOnlyTensorSpan<T> x)
4959
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4977
public static
Tensor
<T> ExpM1<T>(in ReadOnlyTensorSpan<T> x)
4980
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4998
public static
Tensor
<T> Floor<T>(in ReadOnlyTensorSpan<T> x)
5001
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5023
public static
Tensor
<T> Hypot<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5026
Tensor
<T> output;
5059
public static
Tensor
<T> Ieee754Remainder<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5062
Tensor
<T> output;
5090
public static
Tensor
<T> Ieee754Remainder<T>(in ReadOnlyTensorSpan<T> x, T y)
5093
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5112
public static
Tensor
<T> Ieee754Remainder<T>(T x, in ReadOnlyTensorSpan<T> y)
5115
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
5135
public static
Tensor
<int> ILogB<T>(in ReadOnlyTensorSpan<T> x)
5138
Tensor
<int> output = Tensor.Create<int>(x.Lengths, x.Strides);
5204
public static
Tensor
<T> LeadingZeroCount<T>(in ReadOnlyTensorSpan<T> x)
5207
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5226
/// Takes the natural logarithm of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5229
public static
Tensor
<T> Log<T>(in ReadOnlyTensorSpan<T> x)
5232
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5251
public static
Tensor
<T> Log<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5254
Tensor
<T> output;
5281
public static
Tensor
<T> Log<T>(in ReadOnlyTensorSpan<T> x, T y)
5284
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5303
/// Takes the base 10 logarithm of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5306
public static
Tensor
<T> Log10<T>(in ReadOnlyTensorSpan<T> x)
5309
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5328
/// Takes the base 10 logarithm plus 1 of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5331
public static
Tensor
<T> Log10P1<T>(in ReadOnlyTensorSpan<T> x)
5334
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5353
/// Takes the base 2 logarithm of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5356
public static
Tensor
<T> Log2<T>(in ReadOnlyTensorSpan<T> x)
5359
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5378
/// Takes the base 2 logarithm plus 1 of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5381
public static
Tensor
<T> Log2P1<T>(in ReadOnlyTensorSpan<T> x)
5384
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5403
/// Takes the natural logarithm plus 1 of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5406
public static
Tensor
<T> LogP1<T>(in ReadOnlyTensorSpan<T> x)
5409
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5438
public static
Tensor
<T> Max<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5441
Tensor
<T> output;
5468
public static
Tensor
<T> Max<T>(in ReadOnlyTensorSpan<T> x, T y)
5471
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5499
public static
Tensor
<T> MaxMagnitude<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5502
Tensor
<T> output;
5529
public static
Tensor
<T> MaxMagnitude<T>(in ReadOnlyTensorSpan<T> x, T y)
5532
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5560
public static
Tensor
<T> MaxMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5563
Tensor
<T> output;
5590
public static
Tensor
<T> MaxMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, T y)
5593
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5621
public static
Tensor
<T> MaxNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5624
Tensor
<T> output;
5651
public static
Tensor
<T> MaxNumber<T>(in ReadOnlyTensorSpan<T> x, T y)
5654
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5682
public static
Tensor
<T> Min<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5685
Tensor
<T> output;
5712
public static
Tensor
<T> Min<T>(in ReadOnlyTensorSpan<T> x, T y)
5715
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5743
public static
Tensor
<T> MinMagnitude<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5746
Tensor
<T> output;
5773
public static
Tensor
<T> MinMagnitude<T>(in ReadOnlyTensorSpan<T> x, T y)
5776
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5804
public static
Tensor
<T> MinMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5807
Tensor
<T> output;
5834
public static
Tensor
<T> MinMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, T y)
5837
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5865
public static
Tensor
<T> MinNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5868
Tensor
<T> output;
5895
public static
Tensor
<T> MinNumber<T>(in ReadOnlyTensorSpan<T> x, T y)
5898
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5916
/// Multiplies each element of <paramref name="x"/> with <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5920
public static
Tensor
<T> Multiply<T>(in ReadOnlyTensorSpan<T> x, T y)
5923
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5929
/// Multiplies each element of <paramref name="x"/> with <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5934
public static
Tensor
<T> Multiply<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5937
Tensor
<T> output;
5983
public static
Tensor
<T> Negate<T>(in ReadOnlyTensorSpan<T> x)
5986
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6016
public static
Tensor
<T> OnesComplement<T>(in ReadOnlyTensorSpan<T> x)
6019
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6037
public static
Tensor
<T> PopCount<T>(in ReadOnlyTensorSpan<T> x)
6040
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6059
public static
Tensor
<T> Pow<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
6062
Tensor
<T> output;
6089
public static
Tensor
<T> Pow<T>(in ReadOnlyTensorSpan<T> x, T y)
6092
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6111
public static
Tensor
<T> Pow<T>(T x, in ReadOnlyTensorSpan<T> y)
6114
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
6144
public static
Tensor
<T> RadiansToDegrees<T>(in ReadOnlyTensorSpan<T> x)
6147
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6165
public static
Tensor
<T> Reciprocal<T>(in ReadOnlyTensorSpan<T> x)
6168
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6187
public static
Tensor
<T> RootN<T>(in ReadOnlyTensorSpan<T> x, int n)
6190
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6217
public static
Tensor
<T> RotateLeft<T>(in ReadOnlyTensorSpan<T> x, int rotateAmount)
6220
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6248
public static
Tensor
<T> RotateRight<T>(in ReadOnlyTensorSpan<T> x, int rotateAmount)
6251
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6277
public static
Tensor
<T> Round<T>(in ReadOnlyTensorSpan<T> x)
6280
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6298
public static
Tensor
<T> Round<T>(in ReadOnlyTensorSpan<T> x, int digits, MidpointRounding mode)
6301
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6326
public static
Tensor
<T> Round<T>(in ReadOnlyTensorSpan<T> x, int digits)
6329
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6353
public static
Tensor
<T> Round<T>(in ReadOnlyTensorSpan<T> x, MidpointRounding mode)
6356
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6381
public static
Tensor
<T> Sigmoid<T>(in ReadOnlyTensorSpan<T> x)
6384
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6401
/// Takes the sin of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6404
public static
Tensor
<T> Sin<T>(in ReadOnlyTensorSpan<T> x)
6407
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6427
public static
Tensor
<T> Sinh<T>(in ReadOnlyTensorSpan<T> x)
6430
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6448
public static
Tensor
<T> SinPi<T>(in ReadOnlyTensorSpan<T> x)
6451
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6469
public static
Tensor
<T> SoftMax<T>(in ReadOnlyTensorSpan<T> x)
6472
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6489
/// Takes the square root of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6492
public static
Tensor
<T> Sqrt<T>(in ReadOnlyTensorSpan<T> x)
6495
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6514
/// Subtracts <paramref name="y"/> from each element of <paramref name="x"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6518
public static
Tensor
<T> Subtract<T>(in ReadOnlyTensorSpan<T> x, T y)
6521
Tensor
<T> output = Create<T>(x.Lengths);
6527
/// Subtracts each element of <paramref name="y"/> from <paramref name="x"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6531
public static
Tensor
<T> Subtract<T>(T x, in ReadOnlyTensorSpan<T> y)
6534
Tensor
<T> output = Create<T>(y.Lengths);
6540
/// Subtracts each element of <paramref name="x"/> from <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6544
public static
Tensor
<T> Subtract<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
6547
Tensor
<T> output;
6614
public static
Tensor
<T> Tan<T>(in ReadOnlyTensorSpan<T> x)
6617
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6635
public static
Tensor
<T> Tanh<T>(in ReadOnlyTensorSpan<T> x)
6638
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6656
public static
Tensor
<T> TanPi<T>(in ReadOnlyTensorSpan<T> x)
6659
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6677
public static
Tensor
<T> TrailingZeroCount<T>(in ReadOnlyTensorSpan<T> x)
6680
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6698
public static
Tensor
<T> Truncate<T>(in ReadOnlyTensorSpan<T> x)
6701
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6720
public static
Tensor
<T> Xor<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
6723
Tensor
<T> output;
6748
/// Computes the element-wise Xor of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6752
public static
Tensor
<T> Xor<T>(in ReadOnlyTensorSpan<T> x, T y)
6755
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
System\Numerics\Tensors\netcore\TensorHelpers.cs (4)
33
internal static bool IsBroadcastableTo<T>(
Tensor
<T> tensor1,
Tensor
<T> tensor2)
94
internal static bool IsUnderlyingStorageSameSize<T>(
Tensor
<T> tensor1,
Tensor
<T> tensor2)