Deep.Net


TensorLayout

Namespace: Tensor

Functions and values

Function or valueDescription
addr idx a
Signature: idx:int64 list -> a:TensorLayout -> int64

address of element

allIdx a
Signature: a:TensorLayout -> seq<int64 list>

sequence of all indices

allIdxOfDim dim a
Signature: dim:int -> a:TensorLayout -> seq<int64>

all indices of the given dimension

allIdxOfShape shp
Signature: shp:int64 list -> seq<int64 list>

a sequence of indicies enumerating all elements of the array with the given shape

allSrcRngsAndTrgtIdxsForAxisReduce dim a
Signature: dim:int -> a:TensorLayout -> seq<TensorRng list * int64 list>
broadcastDim dim size a
Signature: dim:int -> size:int64 -> a:TensorLayout -> TensorLayout

broadcast the given dimension to the given size

broadcastToSame ain bin
Signature: ain:TensorLayout -> bin:TensorLayout -> TensorLayout * TensorLayout

broadcasts to have the same size

broadcastToSameInDims dims ain bin
Signature: dims:seq<int> -> ain:TensorLayout -> bin:TensorLayout -> TensorLayout * TensorLayout

broadcasts to have the same size in the given dimensions

broadcastToSameInDimsMany dims sas
Signature: dims:seq<int> -> sas:TensorLayout list -> TensorLayout list

broadcasts to have the same size in the given dimensions

broadcastToSameMany sas
Signature: sas:TensorLayout list -> TensorLayout list

broadcasts to have the same size

broadcastToShape bs ain
Signature: bs:int64 list -> ain:TensorLayout -> TensorLayout

broadcasts a tensor to the given shape

canReshape shp a
Signature: shp:int64 list -> a:TensorLayout -> bool

Returns true if a can be reshaped into shp without copying. The number of elements must not change.

check a
Signature: a:TensorLayout -> unit

checks that the layout is valid

checkAxis ax a
Signature: ax:int -> a:TensorLayout -> unit

checks that the given axis is valid

checkIndex shp idx
Signature: shp:int64 list -> idx:int64 list -> unit

checks that the given index is valid for the given shape

cStride shape
Signature: shape:int64 list -> int64 list

computes the stride given the shape for the ArrayND to be in C-order (row-major)

cutLeft a
Signature: a:TensorLayout -> TensorLayout

cuts one dimension from the left

cutRight a
Signature: a:TensorLayout -> TensorLayout

cuts one dimension from the right

diagAxis ax1 ax2 a
Signature: ax1:int -> ax2:int -> a: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.

emptyVector
Signature: TensorLayout

an ArrayND layout for an empty (zero elements) vector (1D)

fStride shape
Signature: shape:int64 list -> int64 list

computes the stride given the shape for the ArrayND to be in Fortran-order (column-major)

hasContiguousMemory a
Signature: a:TensorLayout -> bool

true if the memory of the ArrayND is a contiguous block

idxToLinear a idx
Signature: a:TensorLayout -> idx:int64 list -> int64

Computes the linear index of a given index. Linear indexing is performed in row-major order.

insertAxis ax a
Signature: ax:int -> a:TensorLayout -> TensorLayout

Inserts an axis of size 1 before the specified position.

isBroadcasted a
Signature: a:TensorLayout -> bool

returns true if at least one dimension is broadcasted

isC a
Signature: a:TensorLayout -> bool

true if the ArrayND is contiguous

isF a
Signature: a:TensorLayout -> bool

true if the ArrayND is in Fortran order

linearToIdx a linear
Signature: a:TensorLayout -> linear:int64 -> int64 list

Computes the index of a given linear index.

nDims a
Signature: a:TensorLayout -> int

number of dimensions

nElems a
Signature: a:TensorLayout -> int64

number of elements

newC shp
Signature: shp:int64 list -> TensorLayout

a C-order (row-major) ArrayND layout of the given shape

newF shp
Signature: shp:int64 list -> TensorLayout

a Fortran-order (column-major) ArrayND layout of the given shape

newOrdered shp strideOrder
Signature: shp:int64 list -> strideOrder:int list -> TensorLayout

a ArrayND layout of the given shape and stride order

offset a
Signature: a:TensorLayout -> int64

offset

orderedStride shape order
Signature: shape:int64 list -> order: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].

padLeft a
Signature: a:TensorLayout -> TensorLayout

adds a new dimension of size one to the left

padRight a
Signature: a:TensorLayout -> TensorLayout

adds a new dimension of size one to the right

padToSame a b
Signature: a:TensorLayout -> b:TensorLayout -> TensorLayout * TensorLayout

pads shapes from the left until they have same rank

padToSameMany sas
Signature: sas:TensorLayout list -> TensorLayout list

pads shapes from the left until they have same rank

permuteAxes permut a
Signature: permut:int list -> a: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.

reshape shp a
Signature: shp:int64 list -> a: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.

reverseAxis ax a
Signature: ax:int -> a:TensorLayout -> TensorLayout

Reverses the elements in the specified dimension.

shape a
Signature: a:TensorLayout -> int64 list

shape

stride a
Signature: a:TensorLayout -> int64 list

stride

stridesEqual shp aStr bStr
Signature: shp:int64 list -> aStr:int64 list -> bStr:int64 list -> bool

True if strides are equal at all dimensions with size > 1.

swapDim ax1 ax2 a
Signature: ax1:int -> ax2:int -> a:TensorLayout -> TensorLayout

swaps the given dimensions

transpose a
Signature: a:TensorLayout -> TensorLayout

Transposes the given layout of a matrix. If the array has more then two dimensions, the last two axes are swapped.

tryReshape shp a
Signature: shp:int64 list -> a: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.

view ranges a
Signature: ranges:TensorRng list -> a:TensorLayout -> TensorLayout

creates a subview layout

Fork me on GitHub