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)
235
return new
Tensor
<T>(input._values, lengths, false);
261
Tensor<T> output = new
Tensor
<T>(input._values, lengths, strides);
2677
outTensor = new
Tensor
<T>(values, lengths, Array.Empty<nint>(), tensor._isPinned);
2788
return new
Tensor
<T>(tensor._values, arrLengths, strides);
2943
Tensor<T> output = new
Tensor
<T>(values, lengths, false);
3234
outputs[i] = new
Tensor
<T>(values, newShape);
3316
return new
Tensor
<T>(tensor._values, lengths, strides);
3697
return new
Tensor
<T>(tensor._values, lengths, strides);
534 references to Tensor
System.Numerics.Tensors (534)
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 (443)
64
/// 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.
66
/// <param name="source">Input <see cref="
Tensor
{T}"/>.</param>
67
/// <param name="lengthsSource">Other <see cref="
Tensor
{T}"/> to make shapes broadcastable.</param>
68
public static
Tensor
<T> Broadcast<T>(scoped in ReadOnlyTensorSpan<T> source, scoped in ReadOnlyTensorSpan<T> lengthsSource)
74
/// 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.
77
/// <param name="source">Input <see cref="
Tensor
{T}"/>.</param>
80
public static
Tensor
<T> Broadcast<T>(scoped in ReadOnlyTensorSpan<T> source, scoped ReadOnlySpan<nint> lengths)
85
Tensor
<T> output = Tensor.CreateUninitialized<T>(intermediate.Lengths);
97
public static void BroadcastTo<T>(this
Tensor
<T> source, in TensorSpan<T> destination)
139
/// Broadcast the data from <paramref name="input"/> to the new shape <paramref name="shape"/>. Creates a new <see cref="
Tensor
{T}"/>
182
/// Broadcast the data from <paramref name="input"/> to the new shape <paramref name="shape"/>. Creates a new <see cref="
Tensor
{T}"/>
225
/// Broadcast the data from <paramref name="input"/> to the new shape <paramref name="lengths"/>. Creates a new <see cref="
Tensor
{T}"/>
229
/// <param name="input">Input <see cref="
Tensor
{T}"/>.</param>
232
internal static
Tensor
<T> LazyBroadcast<T>(
Tensor
<T> input, ReadOnlySpan<nint> lengths)
261
Tensor
<T> output = new Tensor<T>(input._values, lengths, strides);
272
public static
Tensor
<T> Concatenate<T>(params scoped ReadOnlySpan<
Tensor
<T>> tensors)
282
public static
Tensor
<T> ConcatenateOnDimension<T>(int dimension, params scoped ReadOnlySpan<
Tensor
<T>> tensors)
316
Tensor
<T> tensor;
338
public static ref readonly TensorSpan<T> Concatenate<T>(scoped ReadOnlySpan<
Tensor
<T>> tensors, in TensorSpan<T> destination)
350
public static ref readonly TensorSpan<T> ConcatenateOnDimension<T>(int dimension, scoped ReadOnlySpan<
Tensor
<T>> tensors, in TensorSpan<T> destination)
453
public static
Tensor
<bool> Equals<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
456
Tensor
<bool> result;
534
public static
Tensor
<bool> Equals<T>(in ReadOnlyTensorSpan<T> x, T y)
537
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
757
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
783
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
814
/// 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"/>
819
/// <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
821
public static
Tensor
<bool> GreaterThan<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
824
Tensor
<bool> result;
842
/// 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"/>
848
/// <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
900
/// 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"/>
905
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
907
public static
Tensor
<bool> GreaterThan<T>(in ReadOnlyTensorSpan<T> x, T y)
910
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
917
/// 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"/>
923
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
960
/// 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"/>
965
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
967
public static
Tensor
<bool> GreaterThan<T>(T x, in ReadOnlyTensorSpan<T> y)
970
Tensor
<bool> result = Tensor.Create<bool>(y.Lengths, false);
977
/// 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"/>
983
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1023
/// 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"/>
1028
/// <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
1030
public static
Tensor
<bool> GreaterThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
1033
Tensor
<bool> result;
1051
/// 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"/>
1057
/// <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
1109
/// 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"/>
1114
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1116
public static
Tensor
<bool> GreaterThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, T y)
1119
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
1126
/// 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"/>
1132
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1169
/// 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"/>
1174
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1176
public static
Tensor
<bool> GreaterThanOrEqual<T>(T x, in ReadOnlyTensorSpan<T> y)
1179
Tensor
<bool> result = Tensor.Create<bool>(y.Lengths, false);
1186
/// 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"/>
1192
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/>
1726
/// 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"/>
1731
/// <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
1733
public static
Tensor
<bool> LessThan<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
1736
Tensor
<bool> result;
1754
/// 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"/>
1760
/// <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
1811
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
1812
/// 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"/>
1815
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
1817
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1819
public static
Tensor
<bool> LessThan<T>(in ReadOnlyTensorSpan<T> x, T y)
1822
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
1828
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
1829
/// 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"/>
1832
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
1835
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1871
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
1872
/// 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"/>
1875
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
1877
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1879
public static
Tensor
<bool> LessThan<T>(T x, in ReadOnlyTensorSpan<T> y)
1882
Tensor
<bool> result = Tensor.Create<bool>(y.Lengths, false);
1888
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
1889
/// 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"/>
1892
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
1895
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
1935
/// 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"/>
1940
/// <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
1942
public static
Tensor
<bool> LessThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
1945
Tensor
<bool> result;
1963
/// 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"/>
1969
/// <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
2020
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
2021
/// 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"/>
2024
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
2026
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2028
public static
Tensor
<bool> LessThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, T y)
2031
Tensor
<bool> result = Tensor.Create<bool>(x.Lengths, false);
2037
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
2038
/// 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"/>
2041
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
2044
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2080
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
2081
/// 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"/>
2084
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
2086
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2088
public static
Tensor
<bool> LessThanOrEqual<T>(T x, in ReadOnlyTensorSpan<T> y)
2091
Tensor
<bool> result = Tensor.Create<bool>(y.Lengths, false);
2097
/// Compares the elements of a <see cref="
Tensor
{T}"/> to see which elements are less than <paramref name="y"/>.
2098
/// 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"/>
2101
/// <param name="x"><see cref="
Tensor
{T}"/> to compare.</param>
2104
/// <returns><see cref="
Tensor
{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/>
2638
/// If <paramref name="tensor"/> is a 1D tensor, it will return <paramref name="tensor"/>. Otherwise it creates a new <see cref="
Tensor
{T}"/>
2641
/// <param name="tensor">Input <see cref="
Tensor
{T}"/></param>
2643
public static
Tensor
<T> PermuteDimensions<T>(this
Tensor
<T> tensor, params ReadOnlySpan<int> dimensions)
2653
Tensor
<T> outTensor;
2728
/// <param name="tensor"><see cref="
Tensor
{T}"/> you want to reshape.</param>
2730
public static
Tensor
<T> Reshape<T>(this
Tensor
<T> tensor, params ReadOnlySpan<nint> lengths)
2934
/// 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
2937
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
2939
public static
Tensor
<T> Resize<T>(
Tensor
<T> tensor, ReadOnlySpan<nint> lengths)
2943
Tensor
<T> output = new Tensor<T>(values, lengths, false);
2958
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
2960
public static void ResizeTo<T>(scoped in
Tensor
<T> tensor, in TensorSpan<T> destination)
3007
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3008
public static
Tensor
<T> Reverse<T>(in ReadOnlyTensorSpan<T> tensor)
3010
Tensor
<T> output = Tensor.Create<T>(tensor.Lengths);
3020
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3022
public static
Tensor
<T> ReverseDimension<T>(in ReadOnlyTensorSpan<T> tensor, int dimension)
3024
Tensor
<T> output = Tensor.Create<T>(tensor.Lengths);
3144
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3147
public static
Tensor
<T> SetSlice<T>(this
Tensor
<T> tensor, in ReadOnlyTensorSpan<T> values, params ReadOnlySpan<NRange> ranges)
3157
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3186
/// Split a <see cref="
Tensor
{T}"/> into <paramref name="splitCount"/> along the given <paramref name="dimension"/>. If the tensor cannot be split
3189
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3192
public static
Tensor
<T>[] Split<T>(scoped in ReadOnlyTensorSpan<T> tensor, int splitCount, nint dimension)
3197
Tensor
<T>[] outputs = new
Tensor
<T>[splitCount];
3266
/// <param name="tensor">The <see cref="
Tensor
{T}"/> to remove all dimensions of length 1.</param>
3267
public static
Tensor
<T> Squeeze<T>(this
Tensor
<T> tensor)
3276
/// <param name="tensor">The <see cref="
Tensor
{T}"/> to remove dimension of length 1.</param>
3278
public static
Tensor
<T> SqueezeDimension<T>(this
Tensor
<T> tensor, int dimension)
3434
/// Join multiple <see cref="
Tensor
{T}"/> along a new dimension that is added at position 0. All tensors must have the same shape.
3436
/// <param name="tensors">Input <see cref="
Tensor
{T}"/>.</param>
3437
public static
Tensor
<T> Stack<T>(params ReadOnlySpan<
Tensor
<T>> tensors)
3443
/// 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.
3445
/// <param name="tensors">Input <see cref="
Tensor
{T}"/>.</param>
3447
public static
Tensor
<T> StackAlongDimension<T>(int dimension, params ReadOnlySpan<
Tensor
<T>> tensors)
3461
Tensor
<T>[] outputs = new
Tensor
<T>[tensors.Length];
3470
/// Join multiple <see cref="
Tensor
{T}"/> along a new dimension that is added at position 0. All tensors must have the same shape.
3472
/// <param name="tensors">Input <see cref="
Tensor
{T}"/>.</param>
3474
public static ref readonly TensorSpan<T> Stack<T>(scoped in ReadOnlySpan<
Tensor
<T>> tensors, in TensorSpan<T> destination)
3480
/// 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.
3482
/// <param name="tensors">Input <see cref="
Tensor
{T}"/>.</param>
3485
public static ref readonly TensorSpan<T> StackAlongDimension<T>(scoped ReadOnlySpan<
Tensor
<T>> tensors, in TensorSpan<T> destination, int dimension)
3499
Tensor
<T>[] outputs = new
Tensor
<T>[tensors.Length];
3518
Tensor
<T> temp = CreateUninitialized<T>(x.Lengths);
3589
/// Creates a <see cref="string"/> representation of the <see cref="
Tensor
{T}"/>."/>
3594
public static string ToString<T>(this
Tensor
<T> tensor, params ReadOnlySpan<nint> maximumLengths) => ((ReadOnlyTensorSpan<T>)tensor).ToString(maximumLengths);
3602
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3603
public static
Tensor
<T> Transpose<T>(
Tensor
<T> tensor)
3624
/// <param name="tensor">Input <see cref="
Tensor
{T}"/>.</param>
3626
public static bool TryBroadcastTo<T>(this
Tensor
<T> tensor, in TensorSpan<T> destination)
3666
/// <param name="tensor">The <see cref="
Tensor
{T}"/> to add a dimension of length 1.</param>
3668
public static
Tensor
<T> Unsqueeze<T>(this
Tensor
<T> tensor, int dimension)
3778
/// Takes the absolute value of each element of the <see cref="
Tensor
{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3781
public static
Tensor
<T> Abs<T>(in ReadOnlyTensorSpan<T> x)
3784
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3803
/// Takes the inverse cosine of each element of the <see cref="
Tensor
{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3806
public static
Tensor
<T> Acos<T>(in ReadOnlyTensorSpan<T> x)
3809
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3815
/// Takes the inverse cosine of each element of the <see cref="
Tensor
{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3828
/// 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.
3831
public static
Tensor
<T> Acosh<T>(in ReadOnlyTensorSpan<T> x)
3834
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3853
/// 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.
3856
public static
Tensor
<T> AcosPi<T>(in ReadOnlyTensorSpan<T> x)
3859
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3878
/// 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.
3882
public static
Tensor
<T> Add<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
3885
Tensor
<T> output;
3900
/// Adds <paramref name="y"/> to each element of <paramref name="x"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3904
public static
Tensor
<T> Add<T>(in ReadOnlyTensorSpan<T> x, T y)
3907
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3939
/// Takes the inverse sin of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
3942
public static
Tensor
<T> Asin<T>(in ReadOnlyTensorSpan<T> x)
3945
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3964
/// 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.
3967
public static
Tensor
<T> Asinh<T>(in ReadOnlyTensorSpan<T> x)
3970
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
3989
/// 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.
3992
public static
Tensor
<T> AsinPi<T>(in ReadOnlyTensorSpan<T> x)
3995
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4014
/// Takes the arc tangent of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4017
public static
Tensor
<T> Atan<T>(in ReadOnlyTensorSpan<T> x)
4020
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4039
/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4043
public static
Tensor
<T> Atan2<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4046
Tensor
<T> output;
4073
/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4077
public static
Tensor
<T> Atan2<T>(in ReadOnlyTensorSpan<T> x, T y)
4080
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4099
/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4103
public static
Tensor
<T> Atan2<T>(T x, in ReadOnlyTensorSpan<T> y)
4106
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
4127
/// 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.
4131
public static
Tensor
<T> Atan2Pi<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4134
Tensor
<T> output;
4165
public static
Tensor
<T> Atan2Pi<T>(in ReadOnlyTensorSpan<T> x, T y)
4168
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4191
public static
Tensor
<T> Atan2Pi<T>(T x, in ReadOnlyTensorSpan<T> y)
4194
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
4216
/// 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.
4219
public static
Tensor
<T> Atanh<T>(in ReadOnlyTensorSpan<T> x)
4222
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4241
/// 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.
4244
public static
Tensor
<T> AtanPi<T>(in ReadOnlyTensorSpan<T> x)
4247
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4266
/// 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.
4270
public static
Tensor
<T> BitwiseAnd<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4273
Tensor
<T> output;
4300
/// 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.
4304
public static
Tensor
<T> BitwiseAnd<T>(in ReadOnlyTensorSpan<T> x, T y)
4307
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4328
/// 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.
4332
public static
Tensor
<T> BitwiseOr<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4335
Tensor
<T> output;
4362
/// 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.
4366
public static
Tensor
<T> BitwiseOr<T>(in ReadOnlyTensorSpan<T> x, T y)
4369
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4390
/// Computes the element-wise cube root of the input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4393
public static
Tensor
<T> Cbrt<T>(in ReadOnlyTensorSpan<T> x)
4396
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4415
/// Computes the element-wise ceiling of the input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4418
public static
Tensor
<T> Ceiling<T>(in ReadOnlyTensorSpan<T> x)
4421
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4444
public static
Tensor
<TTo> ConvertChecked<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source)
4448
Tensor
<TTo> output = Tensor.Create<TTo>(source.Lengths);
4474
public static
Tensor
<TTo> ConvertSaturating<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source)
4478
Tensor
<TTo> output = Tensor.Create<TTo>(source.Lengths);
4504
public static
Tensor
<TTo> ConvertTruncating<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source)
4508
Tensor
<TTo> output = Tensor.Create<TTo>(source.Lengths);
4534
public static
Tensor
<T> CopySign<T>(in ReadOnlyTensorSpan<T> x, T sign)
4537
Tensor
<T> output = Create<T>(x.Lengths);
4544
/// 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.
4548
public static
Tensor
<T> CopySign<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> sign)
4551
Tensor
<T> output;
4592
/// Takes the cosine of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4595
public static
Tensor
<T> Cos<T>(in ReadOnlyTensorSpan<T> x)
4598
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4617
/// Takes the hyperbolic cosine of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4620
public static
Tensor
<T> Cosh<T>(in ReadOnlyTensorSpan<T> x)
4623
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4646
public static
Tensor
<T> CosineSimilarity<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4663
Tensor
<T> output = Tensor.Create<T>(values, [dim1, dim2]);
4723
/// <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>
4737
public static
Tensor
<T> CosPi<T>(in ReadOnlyTensorSpan<T> x)
4740
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4772
public static
Tensor
<T> DegreesToRadians<T>(in ReadOnlyTensorSpan<T> x)
4775
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4807
/// Divides each element of <paramref name="x"/> by <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
4811
public static
Tensor
<T> Divide<T>(in ReadOnlyTensorSpan<T> x, T y)
4814
Tensor
<T> output = Create<T>(x.Lengths);
4820
/// Divides <paramref name="x"/> by each element of <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result."/>
4824
public static
Tensor
<T> Divide<T>(T x, in ReadOnlyTensorSpan<T> y)
4827
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
4838
public static
Tensor
<T> Divide<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
4841
Tensor
<T> output;
4911
public static
Tensor
<T> Exp<T>(in ReadOnlyTensorSpan<T> x)
4914
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4936
public static
Tensor
<T> Exp10<T>(in ReadOnlyTensorSpan<T> x)
4939
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4959
public static
Tensor
<T> Exp10M1<T>(in ReadOnlyTensorSpan<T> x)
4962
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
4980
public static
Tensor
<T> Exp2<T>(in ReadOnlyTensorSpan<T> x)
4983
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5001
public static
Tensor
<T> Exp2M1<T>(in ReadOnlyTensorSpan<T> x)
5004
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5022
public static
Tensor
<T> ExpM1<T>(in ReadOnlyTensorSpan<T> x)
5025
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5043
public static
Tensor
<T> Floor<T>(in ReadOnlyTensorSpan<T> x)
5046
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5068
public static
Tensor
<T> Hypot<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5071
Tensor
<T> output;
5104
public static
Tensor
<T> Ieee754Remainder<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5107
Tensor
<T> output;
5135
public static
Tensor
<T> Ieee754Remainder<T>(in ReadOnlyTensorSpan<T> x, T y)
5138
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5157
public static
Tensor
<T> Ieee754Remainder<T>(T x, in ReadOnlyTensorSpan<T> y)
5160
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
5180
public static
Tensor
<int> ILogB<T>(in ReadOnlyTensorSpan<T> x)
5183
Tensor
<int> output = Tensor.Create<int>(x.Lengths, x.Strides);
5249
public static
Tensor
<T> LeadingZeroCount<T>(in ReadOnlyTensorSpan<T> x)
5252
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5271
/// Takes the natural logarithm of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5274
public static
Tensor
<T> Log<T>(in ReadOnlyTensorSpan<T> x)
5277
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5296
public static
Tensor
<T> Log<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5299
Tensor
<T> output;
5326
public static
Tensor
<T> Log<T>(in ReadOnlyTensorSpan<T> x, T y)
5329
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5348
/// 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.
5351
public static
Tensor
<T> Log10<T>(in ReadOnlyTensorSpan<T> x)
5354
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5373
/// 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.
5376
public static
Tensor
<T> Log10P1<T>(in ReadOnlyTensorSpan<T> x)
5379
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5398
/// 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.
5401
public static
Tensor
<T> Log2<T>(in ReadOnlyTensorSpan<T> x)
5404
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5423
/// 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.
5426
public static
Tensor
<T> Log2P1<T>(in ReadOnlyTensorSpan<T> x)
5429
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5448
/// 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.
5451
public static
Tensor
<T> LogP1<T>(in ReadOnlyTensorSpan<T> x)
5454
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5483
public static
Tensor
<T> Max<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5486
Tensor
<T> output;
5513
public static
Tensor
<T> Max<T>(in ReadOnlyTensorSpan<T> x, T y)
5516
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5544
public static
Tensor
<T> MaxMagnitude<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5547
Tensor
<T> output;
5574
public static
Tensor
<T> MaxMagnitude<T>(in ReadOnlyTensorSpan<T> x, T y)
5577
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5605
public static
Tensor
<T> MaxMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5608
Tensor
<T> output;
5635
public static
Tensor
<T> MaxMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, T y)
5638
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5666
public static
Tensor
<T> MaxNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5669
Tensor
<T> output;
5696
public static
Tensor
<T> MaxNumber<T>(in ReadOnlyTensorSpan<T> x, T y)
5699
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5727
public static
Tensor
<T> Min<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5730
Tensor
<T> output;
5757
public static
Tensor
<T> Min<T>(in ReadOnlyTensorSpan<T> x, T y)
5760
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5788
public static
Tensor
<T> MinMagnitude<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5791
Tensor
<T> output;
5818
public static
Tensor
<T> MinMagnitude<T>(in ReadOnlyTensorSpan<T> x, T y)
5821
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5849
public static
Tensor
<T> MinMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5852
Tensor
<T> output;
5879
public static
Tensor
<T> MinMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, T y)
5882
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5910
public static
Tensor
<T> MinNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5913
Tensor
<T> output;
5940
public static
Tensor
<T> MinNumber<T>(in ReadOnlyTensorSpan<T> x, T y)
5943
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5961
/// Multiplies each element of <paramref name="x"/> with <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5965
public static
Tensor
<T> Multiply<T>(in ReadOnlyTensorSpan<T> x, T y)
5968
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
5974
/// Multiplies each element of <paramref name="x"/> with <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
5979
public static
Tensor
<T> Multiply<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
5982
Tensor
<T> output;
6028
public static
Tensor
<T> Negate<T>(in ReadOnlyTensorSpan<T> x)
6031
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6061
public static
Tensor
<T> OnesComplement<T>(in ReadOnlyTensorSpan<T> x)
6064
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6082
public static
Tensor
<T> PopCount<T>(in ReadOnlyTensorSpan<T> x)
6085
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6104
public static
Tensor
<T> Pow<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
6107
Tensor
<T> output;
6134
public static
Tensor
<T> Pow<T>(in ReadOnlyTensorSpan<T> x, T y)
6137
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6156
public static
Tensor
<T> Pow<T>(T x, in ReadOnlyTensorSpan<T> y)
6159
Tensor
<T> output = Tensor.Create<T>(y.Lengths);
6189
public static
Tensor
<T> RadiansToDegrees<T>(in ReadOnlyTensorSpan<T> x)
6192
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6210
public static
Tensor
<T> Reciprocal<T>(in ReadOnlyTensorSpan<T> x)
6213
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6232
public static
Tensor
<T> RootN<T>(in ReadOnlyTensorSpan<T> x, int n)
6235
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6262
public static
Tensor
<T> RotateLeft<T>(in ReadOnlyTensorSpan<T> x, int rotateAmount)
6265
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6293
public static
Tensor
<T> RotateRight<T>(in ReadOnlyTensorSpan<T> x, int rotateAmount)
6296
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6322
public static
Tensor
<T> Round<T>(in ReadOnlyTensorSpan<T> x)
6325
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6343
public static
Tensor
<T> Round<T>(in ReadOnlyTensorSpan<T> x, int digits, MidpointRounding mode)
6346
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6371
public static
Tensor
<T> Round<T>(in ReadOnlyTensorSpan<T> x, int digits)
6374
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6398
public static
Tensor
<T> Round<T>(in ReadOnlyTensorSpan<T> x, MidpointRounding mode)
6401
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6426
public static
Tensor
<T> Sigmoid<T>(in ReadOnlyTensorSpan<T> x)
6429
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6446
/// Takes the sin of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6449
public static
Tensor
<T> Sin<T>(in ReadOnlyTensorSpan<T> x)
6452
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6472
public static
Tensor
<T> Sinh<T>(in ReadOnlyTensorSpan<T> x)
6475
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6493
public static
Tensor
<T> SinPi<T>(in ReadOnlyTensorSpan<T> x)
6496
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6514
public static
Tensor
<T> SoftMax<T>(in ReadOnlyTensorSpan<T> x)
6517
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6534
/// Takes the square root of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6537
public static
Tensor
<T> Sqrt<T>(in ReadOnlyTensorSpan<T> x)
6540
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6559
/// Subtracts <paramref name="y"/> from each element of <paramref name="x"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6563
public static
Tensor
<T> Subtract<T>(in ReadOnlyTensorSpan<T> x, T y)
6566
Tensor
<T> output = Create<T>(x.Lengths);
6572
/// Subtracts each element of <paramref name="y"/> from <paramref name="x"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6576
public static
Tensor
<T> Subtract<T>(T x, in ReadOnlyTensorSpan<T> y)
6579
Tensor
<T> output = Create<T>(y.Lengths);
6585
/// Subtracts each element of <paramref name="x"/> from <paramref name="y"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6589
public static
Tensor
<T> Subtract<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
6592
Tensor
<T> output;
6672
public static
Tensor
<T> Tan<T>(in ReadOnlyTensorSpan<T> x)
6675
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6693
public static
Tensor
<T> Tanh<T>(in ReadOnlyTensorSpan<T> x)
6696
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6714
public static
Tensor
<T> TanPi<T>(in ReadOnlyTensorSpan<T> x)
6717
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6735
public static
Tensor
<T> TrailingZeroCount<T>(in ReadOnlyTensorSpan<T> x)
6738
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6756
public static
Tensor
<T> Truncate<T>(in ReadOnlyTensorSpan<T> x)
6759
Tensor
<T> output = Tensor.Create<T>(x.Lengths);
6778
public static
Tensor
<T> Xor<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y)
6781
Tensor
<T> output;
6806
/// Computes the element-wise Xor of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="
Tensor
{T}"/> with the result.
6810
public static
Tensor
<T> Xor<T>(in ReadOnlyTensorSpan<T> x, T y)
6813
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)