Show / Hide Table of Contents

Class ArrayTensorExtensions

A static class that houses static DenseTensor{T} extension methods

Inheritance
object
ArrayTensorExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Microsoft.ML.OnnxRuntime.Tensors
Assembly: Microsoft.ML.OnnxRuntime.dll
Syntax
public static class ArrayTensorExtensions

Methods

| Improve this Doc View Source

ToTensor<T>(Array, bool)

Creates a copy of this n-dimensional array as a DenseTensor<T>

Declaration
public static DenseTensor<T> ToTensor<T>(this Array array, bool reverseStride = false)
Parameters
Type Name Description
Array array

The array to create a DenseTensor<T> from.

bool reverseStride

False (default) to indicate that the first dimension is most major (farthest apart) and the last dimension is most minor (closest together): akin to row-major in a rank-2 tensor. True to indicate that the last dimension is most major (farthest apart) and the first dimension is most minor (closest together): akin to column-major in a rank-2 tensor.

Returns
Type Description
DenseTensor<T>

A n-dimensional DenseTensor<T> with the same dimensions and content as array.

Type Parameters
Name Description
T

Type contained in the array to copy to the DenseTensor<T>.

| Improve this Doc View Source

ToTensor<T>(T[,,,], bool)

Creates a copy of this four-dimensional array as a DenseTensor<T>

Declaration
public static DenseTensor<T> ToTensor<T>(this T[,,,] array, bool reverseStride = false)
Parameters
Type Name Description
T[,,,] array

The array to create a DenseTensor<T> from.

bool reverseStride

False (default) to indicate that the first dimension is most major (farthest apart) and the last dimension is most minor (closest together): akin to row-major in a rank-2 tensor. True to indicate that the last dimension is most major (farthest apart) and the first dimension is most minor (closest together): akin to column-major in a rank-2 tensor.

Returns
Type Description
DenseTensor<T>

A 4-dimensional DenseTensor<T> with the same dimensions and content as array.

Type Parameters
Name Description
T

Type contained in the array to copy to the DenseTensor<T>.

| Improve this Doc View Source

ToTensor<T>(T[,,], bool)

Creates a copy of this three-dimensional array as a DenseTensor<T>

Declaration
public static DenseTensor<T> ToTensor<T>(this T[,,] array, bool reverseStride = false)
Parameters
Type Name Description
T[,,] array

The array to create a DenseTensor<T> from.

bool reverseStride

False (default) to indicate that the first dimension is most major (farthest apart) and the last dimension is most minor (closest together): akin to row-major in a rank-2 tensor. True to indicate that the last dimension is most major (farthest apart) and the first dimension is most minor (closest together): akin to column-major in a rank-2 tensor.

Returns
Type Description
DenseTensor<T>

A 3-dimensional DenseTensor<T> with the same dimensions and content as array.

Type Parameters
Name Description
T

Type contained in the array to copy to the DenseTensor<T>.

| Improve this Doc View Source

ToTensor<T>(T[,], bool)

Creates a copy of this two-dimensional array as a DenseTensor<T>

Declaration
public static DenseTensor<T> ToTensor<T>(this T[,] array, bool reverseStride = false)
Parameters
Type Name Description
T[,] array

The array to create a DenseTensor<T> from.

bool reverseStride

False (default) to indicate that the first dimension is most major (farthest apart) and the last dimension is most minor (closest together): row-major. True to indicate that the last dimension is most major (farthest apart) and the first dimension is most minor (closest together): column-major.

Returns
Type Description
DenseTensor<T>

A 2-dimensional DenseTensor<T> with the same dimensions and content as array.

Type Parameters
Name Description
T

Type contained in the array to copy to the DenseTensor<T>.

| Improve this Doc View Source

ToTensor<T>(T[])

Creates a copy of this single-dimensional array as a DenseTensor<T>

Declaration
public static DenseTensor<T> ToTensor<T>(this T[] array)
Parameters
Type Name Description
T[] array

The array to create a DenseTensor<T> from.

Returns
Type Description
DenseTensor<T>

A 1-dimensional DenseTensor<T> with the same length and content as array.

Type Parameters
Name Description
T

Type contained in the array to copy to the DenseTensor<T>.

  • Improve this Doc
  • View Source
In This Article
Back to top