17 instantiations of Tensor
System.Numerics.Tensors (17)
System\Numerics\Tensors\netcore\Tensor.cs (13)
297=> new Tensor<T>(array); 302=> new Tensor<T>(array, lengths, strides: []); 307=> new Tensor<T>(array, lengths, strides); 312=> new Tensor<T>(array, start, lengths, strides); 319=> new Tensor<T>(lengths, strides: [], pinned); 324=> new Tensor<T>(lengths, strides, pinned); 335return new Tensor<T>(values, in shape); 1304outTensor = new Tensor<T>(tensor._values, tensor._start, newLengths, newStrides); 1385return new Tensor<T>(tensor._values, tensor._start, lengths, strides); 1772outputs[i] = new Tensor<T>(values, newLengths, strides: []); 1843Tensor<T> output = new Tensor<T>(tensor._values, tensor._start, lengths[..rank], strides[..rank]); 2234Tensor<T> output = new Tensor<T>(tensor._values, tensor._start, lengths, strides); 2315Tensor<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>(
436 references to Tensor
System.Numerics.Tensors (436)
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs (1)
531Tensor<T> tmp = Tensor.CreateFromShape<T>(Lengths, IsPinned);
System\Numerics\Tensors\netcore\Tensor.cs (389)
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) 267Tensor<T> slice = tensors[i].Slice(ranges); 296public static Tensor<T> Create<T>(T[] array) 301public static Tensor<T> Create<T>(T[] array, scoped ReadOnlySpan<nint> lengths) 306public static Tensor<T> Create<T>(T[] array, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 311public static Tensor<T> Create<T>(T[] array, int start, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 318public static Tensor<T> CreateFromShape<T>(scoped ReadOnlySpan<nint> lengths, bool pinned = false) 323public static Tensor<T> CreateFromShape<T>(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned = false) 327public static Tensor<T> CreateFromShapeUninitialized<T>(scoped ReadOnlySpan<nint> lengths, bool pinned = false) 331public static Tensor<T> CreateFromShapeUninitialized<T>(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned = false) 390public static Tensor<bool> Equals<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 393TensorOperation.ValidateCompatibility(x, y, out Tensor<bool> destination); 421public static Tensor<bool> Equals<T>(in ReadOnlyTensorSpan<T> x, T y) 424Tensor<bool> destination = CreateFromShapeUninitialized<bool>(x.Lengths); 510/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 524/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 539/// 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"/> 544/// <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 546public static Tensor<bool> GreaterThan<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 549TensorOperation.ValidateCompatibility(x, y, out Tensor<bool> destination); 557/// 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"/> 563/// <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 575/// 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"/> 580/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 582public static Tensor<bool> GreaterThan<T>(in ReadOnlyTensorSpan<T> x, T y) 585Tensor<bool> destination = CreateFromShape<bool>(x.Lengths, false); 592/// 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"/> 598/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 610/// 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"/> 615/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 617public static Tensor<bool> GreaterThan<T>(T x, in ReadOnlyTensorSpan<T> y) 622/// 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"/> 628/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 720/// 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"/> 725/// <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 727public static Tensor<bool> GreaterThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 730TensorOperation.ValidateCompatibility(x, y, out Tensor<bool> destination); 738/// 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"/> 744/// <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 756/// 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"/> 761/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 763public static Tensor<bool> GreaterThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, T y) 766Tensor<bool> destination = CreateFromShape<bool>(x.Lengths, false); 773/// 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"/> 779/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 791/// 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"/> 796/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 798public static Tensor<bool> GreaterThanOrEqual<T>(T x, in ReadOnlyTensorSpan<T> y) 803/// 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"/> 809/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are greater than <paramref name="y"/> 901/// 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"/> 906/// <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 908public static Tensor<bool> LessThan<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 911TensorOperation.ValidateCompatibility(x, y, out Tensor<bool> destination); 919/// 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"/> 925/// <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 936/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 937/// 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"/> 940/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 942/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 944public static Tensor<bool> LessThan<T>(in ReadOnlyTensorSpan<T> x, T y) 947Tensor<bool> destination = CreateFromShape<bool>(x.Lengths, false); 953/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 954/// 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"/> 957/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 960/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 971/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 972/// 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"/> 975/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 977/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 979public static Tensor<bool> LessThan<T>(T x, in ReadOnlyTensorSpan<T> y) 983/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 984/// 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"/> 987/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 990/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 1082/// 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"/> 1087/// <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 1089public static Tensor<bool> LessThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 1092TensorOperation.ValidateCompatibility(x, y, out Tensor<bool> destination); 1100/// 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"/> 1106/// <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 1117/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 1118/// 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"/> 1121/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 1123/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 1125public static Tensor<bool> LessThanOrEqual<T>(in ReadOnlyTensorSpan<T> x, T y) 1128Tensor<bool> destination = CreateFromShape<bool>(x.Lengths, false); 1134/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 1135/// 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"/> 1138/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 1141/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 1152/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 1153/// 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"/> 1156/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 1158/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 1160public static Tensor<bool> LessThanOrEqual<T>(T x, in ReadOnlyTensorSpan<T> y) 1164/// Compares the elements of a <see cref="Tensor{T}"/> to see which elements are less than <paramref name="y"/>. 1165/// 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"/> 1168/// <param name="x"><see cref="Tensor{T}"/> to compare.</param> 1171/// <returns><see cref="Tensor{Boolean}"/> where the value is true if the elements in <paramref name="x"/> are less than <paramref name="y"/> 1263/// If <paramref name="tensor"/> is a 1D tensor, it will return <paramref name="tensor"/>. Otherwise it creates a new <see cref="Tensor{T}"/> 1266/// <param name="tensor">Input <see cref="Tensor{T}"/></param> 1268public static Tensor<T> PermuteDimensions<T>(this Tensor<T> tensor, ReadOnlySpan<int> dimensions) 1282Tensor<T> outTensor; 1320/// <param name="tensor"><see cref="Tensor{T}"/> you want to reshape.</param> 1322public static Tensor<T> Reshape<T>(this Tensor<T> tensor, ReadOnlySpan<nint> lengths) 1542/// 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 1545/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1547public static Tensor<T> Resize<T>(Tensor<T> tensor, ReadOnlySpan<nint> lengths) 1551Tensor<T> output = Create(values, lengths, []); 1566/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1568public static void ResizeTo<T>(scoped in Tensor<T> tensor, in TensorSpan<T> destination) 1605/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1606public static Tensor<T> Reverse<T>(in ReadOnlyTensorSpan<T> tensor) 1608Tensor<T> output = CreateFromShape<T>(tensor.Lengths); 1618/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1620public static Tensor<T> ReverseDimension<T>(in ReadOnlyTensorSpan<T> tensor, int dimension) 1622Tensor<T> output = CreateFromShape<T>(tensor.Lengths); 1710/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1713public static Tensor<T> SetSlice<T>(this Tensor<T> tensor, in ReadOnlyTensorSpan<T> values, params ReadOnlySpan<NRange> ranges) 1722/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1741/// Split a <see cref="Tensor{T}"/> into <paramref name="splitCount"/> along the given <paramref name="dimension"/>. If the tensor cannot be split 1744/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 1747public static Tensor<T>[] Split<T>(scoped in ReadOnlyTensorSpan<T> tensor, int splitCount, nint dimension) 1754Tensor<T>[] outputs = new Tensor<T>[splitCount]; 1787/// <param name="tensor">The <see cref="Tensor{T}"/> to remove all dimensions of length 1.</param> 1788public static Tensor<T> Squeeze<T>(this Tensor<T> tensor) 1797/// <param name="tensor">The <see cref="Tensor{T}"/> to remove dimension of length 1.</param> 1799public static Tensor<T> SqueezeDimension<T>(this Tensor<T> tensor, int dimension) 1843Tensor<T> output = new Tensor<T>(tensor._values, tensor._start, lengths[..rank], strides[..rank]); 1988/// Join multiple <see cref="Tensor{T}"/> along a new dimension that is added at position 0. All tensors must have the same shape. 1990/// <param name="tensors">Input <see cref="Tensor{T}"/>.</param> 1991public static Tensor<T> Stack<T>(params ReadOnlySpan<Tensor<T>> tensors) 1997/// 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. 1999/// <param name="tensors">Input <see cref="Tensor{T}"/>.</param> 2001public static Tensor<T> StackAlongDimension<T>(int dimension, params ReadOnlySpan<Tensor<T>> tensors) 2017Tensor<T>[] outputs = new Tensor<T>[tensors.Length]; 2026/// Join multiple <see cref="Tensor{T}"/> along a new dimension that is added at position 0. All tensors must have the same shape. 2028/// <param name="tensors">Input <see cref="Tensor{T}"/>.</param> 2030public static ref readonly TensorSpan<T> Stack<T>(scoped in ReadOnlySpan<Tensor<T>> tensors, in TensorSpan<T> destination) 2036/// 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. 2038/// <param name="tensors">Input <see cref="Tensor{T}"/>.</param> 2041public static ref readonly TensorSpan<T> StackAlongDimension<T>(scoped ReadOnlySpan<Tensor<T>> tensors, in TensorSpan<T> destination, int dimension) 2057Tensor<T>[] outputs = new Tensor<T>[tensors.Length]; 2214/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 2215public static Tensor<T> Transpose<T>(Tensor<T> tensor) 2234Tensor<T> output = new Tensor<T>(tensor._values, tensor._start, lengths, strides); 2248/// <param name="tensor">Input <see cref="Tensor{T}"/>.</param> 2250public static bool TryBroadcastTo<T>(this Tensor<T> tensor, in TensorSpan<T> destination) 2287/// <param name="tensor">The <see cref="Tensor{T}"/> to add a dimension of length 1.</param> 2289public static Tensor<T> Unsqueeze<T>(this Tensor<T> tensor, int dimension) 2315Tensor<T> output = new Tensor<T>(tensor._values, tensor._start, newLengths, newStrides); 2399/// Takes the absolute value of each element of the <see cref="Tensor{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2402public static Tensor<T> Abs<T>(in ReadOnlyTensorSpan<T> x) 2405Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2426/// Takes the inverse cosine of each element of the <see cref="Tensor{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2429public static Tensor<T> Acos<T>(in ReadOnlyTensorSpan<T> x) 2432Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2438/// Takes the inverse cosine of each element of the <see cref="Tensor{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2453/// 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. 2456public static Tensor<T> Acosh<T>(in ReadOnlyTensorSpan<T> x) 2459Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2480/// 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. 2483public static Tensor<T> AcosPi<T>(in ReadOnlyTensorSpan<T> x) 2486Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2507/// Takes the inverse sin of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2510public static Tensor<T> Asin<T>(in ReadOnlyTensorSpan<T> x) 2513Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2534/// 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. 2537public static Tensor<T> Asinh<T>(in ReadOnlyTensorSpan<T> x) 2540Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2561/// 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. 2564public static Tensor<T> AsinPi<T>(in ReadOnlyTensorSpan<T> x) 2567Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2588/// Takes the arc tangent of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2591public static Tensor<T> Atan<T>(in ReadOnlyTensorSpan<T> x) 2594Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2615/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2619public static Tensor<T> Atan2<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 2622Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2642/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2646public static Tensor<T> Atan2<T>(in ReadOnlyTensorSpan<T> x, T y) 2649Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2669/// Takes the arc tangent of the two input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2673public static Tensor<T> Atan2<T>(T x, in ReadOnlyTensorSpan<T> y) 2676Tensor<T> destination = CreateFromShapeUninitialized<T>(y.Lengths); 2698/// 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. 2702public static Tensor<T> Atan2Pi<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 2705Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2729public static Tensor<T> Atan2Pi<T>(in ReadOnlyTensorSpan<T> x, T y) 2732Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2756public static Tensor<T> Atan2Pi<T>(T x, in ReadOnlyTensorSpan<T> y) 2759Tensor<T> destination = CreateFromShapeUninitialized<T>(y.Lengths); 2781/// 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. 2784public static Tensor<T> Atanh<T>(in ReadOnlyTensorSpan<T> x) 2787Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2808/// 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. 2811public static Tensor<T> AtanPi<T>(in ReadOnlyTensorSpan<T> x) 2814Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2852/// Computes the element-wise cube root of the input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2855public static Tensor<T> Cbrt<T>(in ReadOnlyTensorSpan<T> x) 2858Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2879/// Computes the element-wise ceiling of the input <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 2882public static Tensor<T> Ceiling<T>(in ReadOnlyTensorSpan<T> x) 2885Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 2910public static Tensor<TTo> ConvertChecked<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source) 2914Tensor<TTo> destination = CreateFromShapeUninitialized<TTo>(source.Lengths); 2941public static Tensor<TTo> ConvertSaturating<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source) 2945Tensor<TTo> destination = CreateFromShapeUninitialized<TTo>(source.Lengths); 2972public static Tensor<TTo> ConvertTruncating<TFrom, TTo>(in ReadOnlyTensorSpan<TFrom> source) 2976Tensor<TTo> destination = CreateFromShapeUninitialized<TTo>(source.Lengths); 3003public static Tensor<T> CopySign<T>(in ReadOnlyTensorSpan<T> x, T sign) 3006Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3012/// 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. 3016public static Tensor<T> CopySign<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> sign) 3019Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3055/// Takes the cosine of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 3058public static Tensor<T> Cos<T>(in ReadOnlyTensorSpan<T> x) 3061Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3082/// Takes the hyperbolic cosine of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 3085public static Tensor<T> Cosh<T>(in ReadOnlyTensorSpan<T> x) 3088Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3124/// <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> 3138public static Tensor<T> CosPi<T>(in ReadOnlyTensorSpan<T> x) 3141Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3175public static Tensor<T> DegreesToRadians<T>(in ReadOnlyTensorSpan<T> x) 3178Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3234public static Tensor<T> Exp<T>(in ReadOnlyTensorSpan<T> x) 3237Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3261public static Tensor<T> Exp10<T>(in ReadOnlyTensorSpan<T> x) 3264Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3286public static Tensor<T> Exp10M1<T>(in ReadOnlyTensorSpan<T> x) 3289Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3309public static Tensor<T> Exp2<T>(in ReadOnlyTensorSpan<T> x) 3312Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3332public static Tensor<T> Exp2M1<T>(in ReadOnlyTensorSpan<T> x) 3335Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3355public static Tensor<T> ExpM1<T>(in ReadOnlyTensorSpan<T> x) 3358Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3378public static Tensor<T> Floor<T>(in ReadOnlyTensorSpan<T> x) 3381Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3405public static Tensor<T> Hypot<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 3408TensorOperation.ValidateCompatibility(x, y, out Tensor<T> destination); 3434public static Tensor<T> Ieee754Remainder<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 3437TensorOperation.ValidateCompatibility(x, y, out Tensor<T> destination); 3458public static Tensor<T> Ieee754Remainder<T>(in ReadOnlyTensorSpan<T> x, T y) 3461Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3481public static Tensor<T> Ieee754Remainder<T>(T x, in ReadOnlyTensorSpan<T> y) 3484Tensor<T> destination = CreateFromShapeUninitialized<T>(y.Lengths); 3505public static Tensor<int> ILogB<T>(in ReadOnlyTensorSpan<T> x) 3508Tensor<int> destination = CreateFromShapeUninitialized<int>(x.Lengths); 3577public static Tensor<T> LeadingZeroCount<T>(in ReadOnlyTensorSpan<T> x) 3580Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3601/// Takes the natural logarithm of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 3604public static Tensor<T> Log<T>(in ReadOnlyTensorSpan<T> x) 3607Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3628public static Tensor<T> Log<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 3631TensorOperation.ValidateCompatibility(x, y, out Tensor<T> destination); 3651public static Tensor<T> Log<T>(in ReadOnlyTensorSpan<T> x, T y) 3654Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3674/// 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. 3677public static Tensor<T> Log10<T>(in ReadOnlyTensorSpan<T> x) 3680Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3701/// 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. 3704public static Tensor<T> Log10P1<T>(in ReadOnlyTensorSpan<T> x) 3707Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3728/// 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. 3731public static Tensor<T> Log2<T>(in ReadOnlyTensorSpan<T> x) 3734Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3755/// 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. 3758public static Tensor<T> Log2P1<T>(in ReadOnlyTensorSpan<T> x) 3761Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3782/// 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. 3785public static Tensor<T> LogP1<T>(in ReadOnlyTensorSpan<T> x) 3788Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3826public static Tensor<T> Max<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 3829TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> output); 3849public static Tensor<T> Max<T>(in ReadOnlyTensorSpan<T> x, T y) 3852Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3889public static Tensor<T> MaxMagnitude<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 3892TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> destination); 3912public static Tensor<T> MaxMagnitude<T>(in ReadOnlyTensorSpan<T> x, T y) 3915Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 3952public static Tensor<T> MaxMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 3955TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> destination); 3975public static Tensor<T> MaxMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, T y) 3978Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4015public static Tensor<T> MaxNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4018TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> destination); 4038public static Tensor<T> MaxNumber<T>(in ReadOnlyTensorSpan<T> x, T y) 4041Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4078public static Tensor<T> Min<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4081TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> output); 4101public static Tensor<T> Min<T>(in ReadOnlyTensorSpan<T> x, T y) 4104Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4141public static Tensor<T> MinMagnitude<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4144TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> destination); 4164public static Tensor<T> MinMagnitude<T>(in ReadOnlyTensorSpan<T> x, T y) 4167Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4204public static Tensor<T> MinMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4207TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> destination); 4227public static Tensor<T> MinMagnitudeNumber<T>(in ReadOnlyTensorSpan<T> x, T y) 4230Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4267public static Tensor<T> MinNumber<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4270TensorOperation.ValidateCompatibility(in x, in y, out Tensor<T> destination); 4290public static Tensor<T> MinNumber<T>(in ReadOnlyTensorSpan<T> x, T y) 4293Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4328public static Tensor<T> PopCount<T>(in ReadOnlyTensorSpan<T> x) 4331Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4352public static Tensor<T> Pow<T>(in ReadOnlyTensorSpan<T> x, in ReadOnlyTensorSpan<T> y) 4355TensorOperation.ValidateCompatibility(x, y, out Tensor<T> destination); 4375public static Tensor<T> Pow<T>(in ReadOnlyTensorSpan<T> x, T y) 4378Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4398public static Tensor<T> Pow<T>(T x, in ReadOnlyTensorSpan<T> y) 4401Tensor<T> destination = CreateFromShapeUninitialized<T>(y.Lengths); 4434public static Tensor<T> RadiansToDegrees<T>(in ReadOnlyTensorSpan<T> x) 4437Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4457public static Tensor<T> Reciprocal<T>(in ReadOnlyTensorSpan<T> x) 4460Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4481public static Tensor<T> RootN<T>(in ReadOnlyTensorSpan<T> x, int n) 4484Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4507public static Tensor<T> RotateLeft<T>(in ReadOnlyTensorSpan<T> x, int rotateAmount) 4510Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4534public static Tensor<T> RotateRight<T>(in ReadOnlyTensorSpan<T> x, int rotateAmount) 4537Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4559public static Tensor<T> Round<T>(in ReadOnlyTensorSpan<T> x) 4562Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4582public static Tensor<T> Round<T>(in ReadOnlyTensorSpan<T> x, int digits, MidpointRounding mode) 4585Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4606public static Tensor<T> Round<T>(in ReadOnlyTensorSpan<T> x, int digits) 4609Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4629public static Tensor<T> Round<T>(in ReadOnlyTensorSpan<T> x, MidpointRounding mode) 4632Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4653public static Tensor<T> Sigmoid<T>(in ReadOnlyTensorSpan<T> x) 4656Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4675/// Takes the sin of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 4678public static Tensor<T> Sin<T>(in ReadOnlyTensorSpan<T> x) 4681Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4703public static Tensor<T> Sinh<T>(in ReadOnlyTensorSpan<T> x) 4706Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4726public static Tensor<T> SinPi<T>(in ReadOnlyTensorSpan<T> x) 4729Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4749public static Tensor<T> SoftMax<T>(in ReadOnlyTensorSpan<T> x) 4755Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4777/// Takes the square root of each element of the <see cref="ReadOnlyTensorSpan{T}"/> and returns a new <see cref="Tensor{T}"/> with the result. 4780public static Tensor<T> Sqrt<T>(in ReadOnlyTensorSpan<T> x) 4783Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4853public static Tensor<T> Tan<T>(in ReadOnlyTensorSpan<T> x) 4856Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4876public static Tensor<T> Tanh<T>(in ReadOnlyTensorSpan<T> x) 4879Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4899public static Tensor<T> TanPi<T>(in ReadOnlyTensorSpan<T> x) 4902Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4922public static Tensor<T> TrailingZeroCount<T>(in ReadOnlyTensorSpan<T> x) 4925Tensor<T> destination = CreateFromShapeUninitialized<T>(x.Lengths); 4945public static Tensor<T> Truncate<T>(in ReadOnlyTensorSpan<T> x) 4948Tensor<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>