Table Of Contents
Table Of Contents

Symbol

Symbolic programming with computation graphs

Get symbol attributes

arguments

Get the arguments of symbol

children

Gets a new grouped symbol whose output contains inputs to output nodes of the original symbol

graph.viz

Convert symbol to Graphviz or visNetwork visualisation

internals

Get a symbol that contains all the internals

is.mx.symbol

Judge if an object is mx.symbol

mx.symbol.infer.shape

Inference the shape of arguments, outputs, and auxiliary states

mx.symbol.shape_array

Returns a 1D int64 array containing the shape of data

mx.symbol.size_array

Returns a 1D int64 array containing the size of data

outputs

Get the outputs of a symbol

Create symbols

mx.symbol.Group

Create a symbol that groups symbols together

mx.symbol.one_hot

Returns a one-hot array

mx.symbol.ones_like

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

mx.symbol.Variable

Create a symbolic variable with specified name

mx.symbol.zeros_like

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

Manipulation of symbols

Conversion

mx.apply

Apply symbol to the inputs

mx.symbol.cast

Casts all elements of the input to a new type

mx.symbol.cast_storage

Casts tensor storage type to the new type

mx.symbol.load.json

Load an mx.symbol object from a json string

mx.symbol.load

Load an mx.symbol object

mx.symbol.save

Save an mx.symbol object

Reshaping

mx.symbol.Concat

Perform an feature concat on channel dim (dim 1) over all the inputs

mx.symbol.flatten

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

mx.symbol.reshape_like

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

mx.symbol.reshape

Reshapes the input array

mx.symbol.scatter_nd

Scatters data into a new tensor according to indices

mx.symbol.split

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

mx.symbol.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.symbol.stack

Join a sequence of arrays along a new axis

Expanding elements

mx.symbol.broadcast_add

Returns element-wise sum of the input arrays with broadcasting

mx.symbol.broadcast_axes

Broadcasts the input array over particular axes

mx.symbol.broadcast_axis

Broadcasts the input array over particular axes

mx.symbol.broadcast_div

Returns element-wise division of the input arrays with broadcasting

mx.symbol.broadcast_equal

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

mx.symbol.broadcast_greater_equal

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

mx.symbol.broadcast_greater

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

mx.symbol.broadcast_hypot

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

mx.symbol.broadcast_lesser_equal

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

mx.symbol.broadcast_lesser

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

mx.symbol.broadcast_like

Broadcasts lhs to have the same shape as rhs

mx.symbol.broadcast_logical_and

Returns the result of element-wise logical and with broadcasting

mx.symbol.broadcast_logical_or

Returns the result of element-wise logical or with broadcasting

mx.symbol.broadcast_logical_xor

Returns the result of element-wise logical xor with broadcasting

mx.symbol.broadcast_maximum

Returns element-wise maximum of the input arrays with broadcasting

mx.symbol.broadcast_minimum

Returns element-wise minimum of the input arrays with broadcasting

mx.symbol.broadcast_minus

Returns element-wise difference of the input arrays with broadcasting

mx.symbol.broadcast_mod

Returns element-wise modulo of the input arrays with broadcasting

mx.symbol.broadcast_mul

Returns element-wise product of the input arrays with broadcasting

mx.symbol.broadcast_not_equal

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

mx.symbol.broadcast_plus

Returns element-wise sum of the input arrays with broadcasting

mx.symbol.broadcast_power

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

mx.symbol.broadcast_sub

Returns element-wise difference of the input arrays with broadcasting

mx.symbol.broadcast_to

Broadcasts the input array to a new shape

mx.symbol.expand_dims

Inserts a new axis of size 1 into the array shape

mx.symbol.GridGenerator

Generates 2D sampling grid for bilinear sampling

mx.symbol.pad

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

mx.symbol.repeat

Repeats elements of an array

mx.symbol.tile

Repeats the whole array multiple times

mx.symbol.UpSampling

Performs nearest neighbor/bilinear up sampling to inputs

Rearranging elements

mx.symbol.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.symbol.flip

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

mx.symbol.reverse

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

mx.symbol.SequenceReverse

Reverses the elements of each sequence

mx.symbol.shuffle

Randomly shuffle the elements

mx.symbol.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.symbol.swapaxes

Interchanges two axes of an array

mx.symbol.SwapAxis

Interchanges two axes of an array

mx.symbol.transpose

Permutes the dimensions of an array

Sorting and searching

mx.symbol.argmax_channel

Returns argmax indices of each channel from the input array

mx.symbol.argmax

Returns indices of the maximum values along an axis

mx.symbol.argmin

Returns indices of the minimum values along an axis

mx.symbol.argsort

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

mx.symbol.sort

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

mx.symbol.topk

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

mx.symbol.where

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

Indexing

mx.symbol.batch_take

Takes elements from a data batch

mx.symbol.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.symbol.crop

Slices a region of the array

mx.symbol.diag

Extracts a diagonal or constructs a diagonal array

mx.symbol.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.symbol.gather_nd

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

mx.symbol.pick

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

mx.symbol.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.symbol.SequenceLast

Takes the last element of a sequence

mx.symbol.SequenceMask

Sets all elements outside the sequence to a constant value

mx.symbol.slice_axis

Slices along a given axis

mx.symbol.SliceChannel

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

mx.symbol.slice_like

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

mx.symbol.slice

Slices a region of the array

mx.symbol.take

Takes elements from an input array along the given axis

mx.symbol.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 symbols

Arithmetic

mx.symbol.abs

Returns element-wise absolute value of the input

mx.symbol.add_n

Adds all input arguments element-wise

mx.symbol.cbrt

Returns element-wise cube-root value of the input

mx.symbol.ElementWiseSum

Adds all input arguments element-wise

mx.symbol.elemwise_add

Adds arguments element-wise

mx.symbol.elemwise_div

Divides arguments element-wise

mx.symbol.elemwise_mul

Multiplies arguments element-wise

mx.symbol.elemwise_sub

Subtracts arguments element-wise

mx.symbol.expm1

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

mx.symbol.exp

Returns element-wise exponential value of the input

mx.symbol.gammaln

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

mx.symbol.gamma

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

mx.symbol.identity

Returns a copy of the input

mx.symbol.log10

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

mx.symbol.log1p

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

mx.symbol.log2

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

mx.symbol.logical_not

Returns the result of logical NOT (!) function

mx.symbol.log

Returns element-wise Natural logarithmic value of the input

mx.symbol.negative

Numerical negative of the argument, element-wise

mx.symbol.rcbrt

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

mx.symbol.reciprocal

Returns the reciprocal of the argument, element-wise

mx.symbol.rsqrt

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

mx.symbol.sign

Returns element-wise sign of the input

mx.symbol.sqrt

Returns element-wise square-root value of the input

mx.symbol.square

Returns element-wise squared value of the input

Reduce

mx.symbol.max_axis

Computes the max of array elements over given axes

mx.symbol.max

Computes the max of array elements over given axes

mx.symbol.mean

Computes the mean of array elements over given axes

mx.symbol.nanprod

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

mx.symbol.nansum

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

mx.symbol.prod

Computes the product of array elements over given axes

mx.symbol.sum_axis

Computes the sum of array elements over given axes

mx.symbol.sum

Computes the sum of array elements over given axes

Round

mx.symbol.ceil

Returns element-wise ceiling of the input

mx.symbol.clip

Clips (limits) the values in an array

mx.symbol.fix

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

mx.symbol.floor

Returns element-wise floor of the input

mx.symbol.rint

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

mx.symbol.round

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

mx.symbol.trunc

Return the element-wise truncated value of the input

Linear algebra

mx.symbol.batch_dot

Batchwise dot product

mx.symbol.dot

Dot product of two arrays

mx.symbol.khatri_rao

Computes the Khatri-Rao product of the input matrices

mx.symbol.L2Normalization

Normalize the input array using the L2 norm

mx.symbol.linalg_gelqf

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

mx.symbol.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.symbol.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.symbol.linalg_potrf

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

mx.symbol.linalg_potri

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

mx.symbol.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.symbol.linalg_syrk

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

mx.symbol.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.symbol.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.symbol.norm

Computes the norm on an NDArray

mx.symbol.smooth_l1

Calculate Smooth L1 Loss(lhs, scalar) by summing

Trigonometric functions

mx.symbol.arccos

Returns element-wise inverse cosine of the input array

mx.symbol.arcsin

Returns element-wise inverse sine of the input array

mx.symbol.arctan

Returns element-wise inverse tangent of the input array

mx.symbol.cos

Computes the element-wise cosine of the input array

mx.symbol.degrees

Converts each element of the input array from radians to degrees

mx.symbol.radians

Converts each element of the input array from degrees to radians

mx.symbol.sin

Computes the element-wise sine of the input array

mx.symbol.tan

Computes the element-wise tangent of the input array

Hyperbolic functions

mx.symbol.arccosh

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

mx.symbol.arcsinh

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

mx.symbol.arctanh

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

mx.symbol.cosh

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

mx.symbol.sinh

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

mx.symbol.tanh

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

Neural network symbol operations

mx.symbol.Activation

Applies an activation function element-wise to the input

mx.symbol.BatchNorm

Batch normalization

mx.symbol.BatchNorm_v1

Batch normalization

mx.symbol.BlockGrad

Stops gradient computation

mx.symbol.Convolution

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

mx.symbol.Convolution_v1

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

mx.symbol.Correlation

Applies correlation to inputs

mx.symbol.ctc_loss

Connectionist Temporal Classification Loss

mx.symbol.CTCLoss

Connectionist Temporal Classification Loss

mx.symbol.Custom

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

mx.symbol.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.symbol.Dropout

Applies dropout operation to input array

mx.symbol.Embedding

Maps integer indices to vector representations (embeddings)

mx.symbol.FullyConnected

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

mx.symbol.hard_sigmoid

Computes hard sigmoid of x element-wise

mx.symbol.IdentityAttachKLSparseReg

Apply a sparse regularization to the output a sigmoid activation function

mx.symbol.InstanceNorm

Applies instance normalization to the n-dimensional input array

mx.symbol.LayerNorm

Layer normalization

mx.symbol.LeakyReLU

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

mx.symbol.LinearRegressionOutput

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

mx.symbol.LogisticRegressionOutput

Applies a logistic function to the input

mx.symbol.log_softmax

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

mx.symbol.LRN

Applies local response normalization to the input

mx.symbol.MAERegressionOutput

Computes mean absolute error of the input

mx.symbol.make_loss

Make your own loss function in network construction

mx.symbol.MakeLoss

Make your own loss function in network construction

mx.symbol.Pooling

Performs pooling on the input

mx.symbol.Pooling_v1

This operator is DEPRECATED. Perform pooling on the input

mx.symbol.relu

Computes rectified linear

mx.symbol.RNN

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

mx.symbol.ROIPooling

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

mx.symbol.sigmoid

Computes sigmoid of x element-wise

mx.symbol.SoftmaxActivation

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

mx.symbol.softmax_cross_entropy

Calculate cross entropy of softmax output and one-hot label

mx.symbol.SoftmaxOutput

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

mx.symbol.softmax

Applies the softmax function

mx.symbol.softmin

Applies the softmin function

mx.symbol.softsign

Computes softsign of x element-wise

mx.symbol.SpatialTransformer

Applies a spatial transformer to input feature map

mx.symbol.stop_gradient

Stops gradient computation

mx.symbol.SVMOutput

Computes support vector machine based transformation of the input