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.GroupNorm

Group normalization

mx.symbol.Variable

Create a symbolic variable with specified name

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.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

Load an mx.symbol object

mx.symbol.load.json

Load an mx.symbol object from a json string

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.Reshape

Reshapes the input array

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.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

mx.symbol.stack

Join a sequence of arrays along a new axis

Expanding elements

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.UpSampling

Upsamples the given input data

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

Returns the result of element-wise greater than (>) 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_hypot

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

mx.symbol.broadcast_lesser

Returns the result of element-wise lesser than (<) comparison operation 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_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 For example, given x with shape (2,3,4), then expand_dims(x, axis=1) will return a new array with shape (2,1,3,4)

mx.symbol.repeat

Repeats elements of an array

mx.symbol.tile

Repeats the whole array multiple times

Rearranging elements

mx.symbol.SequenceReverse

Reverses the elements of each sequence

mx.symbol.SwapAxis

Interchanges two axes of an array

mx.symbol.depth_to_space

Rearranges(permutes) data from depth into blocks of spatial data

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.shuffle

Randomly shuffle the elements

mx.symbol.space_to_depth

Rearranges(permutes) blocks of spatial data into depth

mx.symbol.swapaxes

Interchanges two axes of an array

mx.symbol.transpose

Permutes the dimensions of an array

Sorting and searching

mx.symbol.argmax

Returns indices of the maximum values along an axis

mx.symbol.argmax_channel

Returns argmax indices of each channel from the input array

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 indices of the top k elements in an input array along the given axis (by default)

mx.symbol.where

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

Indexing

mx.symbol.Crop

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.SliceChannel

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

mx.symbol.batch_take

Takes elements from a data batch

mx.symbol.choose_element_0index

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

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

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

mx.symbol.slice

Slices a region of the array

mx.symbol.slice_axis

Slices along a given axis

mx.symbol.slice_like

Slices a region of the array like the shape of another 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

Mathematical operations on symbols

Arithmetic

mx.symbol.ElementWiseSum

Adds all input arguments element-wise

mx.symbol.abs

Returns element-wise absolute value of the input

mx.symbol.add_n

Adds all input arguments element-wise

mx.symbol.all_finite

Check if all the float numbers in the array are finite (used for AMP)

mx.symbol.cbrt

Returns element-wise cube-root value of the input

mx.symbol.cumsum

Return the cumulative sum of the elements along a given axis

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.erf

Returns element-wise gauss error function of the input

mx.symbol.erfinv

Returns element-wise inverse gauss error function of the input

mx.symbol.exp

Returns element-wise exponential value of the input

mx.symbol.expm1

Returns exp(x) - 1 computed element-wise on 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.gammaln

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

mx.symbol.identity

Returns a copy of the input

mx.symbol.log

Returns element-wise Natural logarithmic value 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.moments

Calculate the mean and variance of data

mx.symbol.multi_all_finite

Check if all the float numbers in all the arrays are finite (used for AMP)

mx.symbol.multi_lars

Compute the LARS coefficients of multiple weights and grads from their sums of square”

mx.symbol.multi_sum_sq

Compute the sums of squares of multiple arrays

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.reset_arrays

Set to zero multiple arrays

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

Computes the max of array elements over given axes

mx.symbol.max_axis

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

Computes the sum of array elements over given axes

mx.symbol.sum_axis

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.L2Normalization

Normalize the input array using the L2 norm

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.linalg_det

Compute the determinant of a matrix

mx.symbol.linalg_extractdiag

Extracts the diagonal entries of a square matrix

mx.symbol.linalg_extracttrian

Extracts a triangular sub-matrix from a square matrix

mx.symbol.linalg_gelqf

LQ factorization for general matrix

mx.symbol.linalg_gemm

Performs general matrix multiplication and accumulation

mx.symbol.linalg_gemm2

Performs general matrix multiplication

mx.symbol.linalg_inverse

Compute the inverse of a matrix

mx.symbol.linalg_makediag

Constructs a square matrix with the input as diagonal

mx.symbol.linalg_maketrian

Constructs a square matrix with the input representing a specific triangular sub-matrix

mx.symbol.linalg_potrf

Performs Cholesky factorization of a symmetric positive-definite matrix

mx.symbol.linalg_potri

Performs matrix inversion from a Cholesky factorization

mx.symbol.linalg_slogdet

Compute the sign and log of the determinant of a matrix

mx.symbol.linalg_sumlogdiag

Computes the sum of the logarithms of the diagonal elements of a square matrix

mx.symbol.linalg_syrk

Multiplication of matrix with its transpose

mx.symbol.linalg_trmm

Performs multiplication with a lower triangular matrix

mx.symbol.linalg_trsm

Solves matrix equation involving a lower triangular matrix

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.CTCLoss

Connectionist Temporal Classification Loss

mx.symbol.Convolution

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

mx.symbol.Convolution_v1

This operator is DEPRECATED

mx.symbol.Correlation

Applies correlation to inputs

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

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.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.LRN

Applies local response normalization to the input

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

mx.symbol.LogisticRegressionOutput

Applies a logistic function to the input

mx.symbol.MAERegressionOutput

Computes mean absolute error of the input

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

mx.symbol.RNN

Applies recurrent layers to input data

mx.symbol.ROIPooling

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

mx.symbol.SVMOutput

Computes support vector machine based transformation of the input

mx.symbol.SoftmaxActivation

Applies softmax activation to input

mx.symbol.SoftmaxOutput

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

mx.symbol.SpatialTransformer

Applies a spatial transformer to input feature map

mx.symbol.ctc_loss

Connectionist Temporal Classification Loss

mx.symbol.hard_sigmoid

Computes hard sigmoid of x element-wise

mx.symbol.log_softmax

Computes the log softmax of the input

mx.symbol.make_loss

Make your own loss function in network construction

mx.symbol.relu

Computes rectified linear activation

mx.symbol.sigmoid

Computes sigmoid of x element-wise

mx.symbol.softmax

Applies the softmax function

mx.symbol.softmax_cross_entropy

Calculate cross entropy of softmax output and one-hot label

mx.symbol.softmin

Applies the softmin function

mx.symbol.softsign

Computes softsign of x element-wise

mx.symbol.stop_gradient

Stops gradient computation