10 instantiations of Tensor
System.Numerics.Tensors (10)
System\Numerics\Tensors\netcore\Tensor.cs (2)
143
public static Tensor<T> Empty { get; } =
new
();
466
var outTensor = new
Tensor
<T>(values, s.Lengths.ToArray(), _isPinned);
System\Numerics\Tensors\netcore\TensorExtensions.cs (8)
221
return new
Tensor
<T>(input._values, lengths, false);
247
Tensor<T> output = new
Tensor
<T>(input._values, lengths, strides);
2663
outTensor = new
Tensor
<T>(values, lengths, Array.Empty<nint>(), tensor._isPinned);
2774
return new
Tensor
<T>(tensor._values, arrLengths, strides);
2929
Tensor<T> output = new
Tensor
<T>(values, lengths, false);
3220
outputs[i] = new
Tensor
<T>(values, newShape);
3302
return new
Tensor
<T>(tensor._values, lengths, strides);
3664
return new
Tensor
<T>(tensor._values, lengths, strides);
533 references to Tensor
System.Numerics.Tensors (533)
System\Numerics\Tensors\netcore\Tensor.cs (63)
25
: ITensor<
Tensor
<T>, T>
90
/// 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.
94
static
Tensor
<T> ITensor<
Tensor
<T>, T>.Create(scoped ReadOnlySpan<nint> lengths, bool pinned)
102
/// 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.
107
static
Tensor
<T> ITensor<
Tensor
<T>, T>.Create(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned)
115
/// Creates a <see cref="
Tensor
{T}"/> and does not initialize it. If <paramref name="pinned"/> is true, the memory will be pinned.
119
static
Tensor
<T> ITensor<
Tensor
<T>, T>.CreateUninitialized(scoped ReadOnlySpan<nint> lengths, bool pinned)
127
/// Creates a <see cref="
Tensor
{T}"/> and does not initialize it. If <paramref name="pinned"/> is true, the memory will be pinned.
132
static
Tensor
<T> ITensor<
Tensor
<T>, T>.CreateUninitialized(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned)
143
public static
Tensor
<T> Empty { get; } = new();
146
/// Gets a value indicating whether this <see cref="
Tensor
{T}"/> is empty.
152
/// Gets a value indicating whether the backing memory of the <see cref="
Tensor
{T}"/> is pinned."/>
158
/// Gets a value indicating the rank, or number of dimensions, of this <see cref="
Tensor
{T}"/>.
164
/// The number of items in the <see cref="
Tensor
{T}"/>.
170
/// Gets the length of each dimension in this <see cref="
Tensor
{T}"/>.
176
/// Gets the length of each dimension in this <see cref="
Tensor
{T}"/>.
179
ReadOnlySpan<nint> IReadOnlyTensor<
Tensor
<T>, T>.Lengths => _lengths;
183
/// Gets the strides of each dimension in this <see cref="
Tensor
{T}"/>.
189
/// Gets the strides of each dimension in this <see cref="
Tensor
{T}"/>.
192
ReadOnlySpan<nint> IReadOnlyTensor<
Tensor
<T>, T>.Strides => _strides;
194
bool ITensor<
Tensor
<T>, T>.IsReadOnly => false;
224
public
Tensor
<T> this[params ReadOnlySpan<NRange> ranges]
260
T ITensor<
Tensor
<T>, T>.this[params ReadOnlySpan<nint> indexes]
280
T ITensor<
Tensor
<T>, T>.this[params ReadOnlySpan<NIndex> indexes]
300
T IReadOnlyTensor<
Tensor
<T>, T>.this[params ReadOnlySpan<nint> indexes] => AsReadOnlyTensorSpan()[indexes];
310
T IReadOnlyTensor<
Tensor
<T>, T>.this[params ReadOnlySpan<NIndex> indexes] => AsReadOnlyTensorSpan()[indexes];
320
Tensor
<T> IReadOnlyTensor<
Tensor
<T>, T>.this[params ReadOnlySpan<NRange> ranges]
338
public
Tensor
<T> this[
Tensor
<bool> filter]
371
/// Defines an implicit conversion of an array to a <see cref="
Tensor
{T}"/>.
373
public static implicit operator
Tensor
<T>(T[] array) => new Tensor<T>(array, [array.Length]);
376
/// Defines an implicit conversion of a <see cref="
Tensor
{T}"/> to a <see cref="TensorSpan{T}"/>.
378
public static implicit operator TensorSpan<T>(
Tensor
<T> value) => new TensorSpan<T>(ref MemoryMarshal.GetArrayDataReference(value._values), value._lengths, value._strides, value._flattenedLength);
381
/// Defines an implicit conversion of a <see cref="
Tensor
{T}"/> to a <see cref="TensorSpan{T}"/>.
383
public static implicit operator ReadOnlyTensorSpan<T>(
Tensor
<T> value) => new ReadOnlyTensorSpan<T>(ref MemoryMarshal.GetArrayDataReference(value._values), value._lengths, value._strides, value.FlattenedLength);
386
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="TensorSpan{T}"/> pointing to the same backing memory."/>
392
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="TensorSpan{T}"/> pointing to the same backing memory based on the provided ranges."/>
399
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="TensorSpan{T}"/> pointing to the same backing memory based on the provided start locations."/>
406
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="TensorSpan{T}"/> pointing to the same backing memory based on the provided start indexes."/>
413
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="ReadOnlyTensorSpan{T}"/> pointing to the same backing memory."/>
419
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="ReadOnlyTensorSpan{T}"/> pointing to the same backing memory based on the provided ranges."/>
426
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="ReadOnlyTensorSpan{T}"/> pointing to the same backing memory based on the provided start locations."/>
433
/// Converts this <see cref="
Tensor
{T}"/> to a <see cref="ReadOnlyTensorSpan{T}"/> pointing to the same backing memory based on the provided start indexes."/>
451
ref readonly T IReadOnlyTensor<
Tensor
<T>, T>.GetPinnableReference() => ref AsReadOnlyTensorSpan().GetPinnableReference();
457
/// <returns><see cref="
Tensor
{T}"/> as a copy of the provided ranges.</returns>
459
public
Tensor
<T> Slice(params ReadOnlySpan<NRange> start)
466
var
outTensor = new Tensor<T>(values, s.Lengths.ToArray(), _isPinned);
475
/// <returns><see cref="
Tensor
{T}"/> as a copy of the provided ranges.</returns>
477
public
Tensor
<T> Slice(params ReadOnlySpan<nint> start)
491
/// <returns><see cref="
Tensor
{T}"/> as a copy of the provided ranges.</returns>
493
public
Tensor
<T> Slice(params ReadOnlySpan<NIndex> startIndex)
551
/// Gets an <see cref="IEnumerator{T}"/> for the <see cref="
Tensor
{T}"/>.
558
/// Gets an <see cref="IEnumerator{T}"/> for the <see cref="
Tensor
{T}"/>.
564
/// Gets an <see cref="IEnumerator"/> for the <see cref="
Tensor
{T}"/>."/>
572
private readonly
Tensor
<T> _tensor;
582
internal Enumerator(
Tensor
<T> tensor)
629
/// Gets the hash code for the <see cref="
Tensor
{T}"/>.
659
/// <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)
50
/// 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.
52
/// <param name="source">Input <see cref="
Tensor
{T}"/>.</param>
53
/// <param name="lengthsSource">Other <see cref="
Tensor
{T}"/> to make shapes broadcastable.</param>
54
public static
Tensor
<T> Broadcast<T>(scoped in ReadOnlyTensorSpan<T> source, scoped in ReadOnlyTensorSpan<T> lengthsSource)
60
/// 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.
63
/// <param name="source">Input <see cref="
Tensor
{T}"/>.</param>
66
public static
Tensor
<T> Broadcast<T>(scoped in ReadOnlyTensorSpan<T> source, scoped ReadOnlySpan<nint> lengths)
71
Tensor
<T> output = Tensor.CreateUninitialized<T>(intermediate.Lengths);
83
public static void BroadcastTo<T>(this
Tensor
<T> source, in TensorSpan<T> destination)
125
/// Broadcast the data from <paramref name="input"/> to the new shape <paramref name="shape"/>. Creates a new <see cref="
Tensor
{T}"/>
168
/// Broadcast the data from <paramref name="input"/> to the new shape <paramref name="shape"/>. Creates a new <see cref="
Tensor
{T}"/>
211
/// Broadcast the data from <paramref name="input"/> to the new shape <paramref name="lengths"/>. Creates a new <see cref="
Tensor
{T}"/>
215
/// <param name="input">Input <see cref="
Tensor
{T}"/>.</param>
218
internal static
Tensor
<T> LazyBroadcast<T>(
Tensor
<T> input, ReadOnlySpan<nint> lengths)
247
Tensor
<T> output = new Tensor<T>(input._values, lengths, strides);
258
public static
Tensor
<T> Concatenate<T>(params scoped ReadOnlySpan<
Tensor
<T>> tensors)
268
public static
Tensor
<T> ConcatenateOnDimension<T>(int dimension, params scoped ReadOnlySpan<
Tensor
<T>> tensors)
302
Tensor
<T> tensor;
324
public static ref readonly TensorSpan<T> Concatenate<T>(scoped ReadOnlySpan<
Tensor
<T>> tensors, in TensorSpan<T> destination)
336
public static ref readonly TensorSpan<T> ConcatenateOnDimension<T>(int dimension, scoped ReadOnlySpan<
Tensor
<T>> tensors, in TensorSpan<T> destination)
439
public static
Tensor
<bool> Equals<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
442
Tensor
<bool> result;
520
public static
Tensor
<bool> Equals<T>(in ReadOnlyTensorSpan<T> x, T y)
523
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
743
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
769
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
800
/// 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"/>
805
/// <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
807
public static
Tensor
<bool> GreaterThan<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
810
Tensor
<bool> result;
828
/// 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"/>
834
/// <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
886
/// 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"/>
891
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
893
public static
Tensor
<bool> GreaterThan<T>(in ReadOnlyTensorSpan<T> x, T y)
896
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
903
/// 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"/>
909
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
946
/// 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"/>
951
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
953
public static
Tensor
<bool> GreaterThan<T>(T x, in ReadOnlyTensorSpan<T> y)
956
Tensor
<bool> result = Tensor.Create<bool>(y.Lengths, false);
963
/// 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"/>
969
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1009
/// 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"/>
1014
/// <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
1016
public static
Tensor
<bool> GreaterThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
1019
Tensor
<bool> result;
1037
/// 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"/>
1043
/// <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
1095
/// 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"/>
1100
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1102
public static
Tensor
<bool> GreaterThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, T y)
1105
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
1112
/// 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"/>
1118
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1155
/// 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"/>
1160
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1162
public static
Tensor
<bool> GreaterThanOrEqual<T>(T x, in ReadOnlyTensorSpan<T> y)
1165
Tensor
<bool> result = Tensor.Create<bool>(y.Lengths, false);
1172
/// 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"/>
1178
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1712
/// 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"/>
1717
/// <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
1719
public static
Tensor
<bool> LessThan<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
1722
Tensor
<bool> result;
1740
/// 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"/>
1746
/// <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
1797
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
1798
/// 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"/>
1801
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
1803
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1805
public static
Tensor
<bool> LessThan<T>(in ReadOnlyTensorSpan<T> x, T y)
1808
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
1814
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
1815
/// 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"/>
1818
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
1821
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1857
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
1858
/// 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"/>
1861
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
1863
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1865
public static
Tensor
<bool> LessThan<T>(T x, in ReadOnlyTensorSpan<T> y)
1868
Tensor
<bool> result = Tensor.Create<bool>(y.Lengths, false);
1874
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
1875
/// 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"/>
1878
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
1881
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1921
/// 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"/>
1926
/// <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
1928
public static
Tensor
<bool> LessThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
1931
Tensor
<bool> result;
1949
/// 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"/>
1955
/// <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
2006
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
2007
/// 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"/>
2010
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
2012
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2014
public static
Tensor
<bool> LessThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, T y)
2017
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
2023
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
2024
/// 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"/>
2027
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
2030
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2066
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
2067
/// 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"/>
2070
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
2072
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2074
public static
Tensor
<bool> LessThanOrEqual<T>(T x, in ReadOnlyTensorSpan<T> y)
2077
Tensor
<bool> result = Tensor.Create<bool>(y.Lengths, false);
2083
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
2084
/// 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"/>
2087
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
2090
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2624
/// If <paramref name="tensor"/> is a 1D tensor, it will return <paramref name="tensor"/>. Otherwise it creates a new <see cref="
Tensor
{T}"/>
2627
/// <param name="tensor">Input <see cref="
Tensor
{T}"/></param>
2629
public static
Tensor
<T> PermuteDimensions<T>(this
Tensor
<T> tensor, params ReadOnlySpan<int> dimensions)
2639
Tensor
<T> outTensor;
2714
/// <param name="tensor"><see cref="
Tensor
{T}"/> you want to reshape.</param>
2716
public static
Tensor
<T> Reshape<T>(this
Tensor
<T> tensor, params ReadOnlySpan<nint> lengths)
2920
/// 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
2923
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
2925
public static
Tensor
<T> Resize<T>(
Tensor
<T> tensor, ReadOnlySpan<nint> lengths)
2929
Tensor
<T> output = new Tensor<T>(values, lengths, false);
2944
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
2946
public static void ResizeTo<T>(scoped in
Tensor
<T> tensor, in TensorSpan<T> destination)
2993
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
2994
public static
Tensor
<T> Reverse<T>(in ReadOnlyTensorSpan<T> tensor)
2996
Tensor
<T> output = Tensor.Create<T>(tensor.Lengths);
3006
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3008
public static
Tensor
<T> ReverseDimension<T>(in ReadOnlyTensorSpan<T> tensor, int dimension)
3010
Tensor
<T> output = Tensor.Create<T>(tensor.Lengths);
3130
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3133
public static
Tensor
<T> SetSlice<T>(this
Tensor
<T> tensor, in ReadOnlyTensorSpan<T> values, params ReadOnlySpan<NRange> ranges)
3143
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3172
/// Split a <see cref="
Tensor
{T}"/> into <paramref name="splitCount"/> along the given <paramref name="dimension"/>. If the tensor cannot be split
3175
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3178
public static
Tensor
<T>[] Split<T>(scoped in ReadOnlyTensorSpan<T> tensor, int splitCount, nint dimension)
3183
Tensor
<T>[] outputs = new
Tensor
<T>[splitCount];
3252
/// <param name="tensor">The <see cref="
Tensor
{T}"/> to remove all dimensions of length 1.</param>
3253
public static
Tensor
<T> Squeeze<T>(this
Tensor
<T> tensor)
3262
/// <param name="tensor">The <see cref="
Tensor
{T}"/> to remove dimension of length 1.</param>
3264
public static
Tensor
<T> SqueezeDimension<T>(this
Tensor
<T> tensor, int dimension)
3420
/// Join multiple <see cref="
Tensor
{T}"/> along a new dimension that is added at position 0. All tensors must have the same shape.
3422
/// <param name="tensors">Input <see cref="
Tensor
{T}"/>.</param>
3423
public static
Tensor
<T> Stack<T>(params ReadOnlySpan<
Tensor
<T>> tensors)
3429
/// 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.
3431
/// <param name="tensors">Input <see cref="
Tensor
{T}"/>.</param>
3433
public static
Tensor
<T> StackAlongDimension<T>(int dimension, params ReadOnlySpan<
Tensor
<T>> tensors)
3447
Tensor
<T>[] outputs = new
Tensor
<T>[tensors.Length];
3456
/// Join multiple <see cref="
Tensor
{T}"/> along a new dimension that is added at position 0. All tensors must have the same shape.
3458
/// <param name="tensors">Input <see cref="
Tensor
{T}"/>.</param>
3460
public static ref readonly TensorSpan<T> Stack<T>(scoped in ReadOnlySpan<
Tensor
<T>> tensors, in TensorSpan<T> destination)
3466
/// 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.
3468
/// <param name="tensors">Input <see cref="
Tensor
{T}"/>.</param>
3471
public static ref readonly TensorSpan<T> StackAlongDimension<T>(scoped ReadOnlySpan<
Tensor
<T>> tensors, in TensorSpan<T> destination, int dimension)
3485
Tensor
<T>[] outputs = new
Tensor
<T>[tensors.Length];
3556
/// Creates a <see cref="string"/> representation of the <see cref="
Tensor
{T}"/>."/>
3561
public static string ToString<T>(this
Tensor
<T> tensor, params ReadOnlySpan<nint> maximumLengths) => ((ReadOnlyTensorSpan<T>)tensor).ToString(maximumLengths);
3569
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3570
public static
Tensor
<T> Transpose<T>(
Tensor
<T> tensor)
3591
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3593
public static bool TryBroadcastTo<T>(this
Tensor
<T> tensor, in TensorSpan<T> destination)
3633
/// <param name="tensor">The <see cref="
Tensor
{T}"/> to add a dimension of length 1.</param>
3635
public static
Tensor
<T> Unsqueeze<T>(this
Tensor
<T> tensor, int dimension)
3745
/// Takes the absolute value of each element of the <see cref="
Tensor
{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3748
public static
Tensor
<T> Abs<T>(in ReadOnlyTensorSpan<T> x)
3751
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.
3773
public static
Tensor
<T> Acos<T>(in ReadOnlyTensorSpan<T> x)
3776
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3782
/// Takes the inverse cosine of each element of the <see cref="
Tensor
{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3795
/// 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.
3798
public static
Tensor
<T> Acosh<T>(in ReadOnlyTensorSpan<T> x)
3801
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3820
/// 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.
3823
public static
Tensor
<T> AcosPi<T>(in ReadOnlyTensorSpan<T> x)
3826
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3845
/// 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.
3849
public static
Tensor
<T> Add<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
3852
Tensor
<T> output;
3867
/// Adds <paramref name="y"/> to each element of <paramref name="x"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3871
public static
Tensor
<T> Add<T>(in ReadOnlyTensorSpan<T> x, T y)
3874
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3906
/// Takes the inverse sin of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3909
public static
Tensor
<T> Asin<T>(in ReadOnlyTensorSpan<T> x)
3912
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3931
/// 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.
3934
public static
Tensor
<T> Asinh<T>(in ReadOnlyTensorSpan<T> x)
3937
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3956
/// 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.
3959
public static
Tensor
<T> AsinPi<T>(in ReadOnlyTensorSpan<T> x)
3962
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3981
/// Takes the arc tangent of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3984
public static
Tensor
<T> Atan<T>(in ReadOnlyTensorSpan<T> x)
3987
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4006
/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4010
public static
Tensor
<T> Atan2<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4013
Tensor
<T> output;
4040
/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4044
public static
Tensor
<T> Atan2<T>(in ReadOnlyTensorSpan<T> x, T y)
4047
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4066
/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4070
public static
Tensor
<T> Atan2<T>(T x, in ReadOnlyTensorSpan<T> y)
4073
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
4094
/// 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.
4098
public static
Tensor
<T> Atan2Pi<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4101
Tensor
<T> output;
4132
public static
Tensor
<T> Atan2Pi<T>(in ReadOnlyTensorSpan<T> x, T y)
4135
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4158
public static
Tensor
<T> Atan2Pi<T>(T x, in ReadOnlyTensorSpan<T> y)
4161
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
4183
/// 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.
4186
public static
Tensor
<T> Atanh<T>(in ReadOnlyTensorSpan<T> x)
4189
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4208
/// 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.
4211
public static
Tensor
<T> AtanPi<T>(in ReadOnlyTensorSpan<T> x)
4214
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4246
/// 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.
4250
public static
Tensor
<T> BitwiseAnd<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4253
Tensor
<T> output;
4280
/// 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.
4284
public static
Tensor
<T> BitwiseAnd<T>(in ReadOnlyTensorSpan<T> x, T y)
4287
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4308
/// 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.
4312
public static
Tensor
<T> BitwiseOr<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4315
Tensor
<T> output;
4342
/// 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.
4346
public static
Tensor
<T> BitwiseOr<T>(in ReadOnlyTensorSpan<T> x, T y)
4349
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4370
/// Computes the element-wise cube root of the input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4373
public static
Tensor
<T> Cbrt<T>(in ReadOnlyTensorSpan<T> x)
4376
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4395
/// Computes the element-wise ceiling of the input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4398
public static
Tensor
<T> Ceiling<T>(in ReadOnlyTensorSpan<T> x)
4401
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4424
public static
Tensor
<TTo> ConvertChecked<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source)
4428
Tensor
<TTo> output = Tensor.Create<TTo>(source.Lengths);
4454
public static
Tensor
<TTo> ConvertSaturating<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source)
4458
Tensor
<TTo> output = Tensor.Create<TTo>(source.Lengths);
4484
public static
Tensor
<TTo> ConvertTruncating<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source)
4488
Tensor
<TTo> output = Tensor.Create<TTo>(source.Lengths);
4514
public static
Tensor
<T> CopySign<T>(in ReadOnlyTensorSpan<T> x, T sign)
4517
Tensor
<T> output = Create<T>(x.Lengths);
4524
/// 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.
4528
public static
Tensor
<T> CopySign<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> sign)
4531
Tensor
<T> output;
4572
/// Takes the 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> Cos<T>(in ReadOnlyTensorSpan<T> x)
4578
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4597
/// Takes the hyperbolic cosine of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4600
public static
Tensor
<T> Cosh<T>(in ReadOnlyTensorSpan<T> x)
4603
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4626
public static
Tensor
<T> CosineSimilarity<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4643
Tensor
<T> output = Tensor.Create<T>(values, [dim1, dim2]);
4703
/// <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>
4717
public static
Tensor
<T> CosPi<T>(in ReadOnlyTensorSpan<T> x)
4720
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4752
public static
Tensor
<T> DegreesToRadians<T>(in ReadOnlyTensorSpan<T> x)
4755
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4787
/// Divides each element of <paramref name="x"/> by <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4791
public static
Tensor
<T> Divide<T>(in ReadOnlyTensorSpan<T> x, T y)
4794
Tensor
<T> output = Create<T>(x.Lengths);
4800
/// Divides <paramref name="x"/> by each element of <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result."/>
4804
public static
Tensor
<T> Divide<T>(T x, in ReadOnlyTensorSpan<T> y)
4807
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
4818
public static
Tensor
<T> Divide<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4821
Tensor
<T> output;
4891
public static
Tensor
<T> Exp<T>(in ReadOnlyTensorSpan<T> x)
4894
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4916
public static
Tensor
<T> Exp10<T>(in ReadOnlyTensorSpan<T> x)
4919
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4939
public static
Tensor
<T> Exp10M1<T>(in ReadOnlyTensorSpan<T> x)
4942
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4960
public static
Tensor
<T> Exp2<T>(in ReadOnlyTensorSpan<T> x)
4963
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4981
public static
Tensor
<T> Exp2M1<T>(in ReadOnlyTensorSpan<T> x)
4984
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5002
public static
Tensor
<T> ExpM1<T>(in ReadOnlyTensorSpan<T> x)
5005
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5023
public static
Tensor
<T> Floor<T>(in ReadOnlyTensorSpan<T> x)
5026
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5048
public static
Tensor
<T> Hypot<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5051
Tensor
<T> output;
5084
public static
Tensor
<T> Ieee754Remainder<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5087
Tensor
<T> output;
5115
public static
Tensor
<T> Ieee754Remainder<T>(in ReadOnlyTensorSpan<T> x, T y)
5118
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5137
public static
Tensor
<T> Ieee754Remainder<T>(T x, in ReadOnlyTensorSpan<T> y)
5140
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
5160
public static
Tensor
<int> ILogB<T>(in ReadOnlyTensorSpan<T> x)
5163
Tensor
<int> output = Tensor.Create<int>(x.Lengths, x.Strides);
5229
public static
Tensor
<T> LeadingZeroCount<T>(in ReadOnlyTensorSpan<T> x)
5232
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5251
/// Takes the natural logarithm of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5254
public static
Tensor
<T> Log<T>(in ReadOnlyTensorSpan<T> x)
5257
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5276
public static
Tensor
<T> Log<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5279
Tensor
<T> output;
5306
public static
Tensor
<T> Log<T>(in ReadOnlyTensorSpan<T> x, T y)
5309
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5328
/// 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.
5331
public static
Tensor
<T> Log10<T>(in ReadOnlyTensorSpan<T> x)
5334
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5353
/// 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.
5356
public static
Tensor
<T> Log10P1<T>(in ReadOnlyTensorSpan<T> x)
5359
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5378
/// 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.
5381
public static
Tensor
<T> Log2<T>(in ReadOnlyTensorSpan<T> x)
5384
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5403
/// 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.
5406
public static
Tensor
<T> Log2P1<T>(in ReadOnlyTensorSpan<T> x)
5409
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5428
/// 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.
5431
public static
Tensor
<T> LogP1<T>(in ReadOnlyTensorSpan<T> x)
5434
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5463
public static
Tensor
<T> Max<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5466
Tensor
<T> output;
5493
public static
Tensor
<T> Max<T>(in ReadOnlyTensorSpan<T> x, T y)
5496
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5524
public static
Tensor
<T> MaxMagnitude<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5527
Tensor
<T> output;
5554
public static
Tensor
<T> MaxMagnitude<T>(in ReadOnlyTensorSpan<T> x, T y)
5557
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5585
public static
Tensor
<T> MaxMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5588
Tensor
<T> output;
5615
public static
Tensor
<T> MaxMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, T y)
5618
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5646
public static
Tensor
<T> MaxNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5649
Tensor
<T> output;
5676
public static
Tensor
<T> MaxNumber<T>(in ReadOnlyTensorSpan<T> x, T y)
5679
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5707
public static
Tensor
<T> Min<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5710
Tensor
<T> output;
5737
public static
Tensor
<T> Min<T>(in ReadOnlyTensorSpan<T> x, T y)
5740
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5768
public static
Tensor
<T> MinMagnitude<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5771
Tensor
<T> output;
5798
public static
Tensor
<T> MinMagnitude<T>(in ReadOnlyTensorSpan<T> x, T y)
5801
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5829
public static
Tensor
<T> MinMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5832
Tensor
<T> output;
5859
public static
Tensor
<T> MinMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, T y)
5862
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5890
public static
Tensor
<T> MinNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5893
Tensor
<T> output;
5920
public static
Tensor
<T> MinNumber<T>(in ReadOnlyTensorSpan<T> x, T y)
5923
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5941
/// Multiplies each element of <paramref name="x"/> with <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5945
public static
Tensor
<T> Multiply<T>(in ReadOnlyTensorSpan<T> x, T y)
5948
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5954
/// Multiplies each element of <paramref name="x"/> with <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5959
public static
Tensor
<T> Multiply<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5962
Tensor
<T> output;
6008
public static
Tensor
<T> Negate<T>(in ReadOnlyTensorSpan<T> x)
6011
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6041
public static
Tensor
<T> OnesComplement<T>(in ReadOnlyTensorSpan<T> x)
6044
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6062
public static
Tensor
<T> PopCount<T>(in ReadOnlyTensorSpan<T> x)
6065
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6084
public static
Tensor
<T> Pow<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
6087
Tensor
<T> output;
6114
public static
Tensor
<T> Pow<T>(in ReadOnlyTensorSpan<T> x, T y)
6117
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6136
public static
Tensor
<T> Pow<T>(T x, in ReadOnlyTensorSpan<T> y)
6139
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
6169
public static
Tensor
<T> RadiansToDegrees<T>(in ReadOnlyTensorSpan<T> x)
6172
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6190
public static
Tensor
<T> Reciprocal<T>(in ReadOnlyTensorSpan<T> x)
6193
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6212
public static
Tensor
<T> RootN<T>(in ReadOnlyTensorSpan<T> x, int n)
6215
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6242
public static
Tensor
<T> RotateLeft<T>(in ReadOnlyTensorSpan<T> x, int rotateAmount)
6245
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6273
public static
Tensor
<T> RotateRight<T>(in ReadOnlyTensorSpan<T> x, int rotateAmount)
6276
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6302
public static
Tensor
<T> Round<T>(in ReadOnlyTensorSpan<T> x)
6305
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6323
public static
Tensor
<T> Round<T>(in ReadOnlyTensorSpan<T> x, int digits, MidpointRounding mode)
6326
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6351
public static
Tensor
<T> Round<T>(in ReadOnlyTensorSpan<T> x, int digits)
6354
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6378
public static
Tensor
<T> Round<T>(in ReadOnlyTensorSpan<T> x, MidpointRounding mode)
6381
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6406
public static
Tensor
<T> Sigmoid<T>(in ReadOnlyTensorSpan<T> x)
6409
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6426
/// Takes the sin of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6429
public static
Tensor
<T> Sin<T>(in ReadOnlyTensorSpan<T> x)
6432
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6452
public static
Tensor
<T> Sinh<T>(in ReadOnlyTensorSpan<T> x)
6455
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6473
public static
Tensor
<T> SinPi<T>(in ReadOnlyTensorSpan<T> x)
6476
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6494
public static
Tensor
<T> SoftMax<T>(in ReadOnlyTensorSpan<T> x)
6497
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6514
/// Takes the square root of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6517
public static
Tensor
<T> Sqrt<T>(in ReadOnlyTensorSpan<T> x)
6520
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6552
/// Subtracts <paramref name="y"/> from each element of <paramref name="x"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6556
public static
Tensor
<T> Subtract<T>(in ReadOnlyTensorSpan<T> x, T y)
6559
Tensor
<T> output = Create<T>(x.Lengths);
6565
/// Subtracts each element of <paramref name="y"/> from <paramref name="x"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6569
public static
Tensor
<T> Subtract<T>(T x, in ReadOnlyTensorSpan<T> y)
6572
Tensor
<T> output = Create<T>(y.Lengths);
6578
/// Subtracts each element of <paramref name="x"/> from <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6582
public static
Tensor
<T> Subtract<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
6585
Tensor
<T> output;
6665
public static
Tensor
<T> Tan<T>(in ReadOnlyTensorSpan<T> x)
6668
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6686
public static
Tensor
<T> Tanh<T>(in ReadOnlyTensorSpan<T> x)
6689
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6707
public static
Tensor
<T> TanPi<T>(in ReadOnlyTensorSpan<T> x)
6710
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6728
public static
Tensor
<T> TrailingZeroCount<T>(in ReadOnlyTensorSpan<T> x)
6731
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6749
public static
Tensor
<T> Truncate<T>(in ReadOnlyTensorSpan<T> x)
6752
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6771
public static
Tensor
<T> Xor<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
6774
Tensor
<T> output;
6799
/// Computes the element-wise Xor of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6803
public static
Tensor
<T> Xor<T>(in ReadOnlyTensorSpan<T> x, T y)
6806
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
System\Numerics\Tensors\netcore\TensorHelpers.cs (4)
31
internal static bool IsBroadcastableTo<T>(
Tensor
<T> tensor1,
Tensor
<T> tensor2)
92
internal static bool IsUnderlyingStorageSameSize<T>(
Tensor
<T> tensor1,
Tensor
<T> tensor2)