mxnet.numpy_extensionΒΆ

Module for ops not belonging to the official numpy package for imperative programming.

Functions

activation(data[, act_type])

Applies an activation function element-wise to the input.

add_n(*args, **kwargs)

Adds all input arguments element-wise.

arange_like(data[, start, step, repeat, ...])

Return an array with evenly spaced values.

batch_dot(a, b[, transpose_a, transpose_b, ...])

Batchwise dot product.

batch_flatten([data, out, name])

Flattens the input array into a 2-D array by collapsing the higher dimensions. .. note:: Flatten is deprecated. Use flatten instead. For an input array with shape (d1, d2, ..., dk), flatten operation reshapes the input array into an output array of shape (d1, d2*...*dk). Note that the behavior of this function is different from numpy.ndarray.flatten, which behaves similar to mxnet.ndarray.reshape((-1,)). Example::.

batch_norm(x, gamma, beta, running_mean, ...)

Batch normalization.

bipartite_matching([data, is_ascend, ...])

Compute bipartite matching.

box_decode([data, anchors, std0, std1, ...])

Decode bounding boxes training target with normalized center offsets.

box_encode([samples, matches, anchors, ...])

Encode bounding boxes training target with normalized center offsets.

box_iou([lhs, rhs, format, out, name])

Bounding box overlap of two arrays.

box_nms([data, overlap_thresh, ...])

Apply non-maximum suppression to input.

broadcast_greater([lhs, rhs, out, name])

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

broadcast_like(lhs, rhs[, lhs_axes, rhs_axes])

Broadcasts lhs to have the same shape as rhs.

cast([data, dtype, out, name])

Casts all elements of the input to a new type.

cond(pred, then_func, else_func, inputs[, name])

Run an if-then-else using user-defined condition and computation

constraint_check(x, msg)

This operator will check if all the elements in a boolean tensor is true.

contrib_calibrate_entropy([hist, ...])

Provide calibrated min/max for input histogram.

contrib_quantize([data, min_range, ...])

Quantize a input tensor from float to out_type, with user-specified min_range and max_range.

contrib_quantize_v2([data, out_type, ...])

Quantize a input tensor from float to out_type, with user-specified min_calib_range and max_calib_range or the input range collected at runtime.

contrib_quantized_rnn([data, parameters, ...])

RNN operator for input data type of uint8.

convolution([data, weight, bias, kernel, ...])

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

ctc_loss([data, label, data_lengths, ...])

Connectionist Temporal Classification Loss.

deconvolution([data, weight, bias, kernel, ...])

Computes 1D, 2D or 3D transposed convolution (aka fractionally strided convolution) of the input tensor.

deformable_convolution([data, offset, ...])

Compute 2-D deformable convolution on 4-D input.

digamma([data, out, name])

Returns element-wise log derivative of the gamma function of the input.

dropout(data[, p, mode, axes, cudnn_off])

Applies dropout operation to input array.

embedding(data, weight[, input_dim, ...])

Maps integer indices to vector representations (embeddings).

erf([data, out, name])

Returns element-wise gauss error function of the input.

erfinv([data, out, name])

Returns element-wise inverse gauss error function of the input.

foreach(body, data, init_states)

Run a for loop with user-defined computation over NDArrays on dimension 0.

fully_connected(x, weight[, bias, ...])

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

gamma([data, out, name])

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

gammaln([data, out, name])

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

gather_nd([data, indices, out, name])

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

group_norm(data, gamma, beta[, num_groups, ...])

Group normalization.

index_add(a, ind, val)

Add values to input according to given indexes.

index_update(a, ind, val)

Update values to input according to given indexes.

instance_norm([data, gamma, beta, eps, out, ...])

Applies instance normalization to the n-dimensional input array.

interleaved_matmul_encdec_qk([queries, ...])

Compute the matrix multiplication between the projections of queries and keys in multihead attention use as encoder-decoder.

interleaved_matmul_encdec_valatt([...])

Compute the matrix multiplication between the projections of values and the attention weights in multihead attention use as encoder-decoder.

interleaved_matmul_selfatt_qk([...])

Compute the matrix multiplication between the projections of queries and keys in multihead attention use as self attention.

interleaved_matmul_selfatt_valatt([...])

Compute the matrix multiplication between the projections of values and the attention weights in multihead attention use as self attention.

intgemm_fully_connected([data, weight, ...])

Multiply matrices using 8-bit integers.

intgemm_maxabsolute([data, out, name])

Compute the maximum absolute value in a tensor of float32 fast on a CPU.

intgemm_prepare_data([data, maxabs, out, name])

This operator converts quantizes float32 to int8 while also banning -128.

intgemm_prepare_weight([weight, maxabs, ...])

This operator converts a weight matrix in column-major format to intgemm's internal fast representation of weight matrices.

intgemm_take_weight([weight, indices, out, name])

Index a weight matrix stored in intgemm's weight format.

layer_norm([data, gamma, beta, axis, eps, ...])

Layer normalization.

leaky_relu([data, gamma, act_type, slope, ...])

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

log_softmax(data[, axis, length, ...])

Computes the log softmax of the input.

masked_log_softmax(data, mask[, axis, ...])

Computes the masked log softmax of the input.

masked_softmax(data, mask[, axis, ...])

Applies the softmax function masking elements according to the mask provided

modulated_deformable_convolution([data, ...])

Compute 2-D modulated deformable convolution on 4-D input.

multibox_detection([cls_prob, loc_pred, ...])

Convert multibox detection predictions.

multibox_prior([data, sizes, ratios, clip, ...])

Generate prior(anchor) boxes from data, sizes and ratios.

multibox_target([anchor, label, cls_pred, ...])

Compute Multibox training targets

nonzero(a)

Return the indices of the elements that are non-zero.

norm([data, ord, axis, out_dtype, keepdims, ...])

Computes the norm on an ndarray.

one_hot(data[, depth, on_value, off_value, ...])

Returns a one-hot array.

pad([data, mode, pad_width, constant_value, ...])

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

pick(data, index[, axis, mode, keepdims])

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

pooling([data, kernel, stride, pad, ...])

Performs pooling on the input.

quantized_act([data, min_data, max_data, ...])

Activation operator for input and output data type of int8.

quantized_conv([data, weight, bias, ...])

Convolution operator for input, weight and bias data type of int8, and accumulates in type int32 for the output.

quantized_elemwise_add([lhs, rhs, lhs_min, ...])

elemwise_add operator for input dataA and input dataB data type of int8, and accumulates in type int32 for the output.

quantized_elemwise_mul([lhs, rhs, lhs_min, ...])

Multiplies arguments int8 element-wise.

quantized_embedding([data, weight, ...])

Maps integer indices to int8 vector representations (embeddings).

quantized_flatten([data, min_data, ...])

quantized_fully_connected([data, weight, ...])

Fully Connected operator for input, weight and bias data type of int8, and accumulates in type int32 for the output.

quantized_npi_add([lhs, rhs, lhs_min, ...])

elemwise_add operator for input dataA and input dataB data type of int8, and accumulates in type int32 for the output.

quantized_pooling([data, min_data, ...])

Pooling operator for input and output data type of int8.

quantized_reshape([data, min_data, ...])

quantized_transpose([data, min_data, ...])

relu([data, out, name])

Computes rectified linear activation.

requantize([data, min_range, max_range, ...])

Given data that is quantized in int32 and the corresponding thresholds, requantize the data into int8 using min and max thresholds either calculated at runtime or from calibration.

reshape(a, newshape[, reverse, order])

Gives a new shape to an array without changing its data.

reshape_like([lhs, rhs, lhs_begin, lhs_end, ...])

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

rnn([data, parameters, state, state_cell, ...])

Applies recurrent layers to input data.

roi_pooling([data, rois, pooled_size, ...])

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

round_ste([data, out, name])

Straight-through-estimator of round().

scalar_poisson([lam, shape, ctx, dtype, ...])

Draw random samples from a Poisson distribution.

sequence_last([data, sequence_length, ...])

Takes the last element of a sequence.

sequence_mask([data, sequence_length, ...])

Sets all elements outside the sequence to a constant value.

sequence_reverse([data, sequence_length, ...])

Reverses the elements of each sequence.

shape_array([data, out, name])

Returns a 1D int64 array containing the shape of data.

sigmoid([data, out, name])

Computes sigmoid of x element-wise.

sign_ste([data, out, name])

Straight-through-estimator of sign().

sldwin_atten_context([score, value, ...])

Compute the context vector for sliding window attention, used in Longformer (https://arxiv.org/pdf/2004.05150.pdf).

sldwin_atten_mask_like([score, dilation, ...])

Compute the mask for the sliding window attention score, used in Longformer (https://arxiv.org/pdf/2004.05150.pdf).

sldwin_atten_score([query, key, dilation, ...])

Compute the sliding window attention score, which is used in Longformer (https://arxiv.org/pdf/2004.05150.pdf).

slice([data, begin, end, step, out, name])

Slices a region of the array.

slice_channel([data, num_outputs, axis, ...])

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

slice_like([data, shape_like, axes, out, name])

Slices a region of the array like the shape of another array. This function is similar to slice, however, the begin are always 0`s and `end of specific axes are inferred from the second input shape_like. Given the second shape_like input of shape=(d_0, d_1, ..., d_n-1), a slice_like operator with default empty axes, it performs the following operation: `` out = slice(input, begin=(0, 0, ..., 0), end=(d_0, d_1, ..., d_n-1))``. When axes is not empty, it is used to speficy which axes are being sliced. Given a 4-d input data, slice_like operator with axes=(0, 2, -1) will perform the following operation: `` out = slice(input, begin=(0, 0, 0, 0), end=(d_0, None, d_2, d_3))``. Note that it is allowed to have first and second input with different dimensions, however, you have to make sure the axes are specified and not exceeding the dimension limits. For example, given input_1 with shape=(2,3,4,5) and input_2 with shape=(1,2,3), it is not allowed to use: `` out = slice_like(a, b)`` because ndim of input_1 is 4, and ndim of input_2 is 3. The following is allowed in this situation: `` out = slice_like(a, b, axes=(0, 2))`` Example::.

smooth_l1([data, scalar, out, name])

Calculate Smooth L1 Loss(lhs, scalar) by summing

softmax(data[, length, axis, temperature, ...])

Applies the softmax function.

softsign([data, out, name])

Computes softsign of x element-wise.

stop_gradient([data, out, name])

Stops gradient computation.

sync_batch_norm([data, gamma, beta, ...])

Batch normalization.

tensor_poisson([lam, shape, dtype, out, name])

Concurrent sampling from multiple Poisson distributions with parameters lambda (rate).

topk(data[, axis, k, ret_typ, is_ascend, dtype])

Returns the indices of the top k elements in an input array along the given

while_loop(cond, func, loop_vars[, ...])

Run a while loop with user-defined computation and loop condition.

Modules

control_flow

Namespace for registering control flow ops for imperative programming.

image

Image pre-processing operators.

random

Namespace for ops used in imperative programming.

utils

Util functions for the numpy module.