Class TensorLayout (mod)
Functions for working with TensorLayout.
Inheritance
Namespace: Tensor.Backend
Assembly: Tensor.dll
Syntax
module TensorLayout
Fields
Name | Description |
---|---|
val emptyVector | an ArrayND layout for an empty (zero elements) vector (1D) |
Methods
Name | Description |
---|---|
val addr: int64 list -> TensorLayout -> int64 | address of element |
val allIdx: TensorLayout -> seq<int64 list> | sequence of all indices |
val allIdxOfDim: int -> TensorLayout -> seq<int64> | all indices of the given dimension |
val allIdxOfShape: int64 list -> seq<int64 list> | a sequence of indicies enumerating all elements of the array with the given shape |
val allSrcRngsAndTrgtIdxsForAxisReduce: int -> TensorLayout -> seq<Rng list * int64 list> | |
val broadcastDim: int -> int64 -> TensorLayout -> TensorLayout | broadcast the given dimension to the given size |
val broadcastToSame: TensorLayout -> TensorLayout -> TensorLayout * TensorLayout | broadcasts to have the same size |
val broadcastToSameInDims: seq<int> -> TensorLayout -> TensorLayout -> TensorLayout * TensorLayout | broadcasts to have the same size in the given dimensions |
val broadcastToSameInDimsMany: seq<int> -> TensorLayout list -> TensorLayout list | broadcasts to have the same size in the given dimensions |
val broadcastToSameMany: TensorLayout list -> TensorLayout list | broadcasts to have the same size |
val broadcastToShape: int64 list -> TensorLayout -> TensorLayout | broadcasts a tensor to the given shape |
val canReshape: int64 list -> TensorLayout -> bool | Returns true if a can be reshaped into shp without copying. The number of elements must not change. |
val check: TensorLayout -> unit | checks that the layout is valid |
val checkAxis: int -> TensorLayout -> unit | checks that the given axis is valid |
val checkIndex: int64 list -> int64 list -> unit | checks that the given index is valid for the given shape |
val cStride: int64 list -> int64 list | computes the stride given the shape for the ArrayND to be in C-order (row-major) |
val cutLeft: TensorLayout -> TensorLayout | cuts one dimension from the left |
val cutRight: TensorLayout -> TensorLayout | cuts one dimension from the right |
val diagAxis: int -> int -> TensorLayout -> TensorLayout | Creates a layout that extracts the diagonal along the given axes. The first axis is replaced with the diagonal and the second axis is removed. |
val fStride: int64 list -> int64 list | computes the stride given the shape for the ArrayND to be in Fortran-order (column-major) |
val hasContiguousMemory: TensorLayout -> bool | true if the memory of the ArrayND is a contiguous block |
val idxToLinear: TensorLayout -> int64 list -> int64 | Computes the linear index of a given index. Linear indexing is performed in row-major order. |
val insertAxis: int -> TensorLayout -> TensorLayout | Inserts an axis of size 1 before the specified position. |
val isBroadcasted: TensorLayout -> bool | returns true if at least one dimension is broadcasted |
val isC: TensorLayout -> bool | true if the ArrayND is contiguous |
val isF: TensorLayout -> bool | true if the ArrayND is in Fortran order |
val linearToIdx: TensorLayout -> int64 -> int64 list | Computes the index of a given linear index. |
val nDims: TensorLayout -> int | number of dimensions |
val nElems: TensorLayout -> int64 | number of elements |
val newC: int64 list -> TensorLayout | a C-order (row-major) ArrayND layout of the given shape |
val newF: int64 list -> TensorLayout | a Fortran-order (column-major) ArrayND layout of the given shape |
val newOrdered: int64 list -> int list -> TensorLayout | a ArrayND layout of the given shape and stride order |
val offset: TensorLayout -> int64 | offset |
val orderedStride: int64 list -> int list -> int64 list | Computes the strides for the given shape using the specified ordering. The axis that is first in the ordering gets stride 1. The resulting strides will be independent of the shape of the axis that appears last in the ordering. A C-order stride corresponds to the ordering: [n; n-1; ...; 2; 1; 0]. A Fortran-order stride corresponds to the ordering: [0; 1; 2; ...; n-1; n]. |
val padLeft: TensorLayout -> TensorLayout | adds a new dimension of size one to the left |
val padRight: TensorLayout -> TensorLayout | adds a new dimension of size one to the right |
val padToSame: TensorLayout -> TensorLayout -> TensorLayout * TensorLayout | pads shapes from the left until they have same rank |
val padToSameMany: TensorLayout list -> TensorLayout list | pads shapes from the left until they have same rank |
val permuteAxes: int list -> TensorLayout -> TensorLayout | Permutes the axes as specified. Each entry in the specified permutation specifies the new position of the corresponding axis, i.e. to which position the axis should move. |
val reshape: int64 list -> TensorLayout -> TensorLayout | Reshape layout under the assumption that it is contiguous. The number of elements must not change. An error is raised, if reshape is impossible without copying. |
val reverseAxis: int -> TensorLayout -> TensorLayout | Reverses the elements in the specified dimension. |
val shape: TensorLayout -> int64 list | shape |
val stride: TensorLayout -> int64 list | stride |
val stridesEqual: int64 list -> int64 list -> int64 list -> bool | True if strides are equal at all dimensions with size > 1. |
val swapDim: int -> int -> TensorLayout -> TensorLayout | swaps the given dimensions |
val transpose: TensorLayout -> TensorLayout | Transposes the given layout of a matrix. If the array has more then two dimensions, the last two axes are swapped. |
val tryReshape: int64 list -> TensorLayout -> TensorLayout option | Reshape layout under the assumption that it is contiguous. The number of elements must not change. Returns Some newLayout when reshape is possible without copy Returns None when a copy is required. |
val view: Rng list -> TensorLayout -> TensorLayout | creates a subview layout |