Table Of Contents
Table Of Contents

NDArray

The core MXNet data structure for all mathematical operations

Get array attributes

dim.MXNDArray

Dimension operator overload of mx.ndarray

is.mx.ndarray

Check if src.array is mx.ndarray

length.MXNDArray

Length operator overload of mx.ndarray

mx.nd.shape.array

Returns a 1D int64 array containing the shape of data

mx.nd.size.array

Returns a 1D int64 array containing the size of data

print.MXNDArray

print operator overload of mx.ndarray

Create arrays

mx.nd.array

Create a new mx.ndarray that copies the content from src on ctx

mx.nd.one.hot

Returns a one-hot array

mx.nd.ones.like

Return an array of ones with the same shape and type as the input array

mx.nd.ones

Generate an mx.ndarray object with ones

mx.nd.zeros.like

Return an array of zeros with the same shape, type and storage type as the input array

mx.nd.zeros

Generate an mx.nd.array object with zeros

Manipulation of arrays

Conversion

as.array.MXNDArray

as.array operator overload of mx.ndarray

as.matrix.MXNDArray

as.matrix operator overload of mx.ndarray

mx.nd.cast

Casts all elements of the input to a new type

mx.nd.cast.storage

Casts tensor storage type to the new type

mx.nd.copyto

Generate an mx.ndarray object on ctx, with data copied from src

mx.nd.load

Load an mx.nd.array object on disk

mx.nd.save

Save an mx.nd.array object

Ops.MXNDArray

Binary operator overloading of mx.ndarray

Reshaping

mx.nd.concat

Joins input arrays along a given axis

mx.nd.flatten

Flattens the input array into a 2-D array by collapsing the higher dimensions

mx.nd.reshape.like

Reshape some or all dimensions of lhs to have the same shape as some or all dimensions of rhs

mx.nd.reshape

Reshapes the input array

mx.nd.scatter.nd

Scatters data into a new tensor according to indices

mx.nd.split

Splits an array along a particular axis into multiple sub-arrays

mx.nd.squeeze

Remove single-dimensional entries from the shape of an array. Same behavior of defining the output tensor shape as numpy.squeeze for the most of cases. See the following note for exception

mx.nd.stack

Join a sequence of arrays along a new axis

Expanding elements

mx.nd.broadcast.add

Returns element-wise sum of the input arrays with broadcasting

mx.nd.broadcast.axes

Broadcasts the input array over particular axes

mx.nd.broadcast.axis

Broadcasts the input array over particular axes

mx.nd.broadcast.div

Returns element-wise division of the input arrays with broadcasting

mx.nd.broadcast.equal

Returns the result of element-wise equal to (==) comparison operation with broadcasting

mx.nd.broadcast.greater.equal

Returns the result of element-wise greater than or equal to (>=) comparison operation with broadcasting

mx.nd.broadcast.greater

Returns the result of element-wise greater than (>) comparison operation with broadcasting

mx.nd.broadcast.hypot

Returns the hypotenuse of a right angled triangle, given its “legs” with broadcasting

mx.nd.broadcast.lesser.equal

Returns the result of element-wise lesser than or equal to (<=) comparison operation with broadcasting

mx.nd.broadcast.lesser

Returns the result of element-wise lesser than (<) comparison operation with broadcasting

mx.nd.broadcast.like

Broadcasts lhs to have the same shape as rhs

mx.nd.broadcast.logical.and

Returns the result of element-wise logical and with broadcasting

mx.nd.broadcast.logical.or

Returns the result of element-wise logical or with broadcasting

mx.nd.broadcast.logical.xor

Returns the result of element-wise logical xor with broadcasting

mx.nd.broadcast.maximum

Returns element-wise maximum of the input arrays with broadcasting

mx.nd.broadcast.minimum

Returns element-wise minimum of the input arrays with broadcasting

mx.nd.broadcast.minus

Returns element-wise difference of the input arrays with broadcasting

mx.nd.broadcast.mod

Returns element-wise modulo of the input arrays with broadcasting

mx.nd.broadcast.mul

Returns element-wise product of the input arrays with broadcasting

mx.nd.broadcast.not.equal

Returns the result of element-wise not equal to (!=) comparison operation with broadcasting

mx.nd.broadcast.plus

Returns element-wise sum of the input arrays with broadcasting

mx.nd.broadcast.power

Returns result of first array elements raised to powers from second array, element-wise with broadcasting

mx.nd.broadcast.sub

Returns element-wise difference of the input arrays with broadcasting

mx.nd.broadcast.to

Broadcasts the input array to a new shape

mx.nd.expand.dims

Inserts a new axis of size 1 into the array shape

mx.nd.GridGenerator

Generates 2D sampling grid for bilinear sampling

mx.nd.pad

Pads an input array with a constant or edge values of the array

mx.nd.repeat

Repeats elements of an array

mx.nd.tile

Repeats the whole array multiple times

mx.nd.UpSampling

Performs nearest neighbor/bilinear up sampling to inputs

Rearranging elements

mx.nd.depth.to.space

Rearranges(permutes) data from depth into blocks of spatial data. Similar to ONNX DepthToSpace operator: https://github.com/onnx/onnx/blob/master/docs/Operators.md#DepthToSpace. The output is a new tensor where the values from depth dimension are moved in spatial blocks to height and width dimension. The reverse of this operation is space_to_depth

mx.nd.flip

Reverses the order of elements along given axis while preserving array shape

mx.nd.reverse

Reverses the order of elements along given axis while preserving array shape

mx.nd.SequenceReverse

Reverses the elements of each sequence

mx.nd.shuffle

Randomly shuffle the elements

mx.nd.space.to.depth

Rearranges(permutes) blocks of spatial data into depth. Similar to ONNX SpaceToDepth operator: https://github.com/onnx/onnx/blob/master/docs/Operators.md#SpaceToDepth

mx.nd.swapaxes

Interchanges two axes of an array

mx.nd.SwapAxis

Interchanges two axes of an array

mx.nd.transpose

Permutes the dimensions of an array

Sorting and searching

mx.nd.argmax.channel

Returns argmax indices of each channel from the input array

mx.nd.argmax

Returns indices of the maximum values along an axis

mx.nd.argmin

Returns indices of the minimum values along an axis

mx.nd.argsort

Returns the indices that would sort an input array along the given axis

mx.nd.sort

Returns a sorted copy of an input array along the given axis

mx.nd.topk

Returns the top k elements in an input array along the given axis. The returned elements will be sorted

mx.nd.where

Return the elements, either from x or y, depending on the condition

Indexing

mx.nd.batch.take

Takes elements from a data batch

mx.nd.choose.element.0index

Choose one element from each line(row for python, column for R/Julia) in lhs according to index indicated by rhs. This function assume rhs uses 0-based index

mx.nd.crop

Slices a region of the array

mx.nd.diag

Extracts a diagonal or constructs a diagonal array

mx.nd.fill.element.0index

Fill one element of each line(row for python, column for R/Julia) in lhs according to index indicated by rhs and values indicated by mhs. This function assume rhs uses 0-based index

mx.nd.gather.nd

Gather elements or slices from data and store to a tensor whose shape is defined by indices

mx.nd.pick

Picks elements from an input array according to the input indices along the given axis

mx.nd.ravel.multi.index

Converts a batch of index arrays into an array of flat indices. The operator follows numpy conventions so a single multi index is given by a column of the input matrix

mx.nd.SequenceLast

Takes the last element of a sequence

mx.nd.SequenceMask

Sets all elements outside the sequence to a constant value

mx.nd.slice.axis

Slices along a given axis

mx.nd.SliceChannel

Splits an array along a particular axis into multiple sub-arrays

mx.nd.slice.like

Slices a region of the array like the shape of another array

mx.nd.take

Takes elements from an input array along the given axis

mx.nd.unravel.index

Converts an array of flat indices into a batch of index arrays. The operator follows numpy conventions so a single multi index is given by a column of the output matrix

Mathematical operations on arrays

Arithmetic

mx.nd.abs

Returns element-wise absolute value of the input

mx.nd.add.n

Adds all input arguments element-wise

mx.nd.cbrt

Returns element-wise cube-root value of the input

mx.nd.ElementWiseSum

Adds all input arguments element-wise

mx.nd.elemwise.add

Adds arguments element-wise

mx.nd.elemwise.div

Divides arguments element-wise

mx.nd.elemwise.mul

Multiplies arguments element-wise

mx.nd.elemwise.sub

Subtracts arguments element-wise

mx.nd.expm1

Returns exp(x) - 1 computed element-wise on the input

mx.nd.exp

Returns element-wise exponential value of the input

mx.nd.gammaln

Returns element-wise log of the absolute value of the gamma function of the input

mx.nd.gamma

Returns the gamma function (extension of the factorial function to the reals), computed element-wise on the input array

mx.nd.identity

Returns a copy of the input

mx.nd.log10

Returns element-wise Base-10 logarithmic value of the input

mx.nd.log1p

Returns element-wise log(1 + x) value of the input

mx.nd.log2

Returns element-wise Base-2 logarithmic value of the input

mx.nd.logical.not

Returns the result of logical NOT (!) function

mx.nd.log

Returns element-wise Natural logarithmic value of the input

mx.nd.negative

Numerical negative of the argument, element-wise

mx.nd.rcbrt

Returns element-wise inverse cube-root value of the input

mx.nd.reciprocal

Returns the reciprocal of the argument, element-wise

mx.nd.rsqrt

Returns element-wise inverse square-root value of the input

mx.nd.sign

Returns element-wise sign of the input

mx.nd.sqrt

Returns element-wise square-root value of the input

mx.nd.square

Returns element-wise squared value of the input

Reduce

mx.nd.max.axis

Computes the max of array elements over given axes

mx.nd.max

Computes the max of array elements over given axes

mx.nd.mean

Computes the mean of array elements over given axes

mx.nd.min.axis

Computes the min of array elements over given axes

mx.nd.min

Computes the min of array elements over given axes

mx.nd.nanprod

Computes the product of array elements over given axes treating Not a Numbers (NaN) as one

mx.nd.nansum

Computes the sum of array elements over given axes treating Not a Numbers (NaN) as zero

mx.nd.prod

Computes the product of array elements over given axes

mx.nd.sum.axis

Computes the sum of array elements over given axes

mx.nd.sum

Computes the sum of array elements over given axes

Round

mx.nd.ceil

Returns element-wise ceiling of the input

mx.nd.clip

Clips (limits) the values in an array

mx.nd.fix

Returns element-wise rounded value to the nearest integer towards zero of the input

mx.nd.floor

Returns element-wise floor of the input

mx.nd.rint

Returns element-wise rounded value to the nearest integer of the input

mx.nd.round

Returns element-wise rounded value to the nearest integer of the input

mx.nd.trunc

Return the element-wise truncated value of the input

Linear algebra

mx.nd.batch.dot

Batchwise dot product

mx.nd.dot

Dot product of two arrays

mx.nd.khatri.rao

Computes the Khatri-Rao product of the input matrices

mx.nd.L2Normalization

Normalize the input array using the L2 norm

mx.nd.linalg.gelqf

LQ factorization for general matrix. Input is a tensor A of dimension n >= 2

mx.nd.linalg.gemm2

Performs general matrix multiplication. Input are tensors A, B, each of dimension n >= 2 and having the same shape on the leading n-2 dimensions

mx.nd.linalg.gemm

Performs general matrix multiplication and accumulation. Input are tensors A, B, C, each of dimension n >= 2 and having the same shape on the leading n-2 dimensions

mx.nd.linalg.potrf

Performs Cholesky factorization of a symmetric positive-definite matrix. Input is a tensor A of dimension n >= 2

mx.nd.linalg.potri

Performs matrix inversion from a Cholesky factorization. Input is a tensor A of dimension n >= 2

mx.nd.linalg.sumlogdiag

Computes the sum of the logarithms of the diagonal elements of a square matrix. Input is a tensor A of dimension n >= 2

mx.nd.linalg.syrk

Multiplication of matrix with its transpose. Input is a tensor A of dimension n >= 2

mx.nd.linalg.trmm

Performs multiplication with a lower triangular matrix. Input are tensors A, B, each of dimension n >= 2 and having the same shape on the leading n-2 dimensions

mx.nd.linalg.trsm

Solves matrix equation involving a lower triangular matrix. Input are tensors A, B, each of dimension n >= 2 and having the same shape on the leading n-2 dimensions

mx.nd.norm

Computes the norm on an NDArray

mx.nd.smooth.l1

Calculate Smooth L1 Loss(lhs, scalar) by summing

Trigonometric functions

mx.nd.arccos

Returns element-wise inverse cosine of the input array

mx.nd.arcsin

Returns element-wise inverse sine of the input array

mx.nd.arctan

Returns element-wise inverse tangent of the input array

mx.nd.cos

Computes the element-wise cosine of the input array

mx.nd.degrees

Converts each element of the input array from radians to degrees

mx.nd.radians

Converts each element of the input array from degrees to radians

mx.nd.sin

Computes the element-wise sine of the input array

mx.nd.tan

Computes the element-wise tangent of the input array

Hyperbolic functions

mx.nd.arccosh

Returns the element-wise inverse hyperbolic cosine of the input array, computed element-wise

mx.nd.arcsinh

Returns the element-wise inverse hyperbolic sine of the input array, computed element-wise

mx.nd.arctanh

Returns the element-wise inverse hyperbolic tangent of the input array, computed element-wise

mx.nd.cosh

Returns the hyperbolic cosine of the input array, computed element-wise

mx.nd.sinh

Returns the hyperbolic sine of the input array, computed element-wise

mx.nd.tanh

Returns the hyperbolic tangent of the input array, computed element-wise

Neural network array operations

mx.nd.Activation

Applies an activation function element-wise to the input

mx.nd.BatchNorm

Batch normalization

mx.nd.BatchNorm.v1

Batch normalization

mx.nd.BlockGrad

Stops gradient computation

mx.nd.Convolution

Compute N-D convolution on (N+2)-D input

mx.nd.Convolution.v1

This operator is DEPRECATED. Apply convolution to input then add a bias

mx.nd.Correlation

Applies correlation to inputs

mx.nd.ctc.loss

Connectionist Temporal Classification Loss

mx.nd.CTCLoss

Connectionist Temporal Classification Loss

mx.nd.Custom

Apply a custom operator implemented in a frontend language (like Python)

mx.nd.Deconvolution

Computes 1D or 2D transposed convolution (aka fractionally strided convolution) of the input tensor. This operation can be seen as the gradient of Convolution operation with respect to its input. Convolution usually reduces the size of the input. Transposed convolution works the other way, going from a smaller input to a larger output while preserving the connectivity pattern

mx.nd.Dropout

Applies dropout operation to input array

mx.nd.Embedding

Maps integer indices to vector representations (embeddings)

mx.nd.FullyConnected

Applies a linear transformation: \(Y = XW^T + b\)

mx.nd.hard.sigmoid

Computes hard sigmoid of x element-wise

mx.nd.IdentityAttachKLSparseReg

Apply a sparse regularization to the output a sigmoid activation function

mx.nd.InstanceNorm

Applies instance normalization to the n-dimensional input array

mx.nd.LayerNorm

Layer normalization

mx.nd.LeakyReLU

Applies Leaky rectified linear unit activation element-wise to the input

mx.nd.LinearRegressionOutput

Computes and optimizes for squared loss during backward propagation. Just outputs data during forward propagation

mx.nd.LogisticRegressionOutput

Applies a logistic function to the input

mx.nd.log.softmax

Computes the log softmax of the input. This is equivalent to computing softmax followed by log

mx.nd.LRN

Applies local response normalization to the input

mx.nd.MAERegressionOutput

Computes mean absolute error of the input

mx.nd.make.loss

Make your own loss function in network construction

mx.nd.MakeLoss

Make your own loss function in network construction

mx.nd.Pooling

Performs pooling on the input

mx.nd.Pooling.v1

This operator is DEPRECATED. Perform pooling on the input

mx.nd.relu

Computes rectified linear

mx.nd.RNN

Applies recurrent layers to input data. Currently, vanilla RNN, LSTM and GRU are implemented, with both multi-layer and bidirectional support

mx.nd.ROIPooling

Performs region of interest(ROI) pooling on the input array

mx.nd.sigmoid

Computes sigmoid of x element-wise

mx.nd.SoftmaxActivation

Applies softmax activation to input. This is intended for internal layers

mx.nd.softmax.cross.entropy

Calculate cross entropy of softmax output and one-hot label

mx.nd.SoftmaxOutput

Computes the gradient of cross entropy loss with respect to softmax output

mx.nd.softmax

Applies the softmax function

mx.nd.softmin

Applies the softmin function

mx.nd.softsign

Computes softsign of x element-wise

mx.nd.SpatialTransformer

Applies a spatial transformer to input feature map

mx.nd.stop.gradient

Stops gradient computation

mx.nd.SVMOutput

Computes support vector machine based transformation of the input