17 instantiations of Tensor
System.Numerics.Tensors (17)
System\Numerics\Tensors\netcore\Tensor.cs (13)
335=> new Tensor<T>(array); 340=> new Tensor<T>(array, lengths, strides: []); 345=> new Tensor<T>(array, lengths, strides); 350=> new Tensor<T>(array, start, lengths, strides); 357=> new Tensor<T>(lengths, strides: [], pinned); 362=> new Tensor<T>(lengths, strides, pinned); 373return new Tensor<T>(values, in shape); 1372outTensor = new Tensor<T>(tensor._values, tensor._start, newLengths, newStrides); 1453return new Tensor<T>(tensor._values, tensor._start, newLengths, strides); 1901outputs[i] = new Tensor<T>(values, newLengths, strides: []); 1972Tensor<T> output = new Tensor<T>(tensor._values, tensor._start, lengths[..rank], strides[..rank]); 2363Tensor<T> output = new Tensor<T>(tensor._values, tensor._start, lengths, strides); 2444Tensor<T> output = new Tensor<T>(tensor._values, tensor._start, newLengths, newStrides);
System\Numerics\Tensors\netcore\Tensor_1.cs (4)
21public static Tensor<T> Empty { get; } = new(); 222return new Tensor<T>( 237return new Tensor<T>( 252return new Tensor<T>(
437 references to Tensor
System.Numerics.Tensors (437)
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs (1)
527Tensor<T> tmp = Tensor.CreateFromShape<T>(Lengths, IsPinned);
System\Numerics\Tensors\netcore\Tensor.cs (390)
51/// 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. 53/// <param name="source">Input <see cref="Tensor{T}"/>.</param> 54/// <param name="lengthsSource">Other <see cref="Tensor{T}"/> to make shapes broadcastable.</param> 55public static Tensor<T> Broadcast<T>(scoped in ReadOnlyTensorSpan<T> source, scoped in ReadOnlyTensorSpan<T> lengthsSource) 61/// 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. 64/// <param name="source">Input <see cref="Tensor{T}"/>.</param> 67public static Tensor<T> Broadcast<T>(scoped in ReadOnlyTensorSpan<T> source, scoped ReadOnlySpan<nint> lengths) 70Tensor<T> destination = CreateFromShapeUninitialized<T>(lengths); 82public static void BroadcastTo<T>(this Tensor<T> source, in TensorSpan<T> destination) 116public static Tensor<T> Concatenate<T>(params scoped ReadOnlySpan<Tensor<T>> tensors) 126public static Tensor<T> ConcatenateOnDimension<T>(int dimension, params scoped ReadOnlySpan<Tensor<T>> tensors) 134Tensor<T> tensor; 187public static ref readonly TensorSpan<T> Concatenate<T>(scoped ReadOnlySpan<Tensor<T>> tensors, in TensorSpan<T> destination) 199public static ref readonly TensorSpan<T> ConcatenateOnDimension<T>(int dimension, scoped ReadOnlySpan<Tensor<T>> tensors, in TensorSpan<T> destination) 279private static void ConcatenateOnDimensionToSpan<T>(int dimension, scoped ReadOnlySpan<Tensor<T>> tensors, in TensorSpan<T> destination, Span<T> dstSpan) 306Tensor<T> slice = tensors[i].Slice(ranges); 334public static Tensor<T> Create<T>(T[] array) 339public static Tensor<T> Create<T>(T[] array, scoped ReadOnlySpan<nint> lengths) 344public static Tensor<T> Create<T>(T[] array, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 349public static Tensor<T> Create<T>(T[] array, int start, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 356public static Tensor<T> CreateFromShape<T>(scoped ReadOnlySpan<nint> lengths, bool pinned = false) 361public static Tensor<T> CreateFromShape<T>(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned = false) 365public static Tensor<T> CreateFromShapeUninitialized<T>(scoped ReadOnlySpan<nint> lengths, bool pinned = false) 369public static Tensor<T> CreateFromShapeUninitialized<T>(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned = false) 458public static Tensor<bool> Equals<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 461TensorOperation.ValidateCompatibility(x, y, out Tensor<bool> destination); 489public static Tensor<bool> Equals<T>(in ReadOnlyTensorSpan<T> x, T y) 492Tensor<bool> destination = CreateFromShapeUninitialized<bool>(x.Lengths); 578/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 592/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 607/// 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"/> 612/// <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 614public static Tensor<bool> GreaterThan<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 617TensorOperation.ValidateCompatibility(x, y, out Tensor<bool> destination); 625/// 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"/> 631/// <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 643/// 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"/> 648/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 650public static Tensor<bool> GreaterThan<T>(in ReadOnlyTensorSpan<T> x, T y) 653Tensor<bool> destination = CreateFromShape<bool>(x.Lengths, false); 660/// 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"/> 666/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 678/// 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"/> 683/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 685public static Tensor<bool> GreaterThan<T>(T x, in ReadOnlyTensorSpan<T> y) 690/// 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"/> 696/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 788/// 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"/> 793/// <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 795public static Tensor<bool> GreaterThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 798TensorOperation.ValidateCompatibility(x, y, out Tensor<bool> destination); 806/// 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"/> 812/// <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 824/// 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"/> 829/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 831public static Tensor<bool> GreaterThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, T y) 834Tensor<bool> destination = CreateFromShape<bool>(x.Lengths, false); 841/// 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"/> 847/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 859/// 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"/> 864/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 866public static Tensor<bool> GreaterThanOrEqual<T>(T x, in ReadOnlyTensorSpan<T> y) 871/// 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"/> 877/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 969/// 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"/> 974/// <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 976public static Tensor<bool> LessThan<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 979TensorOperation.ValidateCompatibility(x, y, out Tensor<bool> destination); 987/// 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"/> 993/// <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 1004/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 1005/// 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"/> 1008/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 1010/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 1012public static Tensor<bool> LessThan<T>(in ReadOnlyTensorSpan<T> x, T y) 1015Tensor<bool> destination = CreateFromShape<bool>(x.Lengths, false); 1021/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 1022/// 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"/> 1025/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 1028/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 1039/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 1040/// 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"/> 1043/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 1045/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 1047public static Tensor<bool> LessThan<T>(T x, in ReadOnlyTensorSpan<T> y) 1051/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 1052/// 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"/> 1055/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 1058/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 1150/// 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"/> 1155/// <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 1157public static Tensor<bool> LessThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 1160TensorOperation.ValidateCompatibility(x, y, out Tensor<bool> destination); 1168/// 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"/> 1174/// <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 1185/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 1186/// 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"/> 1189/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 1191/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 1193public static Tensor<bool> LessThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, T y) 1196Tensor<bool> destination = CreateFromShape<bool>(x.Lengths, false); 1202/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 1203/// 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"/> 1206/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 1209/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 1220/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 1221/// 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"/> 1224/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 1226/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 1228public static Tensor<bool> LessThanOrEqual<T>(T x, in ReadOnlyTensorSpan<T> y) 1232/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 1233/// 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"/> 1236/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 1239/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 1331/// If <paramref name="tensor"/> is a 1D tensor, it will return <paramref name="tensor"/>. Otherwise it creates a new <see cref="Tensor{T}"/> 1334/// <param name="tensor">Input <see cref="Tensor{T}"/></param> 1336public static Tensor<T> PermuteDimensions<T>(this Tensor<T> tensor, ReadOnlySpan<int> dimensions) 1350Tensor<T> outTensor; 1388/// <param name="tensor"><see cref="Tensor{T}"/> you want to reshape.</param> 1390public static Tensor<T> Reshape<T>(this Tensor<T> tensor, ReadOnlySpan<nint> lengths) 1610/// 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 1613/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1615public static Tensor<T> Resize<T>(Tensor<T> tensor, ReadOnlySpan<nint> lengths) 1619Tensor<T> output = Create(values, lengths, []); 1655/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1657public static void ResizeTo<T>(scoped in Tensor<T> tensor, in TensorSpan<T> destination) 1715/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1716public static Tensor<T> Reverse<T>(in ReadOnlyTensorSpan<T> tensor) 1718Tensor<T> output = CreateFromShape<T>(tensor.Lengths); 1728/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1730public static Tensor<T> ReverseDimension<T>(in ReadOnlyTensorSpan<T> tensor, int dimension) 1732Tensor<T> output = CreateFromShape<T>(tensor.Lengths); 1839/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1842public static Tensor<T> SetSlice<T>(this Tensor<T> tensor, in ReadOnlyTensorSpan<T> values, params ReadOnlySpan<NRange> ranges) 1851/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1870/// Split a <see cref="Tensor{T}"/> into <paramref name="splitCount"/> along the given <paramref name="dimension"/>. If the tensor cannot be split 1873/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1876public static Tensor<T>[] Split<T>(scoped in ReadOnlyTensorSpan<T> tensor, int splitCount, nint dimension) 1883Tensor<T>[] outputs = new Tensor<T>[splitCount]; 1916/// <param name="tensor">The <see cref="Tensor{T}"/> to remove all dimensions of length 1.</param> 1917public static Tensor<T> Squeeze<T>(this Tensor<T> tensor) 1926/// <param name="tensor">The <see cref="Tensor{T}"/> to remove dimension of length 1.</param> 1928public static Tensor<T> SqueezeDimension<T>(this Tensor<T> tensor, int dimension) 1972Tensor<T> output = new Tensor<T>(tensor._values, tensor._start, lengths[..rank], strides[..rank]); 2117/// Join multiple <see cref="Tensor{T}"/> along a new dimension that is added at position 0. All tensors must have the same shape. 2119/// <param name="tensors">Input <see cref="Tensor{T}"/>.</param> 2120public static Tensor<T> Stack<T>(params ReadOnlySpan<Tensor<T>> tensors) 2126/// 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. 2128/// <param name="tensors">Input <see cref="Tensor{T}"/>.</param> 2130public static Tensor<T> StackAlongDimension<T>(int dimension, params ReadOnlySpan<Tensor<T>> tensors) 2146Tensor<T>[] outputs = new Tensor<T>[tensors.Length]; 2155/// Join multiple <see cref="Tensor{T}"/> along a new dimension that is added at position 0. All tensors must have the same shape. 2157/// <param name="tensors">Input <see cref="Tensor{T}"/>.</param> 2159public static ref readonly TensorSpan<T> Stack<T>(scoped in ReadOnlySpan<Tensor<T>> tensors, in TensorSpan<T> destination) 2165/// 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. 2167/// <param name="tensors">Input <see cref="Tensor{T}"/>.</param> 2170public static ref readonly TensorSpan<T> StackAlongDimension<T>(scoped ReadOnlySpan<Tensor<T>> tensors, in TensorSpan<T> destination, int dimension) 2186Tensor<T>[] outputs = new Tensor<T>[tensors.Length]; 2343/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 2344public static Tensor<T> Transpose<T>(Tensor<T> tensor) 2363Tensor<T> output = new Tensor<T>(tensor._values, tensor._start, lengths, strides); 2377/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 2379public static bool TryBroadcastTo<T>(this Tensor<T> tensor, in TensorSpan<T> destination) 2416/// <param name="tensor">The <see cref="Tensor{T}"/> to add a dimension of length 1.</param> 2418public static Tensor<T> Unsqueeze<T>(this Tensor<T> tensor, int dimension) 2444Tensor<T> output = new Tensor<T>(tensor._values, tensor._start, newLengths, newStrides); 2528/// Takes the absolute value of each element of the <see cref="Tensor{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2531public static Tensor<T> Abs<T>(in ReadOnlyTensorSpan<T> x) 2534Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2555/// Takes the inverse cosine of each element of the <see cref="Tensor{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2558public static Tensor<T> Acos<T>(in ReadOnlyTensorSpan<T> x) 2561Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2567/// Takes the inverse cosine of each element of the <see cref="Tensor{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2582/// 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. 2585public static Tensor<T> Acosh<T>(in ReadOnlyTensorSpan<T> x) 2588Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2609/// 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. 2612public static Tensor<T> AcosPi<T>(in ReadOnlyTensorSpan<T> x) 2615Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2636/// Takes the inverse sin of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2639public static Tensor<T> Asin<T>(in ReadOnlyTensorSpan<T> x) 2642Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2663/// 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. 2666public static Tensor<T> Asinh<T>(in ReadOnlyTensorSpan<T> x) 2669Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2690/// 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. 2693public static Tensor<T> AsinPi<T>(in ReadOnlyTensorSpan<T> x) 2696Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2717/// Takes the arc tangent of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2720public static Tensor<T> Atan<T>(in ReadOnlyTensorSpan<T> x) 2723Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2744/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2748public static Tensor<T> Atan2<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 2751Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2771/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2775public static Tensor<T> Atan2<T>(in ReadOnlyTensorSpan<T> x, T y) 2778Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2798/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2802public static Tensor<T> Atan2<T>(T x, in ReadOnlyTensorSpan<T> y) 2805Tensor<T> destination = CreateFromShapeUninitialized<T>(y.Lengths); 2827/// 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. 2831public static Tensor<T> Atan2Pi<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 2834Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2858public static Tensor<T> Atan2Pi<T>(in ReadOnlyTensorSpan<T> x, T y) 2861Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2885public static Tensor<T> Atan2Pi<T>(T x, in ReadOnlyTensorSpan<T> y) 2888Tensor<T> destination = CreateFromShapeUninitialized<T>(y.Lengths); 2910/// 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. 2913public static Tensor<T> Atanh<T>(in ReadOnlyTensorSpan<T> x) 2916Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2937/// 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. 2940public static Tensor<T> AtanPi<T>(in ReadOnlyTensorSpan<T> x) 2943Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2981/// Computes the element-wise cube root of the input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2984public static Tensor<T> Cbrt<T>(in ReadOnlyTensorSpan<T> x) 2987Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3008/// Computes the element-wise ceiling of the input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 3011public static Tensor<T> Ceiling<T>(in ReadOnlyTensorSpan<T> x) 3014Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3039public static Tensor<TTo> ConvertChecked<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source) 3043Tensor<TTo> destination = CreateFromShapeUninitialized<TTo>(source.Lengths); 3070public static Tensor<TTo> ConvertSaturating<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source) 3074Tensor<TTo> destination = CreateFromShapeUninitialized<TTo>(source.Lengths); 3101public static Tensor<TTo> ConvertTruncating<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source) 3105Tensor<TTo> destination = CreateFromShapeUninitialized<TTo>(source.Lengths); 3132public static Tensor<T> CopySign<T>(in ReadOnlyTensorSpan<T> x, T sign) 3135Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3141/// 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. 3145public static Tensor<T> CopySign<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> sign) 3148Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3184/// Takes the cosine of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 3187public static Tensor<T> Cos<T>(in ReadOnlyTensorSpan<T> x) 3190Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3211/// Takes the hyperbolic cosine of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 3214public static Tensor<T> Cosh<T>(in ReadOnlyTensorSpan<T> x) 3217Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3253/// <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> 3267public static Tensor<T> CosPi<T>(in ReadOnlyTensorSpan<T> x) 3270Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3304public static Tensor<T> DegreesToRadians<T>(in ReadOnlyTensorSpan<T> x) 3307Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3363public static Tensor<T> Exp<T>(in ReadOnlyTensorSpan<T> x) 3366Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3390public static Tensor<T> Exp10<T>(in ReadOnlyTensorSpan<T> x) 3393Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3415public static Tensor<T> Exp10M1<T>(in ReadOnlyTensorSpan<T> x) 3418Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3438public static Tensor<T> Exp2<T>(in ReadOnlyTensorSpan<T> x) 3441Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3461public static Tensor<T> Exp2M1<T>(in ReadOnlyTensorSpan<T> x) 3464Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3484public static Tensor<T> ExpM1<T>(in ReadOnlyTensorSpan<T> x) 3487Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3507public static Tensor<T> Floor<T>(in ReadOnlyTensorSpan<T> x) 3510Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3534public static Tensor<T> Hypot<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 3537TensorOperation.ValidateCompatibility(x, y, out Tensor<T> destination); 3563public static Tensor<T> Ieee754Remainder<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 3566TensorOperation.ValidateCompatibility(x, y, out Tensor<T> destination); 3587public static Tensor<T> Ieee754Remainder<T>(in ReadOnlyTensorSpan<T> x, T y) 3590Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3610public static Tensor<T> Ieee754Remainder<T>(T x, in ReadOnlyTensorSpan<T> y) 3613Tensor<T> destination = CreateFromShapeUninitialized<T>(y.Lengths); 3634public static Tensor<int> ILogB<T>(in ReadOnlyTensorSpan<T> x) 3637Tensor<int> destination = CreateFromShapeUninitialized<int>(x.Lengths); 3786public static Tensor<T> LeadingZeroCount<T>(in ReadOnlyTensorSpan<T> x) 3789Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3810/// Takes the natural logarithm of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 3813public static Tensor<T> Log<T>(in ReadOnlyTensorSpan<T> x) 3816Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3837public static Tensor<T> Log<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 3840TensorOperation.ValidateCompatibility(x, y, out Tensor<T> destination); 3860public static Tensor<T> Log<T>(in ReadOnlyTensorSpan<T> x, T y) 3863Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3883/// 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. 3886public static Tensor<T> Log10<T>(in ReadOnlyTensorSpan<T> x) 3889Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3910/// 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. 3913public static Tensor<T> Log10P1<T>(in ReadOnlyTensorSpan<T> x) 3916Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3937/// 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. 3940public static Tensor<T> Log2<T>(in ReadOnlyTensorSpan<T> x) 3943Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3964/// 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. 3967public static Tensor<T> Log2P1<T>(in ReadOnlyTensorSpan<T> x) 3970Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3991/// 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. 3994public static Tensor<T> LogP1<T>(in ReadOnlyTensorSpan<T> x) 3997Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4035public static Tensor<T> Max<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4038TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> output); 4058public static Tensor<T> Max<T>(in ReadOnlyTensorSpan<T> x, T y) 4061Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4098public static Tensor<T> MaxMagnitude<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4101TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> destination); 4121public static Tensor<T> MaxMagnitude<T>(in ReadOnlyTensorSpan<T> x, T y) 4124Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4161public static Tensor<T> MaxMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4164TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> destination); 4184public static Tensor<T> MaxMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, T y) 4187Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4224public static Tensor<T> MaxNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4227TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> destination); 4247public static Tensor<T> MaxNumber<T>(in ReadOnlyTensorSpan<T> x, T y) 4250Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4287public static Tensor<T> Min<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4290TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> output); 4310public static Tensor<T> Min<T>(in ReadOnlyTensorSpan<T> x, T y) 4313Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4350public static Tensor<T> MinMagnitude<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4353TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> destination); 4373public static Tensor<T> MinMagnitude<T>(in ReadOnlyTensorSpan<T> x, T y) 4376Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4413public static Tensor<T> MinMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4416TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> destination); 4436public static Tensor<T> MinMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, T y) 4439Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4476public static Tensor<T> MinNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4479TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> destination); 4499public static Tensor<T> MinNumber<T>(in ReadOnlyTensorSpan<T> x, T y) 4502Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4537public static Tensor<T> PopCount<T>(in ReadOnlyTensorSpan<T> x) 4540Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4561public static Tensor<T> Pow<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4564TensorOperation.ValidateCompatibility(x, y, out Tensor<T> destination); 4584public static Tensor<T> Pow<T>(in ReadOnlyTensorSpan<T> x, T y) 4587Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4607public static Tensor<T> Pow<T>(T x, in ReadOnlyTensorSpan<T> y) 4610Tensor<T> destination = CreateFromShapeUninitialized<T>(y.Lengths); 4643public static Tensor<T> RadiansToDegrees<T>(in ReadOnlyTensorSpan<T> x) 4646Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4666public static Tensor<T> Reciprocal<T>(in ReadOnlyTensorSpan<T> x) 4669Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4690public static Tensor<T> RootN<T>(in ReadOnlyTensorSpan<T> x, int n) 4693Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4716public static Tensor<T> RotateLeft<T>(in ReadOnlyTensorSpan<T> x, int rotateAmount) 4719Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4743public static Tensor<T> RotateRight<T>(in ReadOnlyTensorSpan<T> x, int rotateAmount) 4746Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4768public static Tensor<T> Round<T>(in ReadOnlyTensorSpan<T> x) 4771Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4791public static Tensor<T> Round<T>(in ReadOnlyTensorSpan<T> x, int digits, MidpointRounding mode) 4794Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4815public static Tensor<T> Round<T>(in ReadOnlyTensorSpan<T> x, int digits) 4818Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4838public static Tensor<T> Round<T>(in ReadOnlyTensorSpan<T> x, MidpointRounding mode) 4841Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4862public static Tensor<T> Sigmoid<T>(in ReadOnlyTensorSpan<T> x) 4865Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4884/// Takes the sin of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 4887public static Tensor<T> Sin<T>(in ReadOnlyTensorSpan<T> x) 4890Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4912public static Tensor<T> Sinh<T>(in ReadOnlyTensorSpan<T> x) 4915Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4935public static Tensor<T> SinPi<T>(in ReadOnlyTensorSpan<T> x) 4938Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4958public static Tensor<T> SoftMax<T>(in ReadOnlyTensorSpan<T> x) 4964Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4986/// Takes the square root of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 4989public static Tensor<T> Sqrt<T>(in ReadOnlyTensorSpan<T> x) 4992Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 5061public static Tensor<T> Tan<T>(in ReadOnlyTensorSpan<T> x) 5064Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 5084public static Tensor<T> Tanh<T>(in ReadOnlyTensorSpan<T> x) 5087Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 5107public static Tensor<T> TanPi<T>(in ReadOnlyTensorSpan<T> x) 5110Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 5130public static Tensor<T> TrailingZeroCount<T>(in ReadOnlyTensorSpan<T> x) 5133Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 5153public static Tensor<T> Truncate<T>(in ReadOnlyTensorSpan<T> x) 5156Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths);
System\Numerics\Tensors\netcore\Tensor.op_OnesComplement.cs (7)
12public static Tensor<T> OnesComplement<T>(in ReadOnlyTensorSpan<T> x) 15Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 41public static Tensor<TScalar> operator ~(in ReadOnlyTensorSpan<TScalar> tensor) => OnesComplement(tensor); 45extension<TScalar>(Tensor<TScalar>) 49public static Tensor<TScalar> operator ~(Tensor<TScalar> tensor) => OnesComplement<TScalar>(tensor); 57public static Tensor<TScalar> operator ~(in TensorSpan<TScalar> tensor) => OnesComplement<TScalar>(tensor);
System\Numerics\Tensors\netcore\Tensor.op_UnaryNegation.cs (7)
11public static Tensor<T> Negate<T>(in ReadOnlyTensorSpan<T> x) 14Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 39public static Tensor<TScalar> operator -(in ReadOnlyTensorSpan<TScalar> tensor) => Negate(tensor); 43extension<TScalar>(Tensor<TScalar>) 47public static Tensor<TScalar> operator -(Tensor<TScalar> tensor) => Negate<TScalar>(tensor); 55public static Tensor<TScalar> operator -(in TensorSpan<TScalar> tensor) => Negate<TScalar>(tensor);
System\Numerics\Tensors\netcore\Tensor.op_UnaryPlus.cs (3)
19extension<TScalar>(Tensor<TScalar>) 23public static Tensor<TScalar> operator +(Tensor<TScalar> tensor) => tensor;
System\Numerics\Tensors\netcore\Tensor_1.cs (27)
18public sealed class Tensor<T> : ITensor<Tensor<T>, T>, IEnumerable<T> 21public static Tensor<T> Empty { get; } = new(); 93public Tensor<T> this[params ReadOnlySpan<NRange> ranges] 126public static implicit operator Tensor<T>(T[] array) => Tensor.Create(array); 131public static implicit operator TensorSpan<T>(Tensor<T> tensor) => tensor.AsTensorSpan(); 134public static implicit operator ReadOnlyTensorSpan<T>(Tensor<T> tensor) => tensor.AsReadOnlyTensorSpan(); 215public Tensor<T> Slice(params ReadOnlySpan<nint> startIndexes) 230public Tensor<T> Slice(params ReadOnlySpan<NIndex> startIndexes) 245public Tensor<T> Slice(params ReadOnlySpan<NRange> ranges) 260public Tensor<T> ToDenseTensor() 262Tensor<T> result = this; 321ref readonly T IReadOnlyTensor<Tensor<T>, T>.this[params ReadOnlySpan<nint> indexes] => ref this[indexes]; 323ref readonly T IReadOnlyTensor<Tensor<T>, T>.this[params ReadOnlySpan<NIndex> indexes] => ref this[indexes]; 325ReadOnlyTensorDimensionSpan<T> IReadOnlyTensor<Tensor<T>, T>.GetDimensionSpan(int dimension) => AsReadOnlyTensorSpan().GetDimensionSpan(dimension); 327ref readonly T IReadOnlyTensor<Tensor<T>, T>.GetPinnableReference() => ref GetPinnableReference(); 329ReadOnlySpan<T> IReadOnlyTensor<Tensor<T>, T>.GetSpan(scoped ReadOnlySpan<nint> startIndexes, int length) => AsReadOnlyTensorSpan().GetSpan(startIndexes, length); 331ReadOnlySpan<T> IReadOnlyTensor<Tensor<T>, T>.GetSpan(scoped ReadOnlySpan<NIndex> startIndexes, int length) => AsReadOnlyTensorSpan().GetSpan(startIndexes, length); 365static Tensor<T> ITensor<Tensor<T>, T>.CreateFromShape(scoped ReadOnlySpan<nint> lengths, bool pinned) => Tensor.CreateFromShape<T>(lengths, pinned); 367static Tensor<T> ITensor<Tensor<T>, T>.CreateFromShape(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned) => Tensor.CreateFromShape<T>(lengths, strides, pinned); 369static Tensor<T> ITensor<Tensor<T>, T>.CreateFromShapeUninitialized(scoped ReadOnlySpan<nint> lengths, bool pinned) => Tensor.CreateFromShapeUninitialized<T>(lengths, pinned); 371static Tensor<T> ITensor<Tensor<T>, T>.CreateFromShapeUninitialized(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned) => Tensor.CreateFromShapeUninitialized<T>(lengths, strides, pinned); 376private readonly Tensor<T> _tensor; 381internal Enumerator(Tensor<T> tensor)
System\Numerics\Tensors\netcore\TensorOperation.cs (1)
359public static void ValidateCompatibility<TArg, TResult>(in ReadOnlyTensorSpan<TArg> x, in ReadOnlyTensorSpan<TArg> y, out Tensor<TResult> destination)
System\Runtime\InteropServices\TensorMarshal.cs (1)
9/// <summary>Provides methods to interoperate with <see cref="Tensor{T}" />, <see cref="TensorSpan{T}" />, and <see cref="ReadOnlyTensorSpan{T}" />.</summary>