Class sym
Inheritance
Inherited Members
Namespace: MxNet
Assembly: MxNet.dll
Syntax
public class sym
Fields
| Improve this Doc View SourceContrib
Declaration
public static SymContribApi Contrib
Field Value
| Type | Description |
|---|---|
| SymContribApi |
Image
Declaration
public static SymImgApi Image
Field Value
| Type | Description |
|---|---|
| SymImgApi |
Methods
| Improve this Doc View SourceAbs(Symbol, String)
Returns element-wise absolute value of the input.
Example::
abs([-2, 0, 3]) = [2, 0, 3]
The storage type of ``abs`` output depends upon the input storage type:
- abs(default) = default
- abs(row_sparse) = row_sparse
- abs(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L685
Declaration
public static Symbol Abs(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Activation(Symbol, ActivationType, String)
Applies an activation function element-wise to the input.
The following activation functions are supported:
- `relu`: Rectified Linear Unit, :math:`y = max(x, 0)`
- `sigmoid`: :math:`y = \frac{1}{1 + exp(-x)}`
- `tanh`: Hyperbolic tangent, :math:`y = \frac{exp(x) - exp(-x)}{exp(x) + exp(-x)}`
- `softrelu`: Soft ReLU, or SoftPlus, :math:`y = log(1 + exp(x))`
- `softsign`: :math:`y = \frac{x}{1 + abs(x)}`
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\nn\activation.cc:L167
Declaration
public static Symbol Activation(Symbol data, ActivationType act_type, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| ActivationType | act_type | Activation function to be applied. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
AdamUpdate(Symbol, Symbol, Symbol, Symbol, Single, Single, Single, Single, Single, Single, Single, Boolean, String)
Declaration
public static Symbol AdamUpdate(Symbol weight, Symbol grad, Symbol mean, Symbol var, float lr, float beta1 = 0.9F, float beta2 = 0.999F, float epsilon = 1E-08F, float wd = 0F, float rescale_grad = 1F, float clip_gradient = -1F, bool lazy_update = true, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | weight | |
| Symbol | grad | |
| Symbol | mean | |
| Symbol | var | |
| System.Single | lr | |
| System.Single | beta1 | |
| System.Single | beta2 | |
| System.Single | epsilon | |
| System.Single | wd | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.Boolean | lazy_update | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
AdamwUpdate(Symbol, Symbol, Symbol, Symbol, Symbol, Single, Single, Single, Single, Single, Single, Single, String)
Declaration
public static Symbol AdamwUpdate(Symbol weight, Symbol grad, Symbol mean, Symbol var, Symbol rescale_grad, float lr, float eta, float beta1 = 0.9F, float beta2 = 0.999F, float epsilon = 1E-08F, float wd = 0F, float clip_gradient = -1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | weight | |
| Symbol | grad | |
| Symbol | mean | |
| Symbol | var | |
| Symbol | rescale_grad | |
| System.Single | lr | |
| System.Single | eta | |
| System.Single | beta1 | |
| System.Single | beta2 | |
| System.Single | epsilon | |
| System.Single | wd | |
| System.Single | clip_gradient | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
AddN(SymbolList, String)
Adds all input arguments element-wise.
.. math::
add\_n(a_1, a_2, ..., a_n) = a_1 + a_2 + ... + a_n
``add_n`` is potentially more efficient than calling ``add`` by `n` times.
The storage type of ``add_n`` output depends on storage types of inputs
- add_n(row_sparse, row_sparse, ..) = row_sparse
- add_n(default, csr, default) = default
- add_n(any input combinations longer than 4 (>4) with at least one default type) = default
- otherwise, ``add_n`` falls all inputs back to default storage and generates default storage
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_sum.cc:L156
Declaration
public static Symbol AddN(SymbolList args, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| SymbolList | args | Positional input arguments |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Arange(Double, Nullable<Double>, Double, Int32, Boolean, Context, DType, String)
Return evenly spaced values within a given interval. Similar to Numpy
Declaration
public static Symbol Arange(double start, double? stop = default(double? ), double step = 1, int repeat = 1, bool infer_range = false, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | start | Start of interval. The interval includes this value. The default start value is 0. |
| System.Nullable<System.Double> | stop | End of interval. The interval does not include this value, except in some cases where step is not an integer and floating point round-off affects the length of out. |
| System.Double | step | Spacing between values. |
| System.Int32 | repeat | The repeating time of all elements. E.g repeat=3, the element a will be repeated three times --> a, a, a. |
| System.Boolean | infer_range | When set to True, infer the stop position from the start, step, repeat, and output tensor size. |
| Context | ctx | Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls. |
| DType | dtype | Target data type. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Arccos(Symbol, String)
Returns element-wise inverse cosine of the input array.
The input should be in range `[-1, 1]`.
The output is in the closed interval :math:`[0, \pi]`
.. math::
arccos([-1, -.707, 0, .707, 1]) = [\pi, 3\pi/4, \pi/2, \pi/4, 0]
The storage type of ``arccos`` output is always dense
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_trig.cc:L123
Declaration
public static Symbol Arccos(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Arccosh(Symbol, String)
Returns the element-wise inverse hyperbolic cosine of the input array, \
computed element-wise.
The storage type of ``arccosh`` output is always dense
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_trig.cc:L264
Declaration
public static Symbol Arccosh(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Arcsin(Symbol, String)
Returns element-wise inverse sine of the input array.
The input should be in the range `[-1, 1]`.
The output is in the closed interval of [:math:`-\pi/2`, :math:`\pi/2`].
.. math::
arcsin([-1, -.707, 0, .707, 1]) = [-\pi/2, -\pi/4, 0, \pi/4, \pi/2]
The storage type of ``arcsin`` output depends upon the input storage type:
- arcsin(default) = default
- arcsin(row_sparse) = row_sparse
- arcsin(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_trig.cc:L104
Declaration
public static Symbol Arcsin(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Arcsinh(Symbol, String)
Returns the element-wise inverse hyperbolic sine of the input array, \
computed element-wise.
The storage type of ``arcsinh`` output depends upon the input storage type:
- arcsinh(default) = default
- arcsinh(row_sparse) = row_sparse
- arcsinh(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_trig.cc:L250
Declaration
public static Symbol Arcsinh(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Arctan(Symbol, String)
Returns element-wise inverse tangent of the input array.
The output is in the closed interval :math:`[-\pi/2, \pi/2]`
.. math::
arctan([-1, 0, 1]) = [-\pi/4, 0, \pi/4]
The storage type of ``arctan`` output depends upon the input storage type:
- arctan(default) = default
- arctan(row_sparse) = row_sparse
- arctan(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_trig.cc:L144
Declaration
public static Symbol Arctan(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Arctanh(Symbol, String)
Returns the element-wise inverse hyperbolic tangent of the input array, \
computed element-wise.
The storage type of ``arctanh`` output depends upon the input storage type:
- arctanh(default) = default
- arctanh(row_sparse) = row_sparse
- arctanh(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_trig.cc:L281
Declaration
public static Symbol Arctanh(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Argmax(Symbol, Nullable<Int32>, Boolean, String)
Returns indices of the maximum values along an axis.
In the case of multiple occurrences of maximum values, the indices corresponding to the first occurrence
are returned.
Examples::
x = [[ 0., 1., 2.],
[ 3., 4., 5.]]
// argmax along axis 0
argmax(x, axis=0) = [ 1., 1., 1.]
// argmax along axis 1
argmax(x, axis=1) = [ 2., 2.]
// argmax along axis 1 keeping same dims as an input array
argmax(x, axis=1, keepdims=True) = [[ 2.],
[ 2.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\broadcast_reduce_op_index.cc:L52
Declaration
public static Symbol Argmax(Symbol data, int? axis = default(int? ), bool keepdims = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| System.Nullable<System.Int32> | axis | The axis along which to perform the reduction. Negative values means indexing from right to left.
|
| System.Boolean | keepdims | If this is set to |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
ArgmaxChannel(Symbol, String)
Returns argmax indices of each channel from the input array.
The result will be an NDArray of shape (num_channel,).
In case of multiple occurrences of the maximum values, the indices corresponding to the first occurrence
are returned.
Examples::
x = [[ 0., 1., 2.],
[ 3., 4., 5.]]
argmax_channel(x) = [ 2., 2.]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\broadcast_reduce_op_index.cc:L97
Declaration
public static Symbol ArgmaxChannel(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Argmin(Symbol, Nullable<Int32>, Boolean, String)
Returns indices of the minimum values along an axis.
In the case of multiple occurrences of minimum values, the indices corresponding to the first occurrence
are returned.
Examples::
x = [[ 0., 1., 2.],
[ 3., 4., 5.]]
// argmin along axis 0
argmin(x, axis=0) = [ 0., 0., 0.]
// argmin along axis 1
argmin(x, axis=1) = [ 0., 0.]
// argmin along axis 1 keeping same dims as an input array
argmin(x, axis=1, keepdims=True) = [[ 0.],
[ 0.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\broadcast_reduce_op_index.cc:L77
Declaration
public static Symbol Argmin(Symbol data, int? axis = default(int? ), bool keepdims = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| System.Nullable<System.Int32> | axis | The axis along which to perform the reduction. Negative values means indexing from right to left.
|
| System.Boolean | keepdims | If this is set to |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Argsort(Symbol, Nullable<Int32>, Boolean, DType, String)
Returns the indices that would sort an input array along the given axis.
This function performs sorting along the given axis and returns an array of indices having same shape
as an input array that index data in sorted order.
Examples::
x = [[ 0.3, 0.2, 0.4],
[ 0.1, 0.3, 0.2]]
// sort along axis -1
argsort(x) = [[ 1., 0., 2.],
[ 0., 2., 1.]]
// sort along axis 0
argsort(x, axis=0) = [[ 1., 0., 1.]
[ 0., 1., 0.]]
// flatten and then sort
argsort(x) = [ 3., 1., 5., 0., 4., 2.]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\ordering_op.cc:L177
Declaration
public static Symbol Argsort(Symbol data, int? axis, bool is_ascend = true, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array |
| System.Nullable<System.Int32> | axis | Axis along which to sort the input tensor. If not given, the flattened array is used. Default is -1. |
| System.Boolean | is_ascend | Whether to sort in ascending or descending order. |
| DType | dtype | DType of the output indices. It is only valid when ret_typ is "indices" or "both". An error will be raised if the selected data type cannot precisely represent the indices. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BatchDot(Symbol, Symbol, Boolean, Boolean, Nullable<BatchDotForwardStype>, String)
Batchwise dot product.
``batch_dot`` is used to compute dot product of ``x`` and ``y`` when ``x`` and
``y`` are data in batch, namely 3D arrays in shape of `(batch_size, :, :)`.
For example, given ``x`` with shape `(batch_size, n, m)` and ``y`` with shape
`(batch_size, m, k)`, the result array will have shape `(batch_size, n, k)`,
which is computed by::
batch_dot(x,y)[i,:,:] = dot(x[i,:,:], y[i,:,:])
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\dot.cc:L125
Declaration
public static Symbol BatchDot(Symbol lhs, Symbol rhs, bool transpose_a = false, bool transpose_b = false, BatchDotForwardStype? forward_stype = default(BatchDotForwardStype? ), string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | The first input |
| Symbol | rhs | The second input |
| System.Boolean | transpose_a | If true then transpose the first input before dot. |
| System.Boolean | transpose_b | If true then transpose the second input before dot. |
| System.Nullable<BatchDotForwardStype> | forward_stype | The desired storage type of the forward output given by user, if thecombination of input storage types and this hint does not matchany implemented ones, the dot operator will perform fallback operationand still produce an output of the desired storage type. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BatchNorm(Symbol, Symbol, Symbol, Symbol, Symbol, Double, Single, Boolean, Boolean, Boolean, Int32, Boolean, String)
Declaration
public static Symbol BatchNorm(Symbol data, Symbol gamma, Symbol beta, Symbol moving_mean, Symbol moving_var, double eps = 0.001, float momentum = 0.9F, bool fix_gamma = true, bool use_global_stats = false, bool output_mean_var = false, int axis = 1, bool cudnn_off = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | |
| Symbol | gamma | |
| Symbol | beta | |
| Symbol | moving_mean | |
| Symbol | moving_var | |
| System.Double | eps | |
| System.Single | momentum | |
| System.Boolean | fix_gamma | |
| System.Boolean | use_global_stats | |
| System.Boolean | output_mean_var | |
| System.Int32 | axis | |
| System.Boolean | cudnn_off | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
BatchNormV1(Symbol, Symbol, Symbol, Single, Single, Boolean, Boolean, Boolean, String)
Batch normalization.
This operator is DEPRECATED. Perform BatchNorm on the input.
Normalizes a data batch by mean and variance, and applies a scale ``gamma`` as
well as offset ``beta``.
Assume the input has more than one dimension and we normalize along axis 1.
We first compute the mean and variance along this axis:
.. math::
data\_mean[i] = mean(data[:,i,:,...]) \\
data\_var[i] = var(data[:,i,:,...])
Then compute the normalized output, which has the same shape as input, as following:
.. math::
out[:,i,:,...] = \frac{data[:,i,:,...] - data\_mean[i]}{\sqrt{data\_var[i]+\epsilon}} * gamma[i] + beta[i]
Both *mean* and *var* returns a scalar by treating the input as a vector.
Assume the input has size *k* on axis 1, then both ``gamma`` and ``beta``
have shape *(k,)*. If ``output_mean_var`` is set to be true, then outputs both ``data_mean`` and
``data_var`` as well, which are needed for the backward pass.
Besides the inputs and the outputs, this operator accepts two auxiliary
states, ``moving_mean`` and ``moving_var``, which are *k*-length
vectors. They are global statistics for the whole dataset, which are updated
by::
moving_mean = moving_mean * momentum + data_mean * (1 - momentum)
moving_var = moving_var * momentum + data_var * (1 - momentum)
If ``use_global_stats`` is set to be true, then ``moving_mean`` and
``moving_var`` are used instead of ``data_mean`` and ``data_var`` to compute
the output. It is often used during inference.
Both ``gamma`` and ``beta`` are learnable parameters. But if ``fix_gamma`` is true,
then set ``gamma`` to 1 and its gradient to 0.
There's no sparse support for this operator, and it will exhibit problematic behavior if used with
sparse tensors.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\batch_norm_v1.cc:L95
Declaration
public static Symbol BatchNormV1(Symbol data, Symbol gamma, Symbol beta, float eps = 0.001F, float momentum = 0.9F, bool fix_gamma = true, bool use_global_stats = false, bool output_mean_var = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data to batch normalization |
| Symbol | gamma | gamma array |
| Symbol | beta | beta array |
| System.Single | eps | Epsilon to prevent div 0 |
| System.Single | momentum | Momentum for moving average |
| System.Boolean | fix_gamma | Fix gamma while training |
| System.Boolean | use_global_stats | Whether use global moving statistics instead of local batch-norm. This will force change batch-norm into a scale shift operator. |
| System.Boolean | output_mean_var | Output All,normal mean and var |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BatchTake(Symbol, Symbol, String)
Takes elements from a data batch.
.. note::
`batch_take` is deprecated. Use `pick` instead.
Given an input array of shape ``(d0, d1)`` and indices of shape ``(i0,)``, the result will be
an output array of shape ``(i0,)`` with::
output[i] = input[i, indices[i]]
Examples::
x = [[ 1., 2.],
[ 3., 4.],
[ 5., 6.]]
// takes elements with specified indices
batch_take(x, [0,1,0]) = [ 1. 4. 5.]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\indexing_op.cc:L753
Declaration
public static Symbol BatchTake(Symbol a, Symbol indices, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | a | The input array |
| Symbol | indices | The index array |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BilinearSampler(Symbol, Symbol, Nullable<Boolean>, String)
Applies bilinear sampling to input feature map.
Bilinear Sampling is the key of [NIPS2015] \"Spatial Transformer Networks\". The usage of the operator is very similar to remap function in OpenCV,
except that the operator has the backward pass.
Given :math:`data` and :math:`grid`, then the output is computed by
.. math::
x_{src} = grid[batch, 0, y_{dst}, x_{dst}] \\
y_{src} = grid[batch, 1, y_{dst}, x_{dst}] \\
output[batch, channel, y_{dst}, x_{dst}] = G(data[batch, channel, y_{src}, x_{src})
:math:`x_{dst}`, :math:`y_{dst}` enumerate all spatial locations in :math:`output`, and :math:`G()` denotes the bilinear interpolation kernel.
The out-boundary points will be padded with zeros.The shape of the output will be (data.shape[0], data.shape[1], grid.shape[2], grid.shape[3]).
The operator assumes that :math:`data` has 'NCHW' layout and :math:`grid` has been normalized to [-1, 1].
BilinearSampler often cooperates with GridGenerator which generates sampling grids for BilinearSampler.
GridGenerator supports two kinds of transformation: ``affine`` and ``warp``.
If users want to design a CustomOp to manipulate :math:`grid`, please firstly refer to the code of GridGenerator.
Example 1::
## Zoom out data two times
data = array([[[[1, 4, 3, 6],
[1, 8, 8, 9],
[0, 4, 1, 5],
[1, 0, 1, 3]]]])
affine_matrix = array([[2, 0, 0],
[0, 2, 0]])
affine_matrix = reshape(affine_matrix, shape=(1, 6))
grid = GridGenerator(data=affine_matrix, transform_type='affine', target_shape=(4, 4))
out = BilinearSampler(data, grid)
out
[[[[ 0, 0, 0, 0],
[ 0, 3.5, 6.5, 0],
[ 0, 1.25, 2.5, 0],
[ 0, 0, 0, 0]]]
Example 2::
## shift data horizontally by -1 pixel
data = array([[[[1, 4, 3, 6],
[1, 8, 8, 9],
[0, 4, 1, 5],
[1, 0, 1, 3]]]])
warp_maxtrix = array([[[[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1]],
[[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]]]])
grid = GridGenerator(data=warp_matrix, transform_type='warp')
out = BilinearSampler(data, grid)
out
[[[[ 4, 3, 6, 0],
[ 8, 8, 9, 0],
[ 4, 1, 5, 0],
[ 0, 1, 3, 0]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\bilinear_sampler.cc:L256
Declaration
public static Symbol BilinearSampler(Symbol data, Symbol grid, bool? cudnn_off = default(bool? ), string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data to the BilinearsamplerOp. |
| Symbol | grid | Input grid to the BilinearsamplerOp.grid has two channels: x_src, y_src |
| System.Nullable<System.Boolean> | cudnn_off | whether to turn cudnn off |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BlockGrad(Symbol, String)
Stops gradient computation.
Stops the accumulated gradient of the inputs from flowing through this operator
in the backward direction. In other words, this operator prevents the contribution
of its inputs to be taken into account for computing gradients.
Example::
v1 = [1, 2]
v2 = [0, 1]
a = Variable('a')
b = Variable('b')
b_stop_grad = stop_gradient(3 * b)
loss = MakeLoss(b_stop_grad + a)
executor = loss.simple_bind(ctx=cpu(), a=(1,2), b=(1,2))
executor.forward(is_train=True, a=v1, b=v2)
executor.outputs
[ 1. 5.]
executor.backward()
executor.grad_arrays
[ 0. 0.]
[ 1. 1.]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L281
Declaration
public static Symbol BlockGrad(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastAdd(Symbol, Symbol, String)
Returns element-wise sum of the input arrays with broadcasting.
`broadcast_plus` is an alias to the function `broadcast_add`.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_add(x, y) = [[ 1., 1., 1.],
[ 2., 2., 2.]]
broadcast_plus(x, y) = [[ 1., 1., 1.],
[ 2., 2., 2.]]
Supported sparse operations:
broadcast_add(csr, dense(1D)) = dense
broadcast_add(dense(1D), csr) = dense
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_basic.cc:L58
Declaration
public static Symbol BroadcastAdd(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastAxis(Symbol, Shape, Shape, String)
Broadcasts the input array over particular axes.
Broadcasting is allowed on axes with size 1, such as from `(2,1,3,1)` to
`(2,8,3,9)`. Elements will be duplicated on the broadcasted axes.
Example::
// given x of shape (1,2,1)
x = [[[ 1.],
[ 2.]]]
// broadcast x on on axis 2
broadcast_axis(x, axis=2, size=3) = [[[ 1., 1., 1.],
[ 2., 2., 2.]]]
// broadcast x on on axes 0 and 2
broadcast_axis(x, axis=(0,2), size=(2,3)) = [[[ 1., 1., 1.],
[ 2., 2., 2.]],
[[ 1., 1., 1.],
[ 2., 2., 2.]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\broadcast_reduce_op_value.cc:L238
Declaration
public static Symbol BroadcastAxis(Symbol data, Shape axis = null, Shape size = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| Shape | axis | The axes to perform the broadcasting. |
| Shape | size | Target sizes of the broadcasting axes. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastDiv(Symbol, Symbol, String)
Returns element-wise division of the input arrays with broadcasting.
Example::
x = [[ 6., 6., 6.],
[ 6., 6., 6.]]
y = [[ 2.],
[ 3.]]
broadcast_div(x, y) = [[ 3., 3., 3.],
[ 2., 2., 2.]]
Supported sparse operations:
broadcast_div(csr, dense(1D)) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_basic.cc:L187
Declaration
public static Symbol BroadcastDiv(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastEqual(Symbol, Symbol, String)
Returns the result of element-wise **equal to** (==) comparison operation with broadcasting.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_equal(x, y) = [[ 0., 0., 0.],
[ 1., 1., 1.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_logic.cc:L46
Declaration
public static Symbol BroadcastEqual(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastGreater(Symbol, Symbol, String)
Returns the result of element-wise **greater than** (>) comparison operation with broadcasting.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_greater(x, y) = [[ 1., 1., 1.],
[ 0., 0., 0.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_logic.cc:L82
Declaration
public static Symbol BroadcastGreater(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastGreaterEqual(Symbol, Symbol, String)
Returns the result of element-wise **greater than or equal to** (>=) comparison operation with broadcasting.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_greater_equal(x, y) = [[ 1., 1., 1.],
[ 1., 1., 1.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_logic.cc:L100
Declaration
public static Symbol BroadcastGreaterEqual(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastHypot(Symbol, Symbol, String)
Returns the hypotenuse of a right angled triangle, given its "legs"
with broadcasting.
It is equivalent to doing :math:`sqrt(x_1^2 + x_2^2)`.
Example::
x = [[ 3., 3., 3.]]
y = [[ 4.],
[ 4.]]
broadcast_hypot(x, y) = [[ 5., 5., 5.],
[ 5., 5., 5.]]
z = [[ 0.],
[ 4.]]
broadcast_hypot(x, z) = [[ 3., 3., 3.],
[ 5., 5., 5.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_extended.cc:L156
Declaration
public static Symbol BroadcastHypot(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastLesser(Symbol, Symbol, String)
Declaration
public static Symbol BroadcastLesser(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | |
| Symbol | rhs | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
BroadcastLesserEqual(Symbol, Symbol, String)
Declaration
public static Symbol BroadcastLesserEqual(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | |
| Symbol | rhs | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
BroadcastLike(Symbol, Symbol, Shape, Shape, String)
Declaration
public static Symbol BroadcastLike(Symbol lhs, Symbol rhs, Shape lhs_axes = null, Shape rhs_axes = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | |
| Symbol | rhs | |
| Shape | lhs_axes | |
| Shape | rhs_axes | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
BroadcastLogicalAnd(Symbol, Symbol, String)
Returns the result of element-wise **logical and** with broadcasting.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_logical_and(x, y) = [[ 0., 0., 0.],
[ 1., 1., 1.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_logic.cc:L154
Declaration
public static Symbol BroadcastLogicalAnd(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastLogicalOr(Symbol, Symbol, String)
Returns the result of element-wise **logical or** with broadcasting.
Example::
x = [[ 1., 1., 0.],
[ 1., 1., 0.]]
y = [[ 1.],
[ 0.]]
broadcast_logical_or(x, y) = [[ 1., 1., 1.],
[ 1., 1., 0.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_logic.cc:L172
Declaration
public static Symbol BroadcastLogicalOr(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastLogicalXor(Symbol, Symbol, String)
Returns the result of element-wise **logical xor** with broadcasting.
Example::
x = [[ 1., 1., 0.],
[ 1., 1., 0.]]
y = [[ 1.],
[ 0.]]
broadcast_logical_xor(x, y) = [[ 0., 0., 1.],
[ 1., 1., 0.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_logic.cc:L190
Declaration
public static Symbol BroadcastLogicalXor(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastMaximum(Symbol, Symbol, String)
Returns element-wise maximum of the input arrays with broadcasting.
This function compares two input arrays and returns a new array having the element-wise maxima.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_maximum(x, y) = [[ 1., 1., 1.],
[ 1., 1., 1.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_extended.cc:L80
Declaration
public static Symbol BroadcastMaximum(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastMinimum(Symbol, Symbol, String)
Returns element-wise minimum of the input arrays with broadcasting.
This function compares two input arrays and returns a new array having the element-wise minima.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_maximum(x, y) = [[ 0., 0., 0.],
[ 1., 1., 1.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_extended.cc:L115
Declaration
public static Symbol BroadcastMinimum(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastMod(Symbol, Symbol, String)
Returns element-wise modulo of the input arrays with broadcasting.
Example::
x = [[ 8., 8., 8.],
[ 8., 8., 8.]]
y = [[ 2.],
[ 3.]]
broadcast_mod(x, y) = [[ 0., 0., 0.],
[ 2., 2., 2.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_basic.cc:L222
Declaration
public static Symbol BroadcastMod(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastMul(Symbol, Symbol, String)
Returns element-wise product of the input arrays with broadcasting.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_mul(x, y) = [[ 0., 0., 0.],
[ 1., 1., 1.]]
Supported sparse operations:
broadcast_mul(csr, dense(1D)) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_basic.cc:L146
Declaration
public static Symbol BroadcastMul(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastNotEqual(Symbol, Symbol, String)
Returns the result of element-wise **not equal to** (!=) comparison operation with broadcasting.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_not_equal(x, y) = [[ 1., 1., 1.],
[ 0., 0., 0.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_logic.cc:L64
Declaration
public static Symbol BroadcastNotEqual(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastPower(Symbol, Symbol, String)
Returns result of first array elements raised to powers from second array, element-wise with broadcasting.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_power(x, y) = [[ 2., 2., 2.],
[ 4., 4., 4.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_extended.cc:L45
Declaration
public static Symbol BroadcastPower(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastSub(Symbol, Symbol, String)
Returns element-wise difference of the input arrays with broadcasting.
`broadcast_minus` is an alias to the function `broadcast_sub`.
Example::
x = [[ 1., 1., 1.],
[ 1., 1., 1.]]
y = [[ 0.],
[ 1.]]
broadcast_sub(x, y) = [[ 1., 1., 1.],
[ 0., 0., 0.]]
broadcast_minus(x, y) = [[ 1., 1., 1.],
[ 0., 0., 0.]]
Supported sparse operations:
broadcast_sub/minus(csr, dense(1D)) = dense
broadcast_sub/minus(dense(1D), csr) = dense
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_broadcast_op_basic.cc:L106
Declaration
public static Symbol BroadcastSub(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input to the function |
| Symbol | rhs | Second input to the function |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
BroadcastTo(Symbol, Shape, String)
Declaration
public static Symbol BroadcastTo(Symbol data, Shape shape = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | |
| Shape | shape | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
CachedOp(SymbolList, String)
Declaration
public static Symbol CachedOp(SymbolList data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| SymbolList | data | input data list |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Cast(Symbol, DType, String)
Casts all elements of the input to a new type.
.. note:: ``Cast`` is deprecated. Use ``cast`` instead.
Example::
cast([0.9, 1.3], dtype='int32') = [0, 1]
cast([1e20, 11.1], dtype='float16') = [inf, 11.09375]
cast([300, 11.1, 10.9, -1, -3], dtype='uint8') = [44, 11, 10, 255, 253]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L619
Declaration
public static Symbol Cast(Symbol data, DType dtype, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input. |
| DType | dtype | Output data type. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
CastStorage(Symbol, StorageStype, String)
Casts tensor storage type to the new type.
When an NDArray with default storage type is cast to csr or row_sparse storage,
the result is compact, which means:
- for csr, zero values will not be retained
- for row_sparse, row slices of all zeros will not be retained
The storage type of ``cast_storage`` output depends on stype parameter:
- cast_storage(csr, 'default') = default
- cast_storage(row_sparse, 'default') = default
- cast_storage(default, 'csr') = csr
- cast_storage(default, 'row_sparse') = row_sparse
- cast_storage(csr, 'csr') = csr
- cast_storage(row_sparse, 'row_sparse') = row_sparse
Example::
dense = [[ 0., 1., 0.],
[ 2., 0., 3.],
[ 0., 0., 0.],
[ 0., 0., 0.]]
# cast to row_sparse storage type
rsp = cast_storage(dense, 'row_sparse')
rsp.indices = [0, 1]
rsp.values = [[ 0., 1., 0.],
[ 2., 0., 3.]]
# cast to csr storage type
csr = cast_storage(dense, 'csr')
csr.indices = [1, 0, 2]
csr.values = [ 1., 2., 3.]
csr.indptr = [0, 1, 3, 3, 3]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\cast_storage.cc:L71
Declaration
public static Symbol CastStorage(Symbol data, StorageStype stype, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input. |
| StorageStype | stype | Output storage type. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Cbrt(Symbol, String)
Returns element-wise cube-root value of the input.
.. math::
cbrt(x) = \sqrt[3]{x}
Example::
cbrt([1, 8, -125]) = [1, 2, -5]
The storage type of ``cbrt`` output depends upon the input storage type:
- cbrt(default) = default
- cbrt(row_sparse) = row_sparse
- cbrt(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L906
Declaration
public static Symbol Cbrt(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Ceil(Symbol, String)
Returns element-wise ceiling of the input.
The ceil of the scalar x is the smallest integer i, such that i >= x.
Example::
ceil([-2.1, -1.9, 1.5, 1.9, 2.1]) = [-2., -1., 2., 2., 3.]
The storage type of ``ceil`` output depends upon the input storage type:
- ceil(default) = default
- ceil(row_sparse) = row_sparse
- ceil(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L763
Declaration
public static Symbol Ceil(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Clip(Symbol, Single, Single, String)
Declaration
public static Symbol Clip(Symbol data, float a_min, float a_max, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | |
| System.Single | a_min | |
| System.Single | a_max | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
Concat(SymbolList, Int32, String)
Joins input arrays along a given axis.
.. note:: `Concat` is deprecated. Use `concat` instead.
The dimensions of the input arrays should be the same except the axis along
which they will be concatenated.
The dimension of the output array along the concatenated axis will be equal
to the sum of the corresponding dimensions of the input arrays.
The storage type of ``concat`` output depends on storage types of inputs
- concat(csr, csr, ..., csr, dim=0) = csr
- otherwise, ``concat`` generates output with default storage
Example::
x = [[1,1],[2,2]]
y = [[3,3],[4,4],[5,5]]
z = [[6,6], [7,7],[8,8]]
concat(x,y,z,dim=0) = [[ 1., 1.],
[ 2., 2.],
[ 3., 3.],
[ 4., 4.],
[ 5., 5.],
[ 6., 6.],
[ 7., 7.],
[ 8., 8.]]
Note that you cannot concat x,y,z along dimension 1 since dimension
0 is not the same for all the input arrays.
concat(y,z,dim=1) = [[ 3., 3., 6., 6.],
[ 4., 4., 7., 7.],
[ 5., 5., 8., 8.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\nn\concat.cc:L371
Declaration
public static Symbol Concat(SymbolList data, int dim = 1, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| SymbolList | data | List of arrays to concatenate |
| System.Int32 | dim | the dimension to be concated. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Cond(Symbol, Symbol, Symbol, SymbolList, Int32, Int32, Tuple<Double>, Tuple<Double>, Tuple<Double>, String)
Run a if-then-else using user-defined condition and computation
From:C:\Jenkins\workspace\mxnet\mxnet\src\operator\control_flow.cc:1379
Declaration
public static Symbol Cond(Symbol cond, Symbol then_branch, Symbol else_branch, SymbolList data, int num_args, int num_outputs, Tuple<double> cond_input_locs, Tuple<double> then_input_locs, Tuple<double> else_input_locs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | cond | Input graph for the condition. |
| Symbol | then_branch | Input graph for the then branch. |
| Symbol | else_branch | Input graph for the else branch. |
| SymbolList | data | The input arrays that include data arrays and states. |
| System.Int32 | num_args | Number of input arguments, including cond, then and else as three symbol inputs. |
| System.Int32 | num_outputs | The number of outputs of the subgraph. |
| Tuple<System.Double> | cond_input_locs | The locations of cond's inputs in the given inputs. |
| Tuple<System.Double> | then_input_locs | The locations of then's inputs in the given inputs. |
| Tuple<System.Double> | else_input_locs | The locations of else's inputs in the given inputs. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Convolution(Symbol, Symbol, Symbol, Shape, Int32, Shape, Shape, Shape, Int32, UInt64, Boolean, Nullable<ConvolutionCudnnTune>, Boolean, Nullable<ConvolutionLayout>, String)
Compute *N*-D convolution on *(N+2)*-D input.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\nn\convolution.cc:L472
Declaration
public static Symbol Convolution(Symbol data, Symbol weight, Symbol bias, Shape kernel, int num_filter, Shape stride = null, Shape dilate = null, Shape pad = null, int num_group = 1, ulong workspace = 1024UL, bool no_bias = true, ConvolutionCudnnTune? cudnn_tune = default(ConvolutionCudnnTune? ), bool cudnn_off = false, ConvolutionLayout? layout = default(ConvolutionLayout? ), string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data to the ConvolutionOp. |
| Symbol | weight | Weight matrix. |
| Symbol | bias | Bias parameter. |
| Shape | kernel | Convolution kernel size: (w,), (h, w) or (d, h, w) |
| System.Int32 | num_filter | Convolution filter(channel) number |
| Shape | stride | Convolution stride: (w,), (h, w) or (d, h, w). Defaults to 1 for each dimension. |
| Shape | dilate | Convolution dilate: (w,), (h, w) or (d, h, w). Defaults to 1 for each dimension. |
| Shape | pad | Zero pad for convolution: (w,), (h, w) or (d, h, w). Defaults to no padding. |
| System.Int32 | num_group | Number of group partitions. |
| System.UInt64 | workspace | Maximum temporary workspace allowed (MB) in convolution.This parameter has two usages. When
CUDNN is not used, it determines the effective batch size of the convolution kernel. When CUDNN is used, it
controls the maximum temporary storage used for tuning the best CUDNN kernel when |
| System.Boolean | no_bias | Whether to disable bias parameter. |
| System.Nullable<ConvolutionCudnnTune> | cudnn_tune | Whether to pick convolution algo by running performance test. |
| System.Boolean | cudnn_off | Turn off cudnn for this layer. |
| System.Nullable<ConvolutionLayout> | layout | Set layout for input, output and weight. Empty for default layout: NCW for 1d, NCHW for 2d and NCDHW for 3d.NHWC and NDHWC are only supported on GPU. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
ConvolutionV1(Symbol, Symbol, Symbol, Shape, UInt32, Shape, Shape, Shape, UInt32, UInt64, Boolean, Nullable<ConvolutionV1CudnnTune>, Boolean, Nullable<ConvolutionV1Layout>, String)
This operator is DEPRECATED. Apply convolution to input then add a bias.
Declaration
public static Symbol ConvolutionV1(Symbol data, Symbol weight, Symbol bias, Shape kernel, uint num_filter, Shape stride = null, Shape dilate = null, Shape pad = null, uint num_group = 1U, ulong workspace = 1024UL, bool no_bias = false, ConvolutionV1CudnnTune? cudnn_tune = default(ConvolutionV1CudnnTune? ), bool cudnn_off = false, ConvolutionV1Layout? layout = default(ConvolutionV1Layout? ), string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data to the ConvolutionV1Op. |
| Symbol | weight | Weight matrix. |
| Symbol | bias | Bias parameter. |
| Shape | kernel | convolution kernel size: (h, w) or (d, h, w) |
| System.UInt32 | num_filter | convolution filter(channel) number |
| Shape | stride | convolution stride: (h, w) or (d, h, w) |
| Shape | dilate | convolution dilate: (h, w) or (d, h, w) |
| Shape | pad | pad for convolution: (h, w) or (d, h, w) |
| System.UInt32 | num_group | Number of group partitions. Equivalent to slicing input into num_group partitions, apply convolution on each, then concatenate the results |
| System.UInt64 | workspace | Maximum temporary workspace allowed for convolution (MB).This parameter determines the effective batch size of the convolution kernel, which may be smaller than the given batch size. Also, the workspace will be automatically enlarged to make sure that we can run the kernel with batch_size=1 |
| System.Boolean | no_bias | Whether to disable bias parameter. |
| System.Nullable<ConvolutionV1CudnnTune> | cudnn_tune | Whether to pick convolution algo by running performance test. Leads to higher startup time but may give faster speed. Options are: 'off': no tuning 'limited_workspace': run test and pick the fastest algorithm that doesn't exceed workspace limit. 'fastest': pick the fastest algorithm and ignore workspace limit. If set to None (default), behavior is determined by environment variable MXNET_CUDNN_AUTOTUNE_DEFAULT: 0 for off, 1 for limited workspace (default), 2 for fastest. |
| System.Boolean | cudnn_off | Turn off cudnn for this layer. |
| System.Nullable<ConvolutionV1Layout> | layout | Set layout for input, output and weight. Empty for default layout: NCHW for 2d and NCDHW for 3d. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Copy(Symbol, String)
Returns a copy of the input.
From:C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:200
Declaration
public static Symbol Copy(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Copyto(Symbol, String)
Declaration
public static Symbol Copyto(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | input data |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Correlation(Symbol, Symbol, UInt32, UInt32, UInt32, UInt32, UInt32, Boolean, String)
Declaration
public static Symbol Correlation(Symbol data1, Symbol data2, uint kernel_size = 1U, uint max_displacement = 1U, uint stride1 = 1U, uint stride2 = 1U, uint pad_size = 0U, bool is_multiply = true, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data1 | |
| Symbol | data2 | |
| System.UInt32 | kernel_size | |
| System.UInt32 | max_displacement | |
| System.UInt32 | stride1 | |
| System.UInt32 | stride2 | |
| System.UInt32 | pad_size | |
| System.Boolean | is_multiply | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
Cos(Symbol, String)
Computes the element-wise cosine of the input array.
The input should be in radians (:math:`2\pi` rad equals 360 degrees).
.. math::
cos([0, \pi/4, \pi/2]) = [1, 0.707, 0]
The storage type of ``cos`` output is always dense
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_trig.cc:L63
Declaration
public static Symbol Cos(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Cosh(Symbol, String)
Returns the hyperbolic cosine of the input array, computed element-wise.
.. math::
cosh(x) = 0.5\times(exp(x) + exp(-x))
The storage type of ``cosh`` output is always dense
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_trig.cc:L216
Declaration
public static Symbol Cosh(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Crop(SymbolList, Int32, Shape, Shape, Boolean, String)
.. note:: `Crop` is deprecated. Use `slice` instead.
Crop the 2nd and 3rd dim of input data, with the corresponding size of h_w or
with width and height of the second input symbol, i.e., with one input, we need h_w to
specify the crop height and width, otherwise the second input symbol's size will be used
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\crop.cc:L50
Declaration
public static Symbol Crop(SymbolList data, int num_args, Shape offset = null, Shape h_w = null, bool center_crop = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| SymbolList | data | Tensor or List of Tensors, the second input will be used as crop_like shape reference |
| System.Int32 | num_args | Number of inputs for crop, if equals one, then we will use the h_wfor crop height and width, else if equals two, then we will use the heightand width of the second input symbol, we name crop_like here |
| Shape | offset | crop offset coordinate: (y, x) |
| Shape | h_w | crop height and width: (h, w) |
| System.Boolean | center_crop | If set to true, then it will use be the center_crop,or it will crop using the shape of crop_like |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
CrossDeviceCopy(String)
Special op to copy data cross device
Declaration
public static Symbol CrossDeviceCopy(string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
CTCLoss(Symbol, Symbol, Symbol, Symbol, Boolean, Boolean, CtclossBlankLabel, String)
Connectionist Temporal Classification Loss.
.. note:: The existing alias ``contrib_CTCLoss`` is deprecated.
The shapes of the inputs and outputs:
- **data**: `(sequence_length, batch_size, alphabet_size)`
- **label**: `(batch_size, label_sequence_length)`
- **out**: `(batch_size)`
The `data` tensor consists of sequences of activation vectors (without applying softmax),
with i-th channel in the last dimension corresponding to i-th label
for i between 0 and alphabet_size-1 (i.e always 0-indexed).
Alphabet size should include one additional value reserved for blank label.
When `blank_label` is ``"first"``, the ``0``-th channel is be reserved for
activation of blank label, or otherwise if it is "last", ``(alphabet_size-1)``-th channel should be
reserved for blank label.
``label`` is an index matrix of integers. When `blank_label` is ``"first"``,
the value 0 is then reserved for blank label, and should not be passed in this matrix. Otherwise,
when `blank_label` is ``"last"``, the value `(alphabet_size-1)` is reserved for blank label.
If a sequence of labels is shorter than *label_sequence_length*, use the special
padding value at the end of the sequence to conform it to the correct
length. The padding value is `0` when `blank_label` is ``"first"``, and `-1` otherwise.
For example, suppose the vocabulary is `[a, b, c]`, and in one batch we have three sequences
'ba', 'cbb', and 'abac'. When `blank_label` is ``"first"``, we can index the labels as
`{'a': 1, 'b': 2, 'c': 3}`, and we reserve the 0-th channel for blank label in data tensor.
The resulting `label` tensor should be padded to be::
[[2, 1, 0, 0], [3, 2, 2, 0], [1, 2, 1, 3]]
When `blank_label` is ``"last"``, we can index the labels as
`{'a': 0, 'b': 1, 'c': 2}`, and we reserve the channel index 3 for blank label in data tensor.
The resulting `label` tensor should be padded to be::
[[1, 0, -1, -1], [2, 1, 1, -1], [0, 1, 0, 2]]
``out`` is a list of CTC loss values, one per example in the batch.
See *Connectionist Temporal Classification: Labelling Unsegmented
Sequence Data with Recurrent Neural Networks*, A. Graves *et al*. for more
information on the definition and the algorithm.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\nn\ctc_loss.cc:L100
Declaration
public static Symbol CTCLoss(Symbol data, Symbol label, Symbol data_lengths, Symbol label_lengths, bool use_data_lengths = false, bool use_label_lengths = false, CtclossBlankLabel blank_label = CtclossBlankLabel.First, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input ndarray |
| Symbol | label | Ground-truth labels for the loss. |
| Symbol | data_lengths | Lengths of data for each of the samples. Only required when use_data_lengths is true. |
| Symbol | label_lengths | Lengths of labels for each of the samples. Only required when use_label_lengths is true. |
| System.Boolean | use_data_lengths | Whether the data lenghts are decided by |
| System.Boolean | use_label_lengths | Whether the label lenghts are decided by |
| CtclossBlankLabel | blank_label | Set the label that is reserved for blank label.If "first", 0-th label is reserved, and label
values for tokens in the vocabulary are between |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Custom(SymbolList, String, String)
Apply a custom operator implemented in a frontend language (like Python).
Custom operators should override required methods like `forward` and `backward`.
The custom operator must be registered before it can be used.
Please check the tutorial here: http://mxnet.io/faq/new_op.html.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\custom\custom.cc:L546
Declaration
public static Symbol Custom(SymbolList data, string op_type, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| SymbolList | data | Input data for the custom operator. |
| System.String | op_type | Name of the custom operator. This is the name that is passed to |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
CustomFunction(String)
Declaration
public static Symbol CustomFunction(string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
CvcopyMakeBorder(Symbol, Int32, Int32, Int32, Int32, Int32, Tuple<Double>, String)
Pad image border with OpenCV.
Declaration
public static Symbol CvcopyMakeBorder(Symbol data, int top, int bot, int left, int right, int type = 0, Tuple<double> values = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | source image |
| System.Int32 | top | Top margin. |
| System.Int32 | bot | Bottom margin. |
| System.Int32 | left | Left margin. |
| System.Int32 | right | Right margin. |
| System.Int32 | type | Filling type (default=cv2.BORDER_CONSTANT). |
| Tuple<System.Double> | values | Fill with value(RGB[A] or gray), up to 4 channels. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Cvimdecode(Symbol, Int32, Boolean, String)
Decode image with OpenCV.
Note: return image in RGB by default, instead of OpenCV's default BGR.
Declaration
public static Symbol Cvimdecode(Symbol buf, int flag = 1, bool to_rgb = true, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | buf | Buffer containing binary encoded image |
| System.Int32 | flag | Convert decoded image to grayscale (0) or color (1). |
| System.Boolean | to_rgb | Whether to convert decoded image to mxnet's default RGB format (instead of opencv's default BGR). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Cvimread(String, Int32, Boolean, String)
Read and decode image with OpenCV.
Note: return image in RGB by default, instead of OpenCV's default BGR.
Declaration
public static Symbol Cvimread(string filename, int flag = 1, bool to_rgb = true, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | filename | Name of the image file to be loaded. |
| System.Int32 | flag | Convert decoded image to grayscale (0) or color (1). |
| System.Boolean | to_rgb | Whether to convert decoded image to mxnet's default RGB format (instead of opencv's default BGR). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Cvimresize(Symbol, Int32, Int32, Int32, String)
Resize image with OpenCV.
Declaration
public static Symbol Cvimresize(Symbol data, int w, int h, int interp = 1, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | source image |
| System.Int32 | w | Width of resized image. |
| System.Int32 | h | Height of resized image. |
| System.Int32 | interp | Interpolation method (default=cv2.INTER_LINEAR). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Deconvolution(Symbol, Symbol, Shape, UInt32, Shape, Shape, Shape, Shape, Shape, Symbol, Boolean, UInt32, UInt64, Nullable<DeconvolutionCudnnTune>, Boolean, Nullable<DeconvolutionLayout>, String)
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.
Declaration
public static Symbol Deconvolution(Symbol data, Symbol weight, Shape kernel, uint num_filter, Shape stride = null, Shape dilate = null, Shape pad = null, Shape adj = null, Shape target_shape = null, Symbol bias = null, bool no_bias = true, uint num_group = 1U, ulong workspace = 512UL, DeconvolutionCudnnTune? cudnn_tune = default(DeconvolutionCudnnTune? ), bool cudnn_off = false, DeconvolutionLayout? layout = default(DeconvolutionLayout? ), string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input tensor to the deconvolution operation. |
| Symbol | weight | Weights representing the kernel. |
| Shape | kernel | Deconvolution kernel size: (w,), (h, w) or (d, h, w). This is same as the kernel size used for the corresponding convolution |
| System.UInt32 | num_filter | Number of output filters. |
| Shape | stride | The stride used for the corresponding convolution: (w,), (h, w) or (d, h, w). Defaults to 1 for each dimension. |
| Shape | dilate | Dilation factor for each dimension of the input: (w,), (h, w) or (d, h, w). Defaults to 1 for each dimension. |
| Shape | pad | The amount of implicit zero padding added during convolution for each dimension of the input: (w,),
(h, w) or (d, h, w). |
| Shape | adj | Adjustment for output shape: (w,), (h, w) or (d, h, w). If |
| Shape | target_shape | Shape of the output tensor: (w,), (h, w) or (d, h, w). |
| Symbol | bias | Bias added to the result after the deconvolution operation. |
| System.Boolean | no_bias | Whether to disable bias parameter. |
| System.UInt32 | num_group | Number of groups partition. |
| System.UInt64 | workspace | Maximum temporary workspace allowed (MB) in deconvolution.This parameter has two usages. When
CUDNN is not used, it determines the effective batch size of the deconvolution kernel. When CUDNN is used, it
controls the maximum temporary storage used for tuning the best CUDNN kernel when |
| System.Nullable<DeconvolutionCudnnTune> | cudnn_tune | Whether to pick convolution algorithm by running performance test. |
| System.Boolean | cudnn_off | Turn off cudnn for this layer. |
| System.Nullable<DeconvolutionLayout> | layout | Set layout for input, output and weight. Empty for default layout, NCW for 1d, NCHW for 2d and NCDHW for 3d.NHWC and NDHWC are only supported on GPU. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Degrees(Symbol, String)
Converts each element of the input array from radians to degrees.
.. math::
degrees([0, \pi/2, \pi, 3\pi/2, 2\pi]) = [0, 90, 180, 270, 360]
The storage type of ``degrees`` output depends upon the input storage type:
- degrees(default) = default
- degrees(row_sparse) = row_sparse
- degrees(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_trig.cc:L163
Declaration
public static Symbol Degrees(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
DepthToSpace(Symbol, Int32, String)
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``.
.. math::
\begin{gather*}
x \prime = reshape(x, [N, block\_size, block\_size, C / (block\_size ^ 2), H * block\_size, W * block\_size]) \\
x \prime \prime = transpose(x \prime, [0, 3, 4, 1, 5, 2]) \\
y = reshape(x \prime \prime, [N, C / (block\_size ^ 2), H * block\_size, W * block\_size])
\end{gather*}
where :math:`x` is an input tensor with default layout as :math:`[N, C, H, W]`: [batch, channels, height, width]
and :math:`y` is the output tensor of layout :math:`[N, C / (block\_size ^ 2), H * block\_size, W * block\_size]`
Example::
x = [[[[0, 1, 2],
[3, 4, 5]],
[[6, 7, 8],
[9, 10, 11]],
[[12, 13, 14],
[15, 16, 17]],
[[18, 19, 20],
[21, 22, 23]]]]
depth_to_space(x, 2) = [[[[0, 6, 1, 7, 2, 8],
[12, 18, 13, 19, 14, 20],
[3, 9, 4, 10, 5, 11],
[15, 21, 16, 22, 17, 23]]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\matrix_op.cc:L1074
Declaration
public static Symbol DepthToSpace(Symbol data, int block_size, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input ndarray |
| System.Int32 | block_size | Blocks of [block_size. block_size] are moved |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Diag(Symbol, Int32, Int32, Int32, String)
Declaration
public static Symbol Diag(Symbol data, int k = 0, int axis1 = 0, int axis2 = 1, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | |
| System.Int32 | k | |
| System.Int32 | axis1 | |
| System.Int32 | axis2 | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
DivScalar(Symbol, Single, String)
Divide an array with a scalar.
``_div_scalar`` only operates on data array of input if input is sparse.
For example, if input of shape (100, 100) has only 2 non zero elements,
i.e. input.data = [5, 6], scalar = nan,
it will result output.data = [nan, nan] instead of 10000 nans.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_scalar_op_basic.cc:L171
Declaration
public static Symbol DivScalar(Symbol data, float scalar, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | source input |
| System.Single | scalar | scalar input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Dot(Symbol, Symbol, Boolean, Boolean, Nullable<DotForwardStype>, String)
Dot product of two arrays.
``dot``'s behavior depends on the input array dimensions:
- 1-D arrays: inner product of vectors
- 2-D arrays: matrix multiplication
- N-D arrays: a sum product over the last axis of the first input and the first
axis of the second input
For example, given 3-D ``x`` with shape `(n,m,k)` and ``y`` with shape `(k,r,s)`, the
result array will have shape `(n,m,r,s)`. It is computed by::
dot(x,y)[i,j,a,b] = sum(x[i,j,:]*y[:,a,b])
Example::
x = reshape([0,1,2,3,4,5,6,7], shape=(2,2,2))
y = reshape([7,6,5,4,3,2,1,0], shape=(2,2,2))
dot(x,y)[0,0,1,1] = 0
sum(x[0,0,:]*y[:,1,1]) = 0
The storage type of ``dot`` output depends on storage types of inputs, transpose option and
forward_stype option for output storage type. Implemented sparse operations include:
- dot(default, default, transpose_a=True/False, transpose_b=True/False) = default
- dot(csr, default, transpose_a=True) = default
- dot(csr, default, transpose_a=True) = row_sparse
- dot(csr, default) = default
- dot(csr, row_sparse) = default
- dot(default, csr) = csr (CPU only)
- dot(default, csr, forward_stype='default') = default
- dot(default, csr, transpose_b=True, forward_stype='default') = default
If the combination of input storage types and forward_stype does not match any of the
above patterns, ``dot`` will fallback and generate output with default storage.
.. Note::
If the storage type of the lhs is "csr", the storage type of gradient w.r.t rhs will be
"row_sparse". Only a subset of optimizers support sparse gradients, including SGD, AdaGrad
and Adam. Note that by default lazy updates is turned on, which may perform differently
from standard updates. For more details, please check the Optimization API at:
https://mxnet.incubator.apache.org/api/python/optimization/optimization.html
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\dot.cc:L77
Declaration
public static Symbol Dot(Symbol lhs, Symbol rhs, bool transpose_a = false, bool transpose_b = false, DotForwardStype? forward_stype = default(DotForwardStype? ), string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | The first input |
| Symbol | rhs | The second input |
| System.Boolean | transpose_a | If true then transpose the first input before dot. |
| System.Boolean | transpose_b | If true then transpose the second input before dot. |
| System.Nullable<DotForwardStype> | forward_stype | The desired storage type of the forward output given by user, if thecombination of input storage types and this hint does not matchany implemented ones, the dot operator will perform fallback operationand still produce an output of the desired storage type. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Dropout(Symbol, Single, DropoutMode, Shape, Nullable<Boolean>, String)
Applies dropout operation to input array.
- During training, each element of the input is set to zero with probability p.
The whole array is rescaled by :math:`1/(1-p)` to keep the expected
sum of the input unchanged.
- During testing, this operator does not change the input if mode is 'training'.
If mode is 'always', the same computaion as during training will be applied.
Example::
random.seed(998)
input_array = array([[3., 0.5, -0.5, 2., 7.],
[2., -0.4, 7., 3., 0.2]])
a = symbol.Variable('a')
dropout = symbol.Dropout(a, p = 0.2)
executor = dropout.simple_bind(a = input_array.shape)
## If training
executor.forward(is_train = True, a = input_array)
executor.outputs
[[ 3.75 0.625 -0. 2.5 8.75 ]
[ 2.5 -0.5 8.75 3.75 0. ]]
## If testing
executor.forward(is_train = False, a = input_array)
executor.outputs
[[ 3. 0.5 -0.5 2. 7. ]
[ 2. -0.4 7. 3. 0.2 ]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\nn\dropout.cc:L76
Declaration
public static Symbol Dropout(Symbol data, float p = 0.5F, DropoutMode mode = DropoutMode.Training, Shape axes = null, bool? cudnn_off, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input array to which dropout will be applied. |
| System.Single | p | Fraction of the input that gets dropped out during training time. |
| DropoutMode | mode | Whether to only turn on dropout during training or to also turn on for inference. |
| Shape | axes | Axes for variational dropout kernel. |
| System.Nullable<System.Boolean> | cudnn_off | Whether to turn off cudnn in dropout operator. This option is ignored if axes is specified. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
ElemwiseAdd(Symbol, Symbol, String)
Adds arguments element-wise.
The storage type of ``elemwise_add`` output depends on storage types of inputs
- elemwise_add(row_sparse, row_sparse) = row_sparse
- elemwise_add(csr, csr) = csr
- elemwise_add(default, csr) = default
- elemwise_add(csr, default) = default
- elemwise_add(default, rsp) = default
- elemwise_add(rsp, default) = default
- otherwise, ``elemwise_add`` generates output with default storage
Declaration
public static Symbol ElemwiseAdd(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | first input |
| Symbol | rhs | second input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
ElemwiseDiv(Symbol, Symbol, String)
Divides arguments element-wise.
The storage type of ``elemwise_div`` output is always dense
Declaration
public static Symbol ElemwiseDiv(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | first input |
| Symbol | rhs | second input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
ElemwiseMul(Symbol, Symbol, String)
Multiplies arguments element-wise.
The storage type of ``elemwise_mul`` output depends on storage types of inputs
- elemwise_mul(default, default) = default
- elemwise_mul(row_sparse, row_sparse) = row_sparse
- elemwise_mul(default, row_sparse) = row_sparse
- elemwise_mul(row_sparse, default) = row_sparse
- elemwise_mul(csr, csr) = csr
- otherwise, ``elemwise_mul`` generates output with default storage
Declaration
public static Symbol ElemwiseMul(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | first input |
| Symbol | rhs | second input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
ElemwiseSub(Symbol, Symbol, String)
Subtracts arguments element-wise.
The storage type of ``elemwise_sub`` output depends on storage types of inputs
- elemwise_sub(row_sparse, row_sparse) = row_sparse
- elemwise_sub(csr, csr) = csr
- elemwise_sub(default, csr) = default
- elemwise_sub(csr, default) = default
- elemwise_sub(default, rsp) = default
- elemwise_sub(rsp, default) = default
- otherwise, ``elemwise_sub`` generates output with default storage
Declaration
public static Symbol ElemwiseSub(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | first input |
| Symbol | rhs | second input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Embedding(Symbol, Symbol, Int32, Int32, DType, Boolean, String)
Maps integer indices to vector representations (embeddings).
This operator maps words to real-valued vectors in a high-dimensional space,
called word embeddings. These embeddings can capture semantic and syntactic properties of the words.
For example, it has been noted that in the learned embedding spaces, similar words tend
to be close to each other and dissimilar words far apart.
For an input array of shape (d1, ..., dK),
the shape of an output array is (d1, ..., dK, output_dim).
All the input values should be integers in the range [0, input_dim).
If the input_dim is ip0 and output_dim is op0, then shape of the embedding weight matrix must be
(ip0, op0).
By default, if any index mentioned is too large, it is replaced by the index that addresses
the last vector in an embedding matrix.
Examples::
input_dim = 4
output_dim = 5
// Each row in weight matrix y represents a word. So, y = (w0,w1,w2,w3)
y = [[ 0., 1., 2., 3., 4.],
[ 5., 6., 7., 8., 9.],
[ 10., 11., 12., 13., 14.],
[ 15., 16., 17., 18., 19.]]
// Input array x represents n-grams(2-gram). So, x = [(w1,w3), (w0,w2)]
x = [[ 1., 3.],
[ 0., 2.]]
// Mapped input x to its vector representation y.
Embedding(x, y, 4, 5) = [[[ 5., 6., 7., 8., 9.],
[ 15., 16., 17., 18., 19.]],
[[ 0., 1., 2., 3., 4.],
[ 10., 11., 12., 13., 14.]]]
The storage type of weight can be either row_sparse or default.
.. Note::
If "sparse_grad" is set to True, the storage type of gradient w.r.t weights will be
"row_sparse". Only a subset of optimizers support sparse gradients, including SGD, AdaGrad
and Adam. Note that by default lazy updates is turned on, which may perform differently
from standard updates. For more details, please check the Optimization API at:
https://mxnet.incubator.apache.org/api/python/optimization/optimization.html
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\indexing_op.cc:L519
Declaration
public static Symbol Embedding(Symbol data, Symbol weight, int input_dim, int output_dim, DType dtype = null, bool sparse_grad = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array to the embedding operator. |
| Symbol | weight | The embedding weight matrix. |
| System.Int32 | input_dim | Vocabulary size of the input indices. |
| System.Int32 | output_dim | Dimension of the embedding vectors. |
| DType | dtype | Data type of weight. |
| System.Boolean | sparse_grad | Compute row sparse gradient in the backward calculation. If set to True, the grad's storage type is row_sparse. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Empty(Shape, Context, DType, String)
Declaration
public static Symbol Empty(Shape shape = null, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Shape | shape | |
| Context | ctx | |
| DType | dtype | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
Equal(Symbol, Symbol, String)
Declaration
public static Symbol Equal(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | first input |
| Symbol | rhs | second input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
EqualScalar(Symbol, Single, String)
Declaration
public static Symbol EqualScalar(Symbol data, float scalar, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | source input |
| System.Single | scalar | scalar input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Erf(Symbol, String)
Returns element-wise gauss error function of the input.
Example::
erf([0, -1., 10.]) = [0., -0.8427, 1.]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L920
Declaration
public static Symbol Erf(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Erfinv(Symbol, String)
Returns element-wise inverse gauss error function of the input.
Example::
erfinv([0, 0.5., -1.]) = [0., 0.4769, -inf]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L936
Declaration
public static Symbol Erfinv(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Exp(Symbol, String)
Returns element-wise exponential value of the input.
.. math::
exp(x) = e^x \approx 2.718^x
Example::
exp([0, 1, 2]) = [1., 2.71828175, 7.38905621]
The storage type of ``exp`` output is always dense
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L978
Declaration
public static Symbol Exp(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
ExpandDims(Symbol, Int32, String)
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)``.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\matrix_op.cc:L440
Declaration
public static Symbol ExpandDims(Symbol data, int axis, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Source input |
| System.Int32 | axis | Position where new axis is to be inserted. Suppose that the input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Expm1(Symbol, String)
Returns ``exp(x) - 1`` computed element-wise on the input.
This function provides greater precision than ``exp(x) - 1`` for small values of ``x``.
The storage type of ``expm1`` output depends upon the input storage type:
- expm1(default) = default
- expm1(row_sparse) = row_sparse
- expm1(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L1058
Declaration
public static Symbol Expm1(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Eye(Tuple<Double>, Int32, Int32, Context, DType, String)
Return a 2-D array with ones on the diagonal and zeros elsewhere.
Declaration
public static Symbol Eye(Tuple<double> N, int M = 0, int k = 0, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Tuple<System.Double> | N | Number of rows in the output. |
| System.Int32 | M | Number of columns in the output. If 0, defaults to N |
| System.Int32 | k | Index of the diagonal. 0 (the default) refers to the main diagonal.A positive value refers to an upper diagonal.A negative value to a lower diagonal. |
| Context | ctx | Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls. |
| DType | dtype | Target data type. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
FillElement0Index(Symbol, Symbol, Symbol, String)
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.
Declaration
public static Symbol FillElement0Index(Symbol lhs, Symbol mhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | Left operand to the function. |
| Symbol | mhs | Middle operand to the function. |
| Symbol | rhs | Right operand to the function. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Fix(Symbol, String)
Returns element-wise rounded value to the nearest \
integer towards zero of the input.
Example::
fix([-2.1, -1.9, 1.9, 2.1]) = [-2., -1., 1., 2.]
The storage type of ``fix`` output depends upon the input storage type:
- fix(default) = default
- fix(row_sparse) = row_sparse
- fix(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L820
Declaration
public static Symbol Fix(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Flatten(Symbol, String)
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 bahavior of this function is different from numpy.ndarray.flatten,
which behaves similar to mxnet.ndarray.reshape((-1,)).
Example::
x = [[
[1,2,3],
[4,5,6],
[7,8,9]
],
[ [1,2,3],
[4,5,6],
[7,8,9]
]],
flatten(x) = [[ 1., 2., 3., 4., 5., 6., 7., 8., 9.],
[ 1., 2., 3., 4., 5., 6., 7., 8., 9.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\matrix_op.cc:L315
Declaration
public static Symbol Flatten(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Floor(Symbol, String)
Declaration
public static Symbol Floor(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
Foreach(Symbol, SymbolList, Int32, Int32, Int32, Tuple<Double>, Tuple<Double>, Tuple<Double>, String)
Run a for loop over an NDArray with user-defined computation
From:C:\Jenkins\workspace\mxnet\mxnet\src\operator\control_flow.cc:1256
Declaration
public static Symbol Foreach(Symbol fn, SymbolList data, int num_args, int num_outputs, int num_out_data, Tuple<double> in_state_locs, Tuple<double> in_data_locs, Tuple<double> remain_locs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | fn | Input graph. |
| SymbolList | data | The input arrays that include data arrays and states. |
| System.Int32 | num_args | Number of inputs. |
| System.Int32 | num_outputs | The number of outputs of the subgraph. |
| System.Int32 | num_out_data | The number of output data of the subgraph. |
| Tuple<System.Double> | in_state_locs | The locations of loop states among the inputs. |
| Tuple<System.Double> | in_data_locs | The locations of input data among the inputs. |
| Tuple<System.Double> | remain_locs | The locations of remaining data among the inputs. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
FtmlUpdate(Symbol, Symbol, Symbol, Symbol, Symbol, Single, Int32, Single, Single, Double, Single, Single, Single, String)
Declaration
public static Symbol FtmlUpdate(Symbol weight, Symbol grad, Symbol d, Symbol v, Symbol z, float lr, int t, float beta1 = 0.6F, float beta2 = 0.999F, double epsilon = 1E-08, float wd = 0F, float rescale_grad = 1F, float clip_grad = -1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | weight | |
| Symbol | grad | |
| Symbol | d | |
| Symbol | v | |
| Symbol | z | |
| System.Single | lr | |
| System.Int32 | t | |
| System.Single | beta1 | |
| System.Single | beta2 | |
| System.Double | epsilon | |
| System.Single | wd | |
| System.Single | rescale_grad | |
| System.Single | clip_grad | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
FtrlUpdate(Symbol, Symbol, Symbol, Symbol, Single, Single, Single, Single, Single, Single, String)
Declaration
public static Symbol FtrlUpdate(Symbol weight, Symbol grad, Symbol z, Symbol n, float lr, float lamda1 = 0.01F, float beta = 1F, float wd = 0F, float rescale_grad = 1F, float clip_gradient = -1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | weight | |
| Symbol | grad | |
| Symbol | z | |
| Symbol | n | |
| System.Single | lr | |
| System.Single | lamda1 | |
| System.Single | beta | |
| System.Single | wd | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
Full(Double, Shape, Context, DType, String)
fill target with a scalar value
Declaration
public static Symbol Full(double value, Shape shape = null, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | value | Value with which to fill newly created tensor |
| Shape | shape | The shape of the output |
| Context | ctx | Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls. |
| DType | dtype | Target data type. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
FullyConnected(Symbol, Symbol, Symbol, Int32, Boolean, Boolean, String)
Applies a linear transformation: :math:`Y = XW^T + b`.
If ``flatten`` is set to be true, then the shapes are:
- **data**: `(batch_size, x1, x2, ..., xn)`
- **weight**: `(num_hidden, x1 * x2 * ... * xn)`
- **bias**: `(num_hidden,)`
- **out**: `(batch_size, num_hidden)`
If ``flatten`` is set to be false, then the shapes are:
- **data**: `(x1, x2, ..., xn, input_dim)`
- **weight**: `(num_hidden, input_dim)`
- **bias**: `(num_hidden,)`
- **out**: `(x1, x2, ..., xn, num_hidden)`
The learnable parameters include both ``weight`` and ``bias``.
If ``no_bias`` is set to be true, then the ``bias`` term is ignored.
.. Note::
The sparse support for FullyConnected is limited to forward evaluation with `row_sparse`
weight and bias, where the length of `weight.indices` and `bias.indices` must be equal
to `num_hidden`. This could be useful for model inference with `row_sparse` weights
trained with importance sampling or noise contrastive estimation.
To compute linear transformation with 'csr' sparse data, sparse.dot is recommended instead
of sparse.FullyConnected.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\nn\fully_connected.cc:L277
Declaration
public static Symbol FullyConnected(Symbol data, Symbol weight, Symbol bias = null, int num_hidden = 0, bool no_bias = true, bool flatten = true, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data. |
| Symbol | weight | Weight matrix. |
| Symbol | bias | Bias parameter. |
| System.Int32 | num_hidden | Number of hidden nodes of the output. |
| System.Boolean | no_bias | Whether to disable bias parameter. |
| System.Boolean | flatten | Whether to collapse all but the first axis of the input data tensor. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Gamma(Symbol, String)
Returns the gamma function (extension of the factorial function \
to the reals), computed element-wise on the input array.
The storage type of ``gamma`` output is always dense
Declaration
public static Symbol Gamma(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Gammaln(Symbol, String)
Returns element-wise log of the absolute value of the gamma function \
of the input.
The storage type of ``gammaln`` output is always dense
Declaration
public static Symbol Gammaln(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
GatherNd(Symbol, Symbol, String)
Declaration
public static Symbol GatherNd(Symbol data, Symbol indices, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | |
| Symbol | indices | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
GradAdd(Symbol, Symbol, String)
Declaration
public static Symbol GradAdd(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | first input |
| Symbol | rhs | second input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Greater(Symbol, Symbol, String)
Declaration
public static Symbol Greater(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | first input |
| Symbol | rhs | second input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
GreaterEqual(Symbol, Symbol, String)
Declaration
public static Symbol GreaterEqual(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | first input |
| Symbol | rhs | second input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
GreaterEqualScalar(Symbol, Single, String)
Declaration
public static Symbol GreaterEqualScalar(Symbol data, float scalar, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | source input |
| System.Single | scalar | scalar input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
GreaterScalar(Symbol, Single, String)
Declaration
public static Symbol GreaterScalar(Symbol data, float scalar, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | source input |
| System.Single | scalar | scalar input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
GridGenerator(Symbol, GridgeneratorTransformType, Shape, String)
Generates 2D sampling grid for bilinear sampling.
Declaration
public static Symbol GridGenerator(Symbol data, GridgeneratorTransformType transform_type, Shape target_shape = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data to the function. |
| GridgeneratorTransformType | transform_type | The type of transformation. For |
| Shape | target_shape | Specifies the output shape (H, W). This is required if transformation type is |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
HardSigmoid(Symbol, Single, Single, String)
Computes hard sigmoid of x element-wise.
.. math::
y = max(0, min(1, alpha * x + beta))
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L115
Declaration
public static Symbol HardSigmoid(Symbol data, float alpha = 0.2F, float beta = 0.5F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.Single | alpha | Slope of hard sigmoid |
| System.Single | beta | Bias of hard sigmoid. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Histogram(Symbol, Symbol, Nullable<Int32>, Tuple<Double>, String)
This operators implements the histogram function.
Example::
x = [[0, 1], [2, 2], [3, 4]]
histo, bin_edges = histogram(data=x, bin_bounds=[], bin_cnt=5, range=(0,5))
histo = [1, 1, 2, 1, 1]
bin_edges = [0., 1., 2., 3., 4.]
histo, bin_edges = histogram(data=x, bin_bounds=[0., 2.1, 3.])
histo = [4, 1]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\histogram.cc:L136
Declaration
public static Symbol Histogram(Symbol data, Symbol bins, int? bin_cnt = default(int? ), Tuple<double> range = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input ndarray |
| Symbol | bins | Input ndarray |
| System.Nullable<System.Int32> | bin_cnt | Number of bins for uniform case |
| Tuple<System.Double> | range | The lower and upper range of the bins. if not provided, range is simply (a.min(), a.max()). values outside the range are ignored. the first element of the range must be less than or equal to the second. range affects the automatic bin computation as well. while bin width is computed to be optimal based on the actual data within range, the bin count will fill the entire range including portions containing no data. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Hypot(Symbol, Symbol, String)
Given the "legs" of a right triangle, return its hypotenuse.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_binary_op_extended.cc:L79
Declaration
public static Symbol Hypot(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | first input |
| Symbol | rhs | second input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
HypotScalar(Symbol, Single, String)
Declaration
public static Symbol HypotScalar(Symbol data, float scalar, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | source input |
| System.Single | scalar | scalar input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
IdentityAttachKLSparseReg(Symbol, Single, Single, Single, String)
Apply a sparse regularization to the output a sigmoid activation function.
Declaration
public static Symbol IdentityAttachKLSparseReg(Symbol data, float sparseness_target = 0.1F, float penalty = 0.001F, float momentum = 0.9F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data. |
| System.Single | sparseness_target | The sparseness target |
| System.Single | penalty | The tradeoff parameter for the sparseness penalty |
| System.Single | momentum | The momentum for running average |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
IdentityWithAttrLikeRhs(Symbol, Symbol, String)
Declaration
public static Symbol IdentityWithAttrLikeRhs(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | First input. |
| Symbol | rhs | Second input. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Imdecode(Symbol, Int32, Int32, Int32, Int32, Int32, Int32, Int32, String)
Decode an image, clip to (x0, y0, x1, y1), subtract mean, and write to buffer
Declaration
public static Symbol Imdecode(Symbol mean, int index, int x0, int y0, int x1, int y1, int c, int size, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | mean | image mean |
| System.Int32 | index | buffer position for output |
| System.Int32 | x0 | x0 |
| System.Int32 | y0 | y0 |
| System.Int32 | x1 | x1 |
| System.Int32 | y1 | y1 |
| System.Int32 | c | channel |
| System.Int32 | size | length of str_img |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
InstanceNorm(Symbol, Symbol, Symbol, Single, String)
Applies instance normalization to the n-dimensional input array.
This operator takes an n-dimensional input array where (n>2) and normalizes
the input using the following formula:
.. math::
out = \frac{x - mean[data]}{ \sqrt{Var[data]} + \epsilon} * gamma + beta
This layer is similar to batch normalization layer (`BatchNorm`)
with two differences: first, the normalization is
carried out per example (instance), not over a batch. Second, the
same normalization is applied both at test and train time. This
operation is also known as `contrast normalization`.
If the input data is of shape [batch, channel, spacial_dim1, spacial_dim2, ...],
`gamma` and `beta` parameters must be vectors of shape [channel].
This implementation is based on paper:
.. [1] Instance Normalization: The Missing Ingredient for Fast Stylization,
D. Ulyanov, A. Vedaldi, V. Lempitsky, 2016 (arXiv:1607.08022v2).
Examples::
// Input of shape (2,1,2)
x = [[[ 1.1, 2.2]],
[[ 3.3, 4.4]]]
// gamma parameter of length 1
gamma = [1.5]
// beta parameter of length 1
beta = [0.5]
// Instance normalization is calculated with the above formula
InstanceNorm(x,gamma,beta) = [[[-0.997527 , 1.99752665]],
[[-0.99752653, 1.99752724]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\instance_norm.cc:L95
Declaration
public static Symbol InstanceNorm(Symbol data, Symbol gamma, Symbol beta, float eps = 0.001F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | An n-dimensional input array (n > 2) of the form [batch, channel, spatial_dim1, spatial_dim2, ...]. |
| Symbol | gamma | A vector of length 'channel', which multiplies the normalized input. |
| Symbol | beta | A vector of length 'channel', which is added to the product of the normalized input and the weight. |
| System.Single | eps | An |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
KhatriRao(SymbolList, String)
Computes the Khatri-Rao product of the input matrices.
Given a collection of :math:`n` input matrices,
.. math::
A_1 \in \mathbb{R}^{M_1 \times M}, \ldots, A_n \in \mathbb{R}^{M_n \times N},
the (column-wise) Khatri-Rao product is defined as the matrix,
.. math::
X = A_1 \otimes \cdots \otimes A_n \in \mathbb{R}^{(M_1 \cdots M_n) \times N},
where the :math:`k` th column is equal to the column-wise outer product
:math:`{A_1}_k \otimes \cdots \otimes {A_n}_k` where :math:`{A_i}_k` is the kth
column of the ith matrix.
Example::
>>> A = mx.nd.array([[1, -1],
>>> [2, -3]])
>>> B = mx.nd.array([[1, 4],
>>> [2, 5],
>>> [3, 6]])
>>> C = mx.nd.khatri_rao(A, B)
>>> print(C.asnumpy())
[[ 1. -4.]
[ 2. -5.]
[ 3. -6.]
[ 2. -12.]
[ 4. -15.]
[ 6. -18.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\contrib\krprod.cc:L108
Declaration
public static Symbol KhatriRao(SymbolList args, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| SymbolList | args | Positional input matrices |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
L2Normalization(Symbol, Single, L2normalizationMode, String)
Normalize the input array using the L2 norm.
For 1-D NDArray, it computes::
out = data / sqrt(sum(data ** 2) + eps)
For N-D NDArray, if the input array has shape (N, N, ..., N),
with ``mode`` = ``instance``, it normalizes each instance in the multidimensional
array by its L2 norm.::
for i in 0...N
out[i,:,:,...,:] = data[i,:,:,...,:] / sqrt(sum(data[i,:,:,...,:] ** 2) + eps)
with ``mode`` = ``channel``, it normalizes each channel in the array by its L2 norm.::
for i in 0...N
out[:,i,:,...,:] = data[:,i,:,...,:] / sqrt(sum(data[:,i,:,...,:] ** 2) + eps)
with ``mode`` = ``spatial``, it normalizes the cross channel norm for each position
in the array by its L2 norm.::
for dim in 2...N
for i in 0...N
out[.....,i,...] = take(out, indices=i, axis=dim) / sqrt(sum(take(out, indices=i, axis=dim) ** 2) + eps)
-dim-
Example::
x = [[[1,2],
[3,4]],
[[2,2],
[5,6]]]
L2Normalization(x, mode='instance')
=[[[ 0.18257418 0.36514837]
[ 0.54772252 0.73029673]]
[[ 0.24077171 0.24077171]
[ 0.60192931 0.72231513]]]
L2Normalization(x, mode='channel')
=[[[ 0.31622776 0.44721359]
[ 0.94868326 0.89442718]]
[[ 0.37139067 0.31622776]
[ 0.92847669 0.94868326]]]
L2Normalization(x, mode='spatial')
=[[[ 0.44721359 0.89442718]
[ 0.60000002 0.80000001]]
[[ 0.70710677 0.70710677]
[ 0.6401844 0.76822126]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\l2_normalization.cc:L196
Declaration
public static Symbol L2Normalization(Symbol data, float eps = 1E-10F, L2normalizationMode mode = L2normalizationMode.Instance, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input array to normalize. |
| System.Single | eps | A small constant for numerical stability. |
| L2normalizationMode | mode | Specify the dimension along which to compute L2 norm. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LayerNorm(Symbol, Symbol, Symbol, Int32, Single, Boolean, String)
Layer normalization.
Normalizes the channels of the input tensor by mean and variance, and applies a scale ``gamma`` as
well as offset ``beta``.
Assume the input has more than one dimension and we normalize along axis 1.
We first compute the mean and variance along this axis and then
compute the normalized output, which has the same shape as input, as following:
.. math::
out = \frac{data - mean(data, axis)}{\sqrt{var(data, axis) + \epsilon}} * gamma + beta
Both ``gamma`` and ``beta`` are learnable parameters.
Unlike BatchNorm and InstanceNorm, the *mean* and *var* are computed along the channel dimension.
Assume the input has size *k* on axis 1, then both ``gamma`` and ``beta``
have shape *(k,)*. If ``output_mean_var`` is set to be true, then outputs both ``data_mean`` and
``data_std``. Note that no gradient will be passed through these two outputs.
The parameter ``axis`` specifies which axis of the input shape denotes
the 'channel' (separately normalized groups). The default is -1, which sets the channel
axis to be the last item in the input shape.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\nn\layer_norm.cc:L94
Declaration
public static Symbol LayerNorm(Symbol data, Symbol gamma, Symbol beta, int axis = -1, float eps = 1E-05F, bool output_mean_var = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data to layer normalization |
| Symbol | gamma | gamma array |
| Symbol | beta | beta array |
| System.Int32 | axis | The axis to perform layer normalization. Usually, this should be be axis of the channel dimension. Negative values means indexing from right to left. |
| System.Single | eps | An |
| System.Boolean | output_mean_var | Output the mean and std calculated along the given axis. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LeakyReLU(Symbol, NDArray, ReluActType, Single, Single, Single, String)
Applies Leaky rectified linear unit activation element-wise to the input.
Leaky ReLUs attempt to fix the "dying ReLU" problem by allowing a small `slope`
when the input is negative and has a slope of one when input is positive.
The following modified ReLU Activation functions are supported:
- *elu*: Exponential Linear Unit. `y = x > 0 ? x : slope * (exp(x)-1)`
- *selu*: Scaled Exponential Linear Unit. `y = lambda * (x > 0 ? x : alpha * (exp(x) - 1))` where
*lambda = 1.0507009873554804934193349852946* and *alpha = 1.6732632423543772848170429916717*.
- *leaky*: Leaky ReLU. `y = x > 0 ? x : slope * x`
- *prelu*: Parametric ReLU. This is same as *leaky* except that `slope` is learnt during training.
- *rrelu*: Randomized ReLU. same as *leaky* but the `slope` is uniformly and randomly chosen from
*[lower_bound, upper_bound)* for training, while fixed to be
*(lower_bound+upper_bound)/2* for inference.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\leaky_relu.cc:L65
Declaration
public static Symbol LeakyReLU(Symbol data, NDArray gamma = null, ReluActType act_type = ReluActType.Leaky, float slope = 0.25F, float lower_bound = 0.125F, float upper_bound = 0.334F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data to activation function. |
| NDArray | gamma | Slope parameter for PReLU. Only required when act_type is 'prelu'. It should be either a vector of size 1, or the same size as the second dimension of data. |
| ReluActType | act_type | Activation function to be applied. |
| System.Single | slope | Init slope for the activation. (For leaky and elu only) |
| System.Single | lower_bound | Lower bound of random slope. (For rrelu only) |
| System.Single | upper_bound | Upper bound of random slope. (For rrelu only) |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Lesser(Symbol, Symbol, String)
Declaration
public static Symbol Lesser(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | first input |
| Symbol | rhs | second input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LesserEqual(Symbol, Symbol, String)
Declaration
public static Symbol LesserEqual(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | first input |
| Symbol | rhs | second input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LesserEqualScalar(Symbol, Single, String)
Declaration
public static Symbol LesserEqualScalar(Symbol data, float scalar, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | source input |
| System.Single | scalar | scalar input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LesserScalar(Symbol, Single, String)
Declaration
public static Symbol LesserScalar(Symbol data, float scalar, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | source input |
| System.Single | scalar | scalar input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LinalgGelqf(Symbol, String)
Declaration
public static Symbol LinalgGelqf(Symbol A, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | A | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
LinalgGemm(Symbol, Symbol, Symbol, Boolean, Boolean, Double, Double, Int32, String)
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.
If *n=2*, the BLAS3 function *gemm* is performed:
*out* = *alpha* \* *op*\ (*A*) \* *op*\ (*B*) + *beta* \* *C*
Here, *alpha* and *beta* are scalar parameters, and *op()* is either the identity or
matrix transposition (depending on *transpose_a*, *transpose_b*).
If *n>2*, *gemm* is performed separately for a batch of matrices. The column indices of the matrices
are given by the last dimensions of the tensors, the row indices by the axis specified with the *axis*
parameter. By default, the trailing two dimensions will be used for matrix encoding.
For a non-default axis parameter, the operation performed is equivalent to a series of swapaxes/gemm/swapaxes
calls. For example let *A*, *B*, *C* be 5 dimensional tensors. Then gemm(*A*, *B*, *C*, axis=1) is equivalent
to the following without the overhead of the additional swapaxis operations::
A1 = swapaxes(A, dim1=1, dim2=3)
B1 = swapaxes(B, dim1=1, dim2=3)
C = swapaxes(C, dim1=1, dim2=3)
C = gemm(A1, B1, C)
C = swapaxis(C, dim1=1, dim2=3)
When the input data is of type float32 and the environment variables MXNET_CUDA_ALLOW_TENSOR_CORE
and MXNET_CUDA_TENSOR_OP_MATH_ALLOW_CONVERSION are set to 1, this operator will try to use
pseudo-float16 precision (float32 math with float16 I/O) precision in order to use
Tensor Cores on suitable NVIDIA GPUs. This can sometimes give significant speedups.
.. note:: The operator supports float32 and float64 data types only.
Examples::
// Single matrix multiply-add
A = [[1.0, 1.0], [1.0, 1.0]]
B = [[1.0, 1.0], [1.0, 1.0], [1.0, 1.0]]
C = [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]]
gemm(A, B, C, transpose_b=True, alpha=2.0, beta=10.0)
= [[14.0, 14.0, 14.0], [14.0, 14.0, 14.0]]
// Batch matrix multiply-add
A = [[[1.0, 1.0]], [[0.1, 0.1]]]
B = [[[1.0, 1.0]], [[0.1, 0.1]]]
C = [[[10.0]], [[0.01]]]
gemm(A, B, C, transpose_b=True, alpha=2.0 , beta=10.0)
= [[[104.0]], [[0.14]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\la_op.cc:L87
Declaration
public static Symbol LinalgGemm(Symbol A, Symbol B, Symbol C, bool transpose_a = false, bool transpose_b = false, double alpha = 1, double beta = 1, int axis = -2, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | A | Tensor of input matrices |
| Symbol | B | Tensor of input matrices |
| Symbol | C | Tensor of input matrices |
| System.Boolean | transpose_a | Multiply with transposed of first input (A). |
| System.Boolean | transpose_b | Multiply with transposed of second input (B). |
| System.Double | alpha | Scalar factor multiplied with A*B. |
| System.Double | beta | Scalar factor multiplied with C. |
| System.Int32 | axis | Axis corresponding to the matrix rows. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LinalgGemm2(Symbol, Symbol, Boolean, Boolean, Double, Int32, String)
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.
If *n=2*, the BLAS3 function *gemm* is performed:
*out* = *alpha* \* *op*\ (*A*) \* *op*\ (*B*)
Here *alpha* is a scalar parameter and *op()* is either the identity or the matrix
transposition (depending on *transpose_a*, *transpose_b*).
If *n>2*, *gemm* is performed separately for a batch of matrices. The column indices of the matrices
are given by the last dimensions of the tensors, the row indices by the axis specified with the *axis*
parameter. By default, the trailing two dimensions will be used for matrix encoding.
For a non-default axis parameter, the operation performed is equivalent to a series of swapaxes/gemm/swapaxes
calls. For example let *A*, *B* be 5 dimensional tensors. Then gemm(*A*, *B*, axis=1) is equivalent to
the following without the overhead of the additional swapaxis operations::
A1 = swapaxes(A, dim1=1, dim2=3)
B1 = swapaxes(B, dim1=1, dim2=3)
C = gemm2(A1, B1)
C = swapaxis(C, dim1=1, dim2=3)
When the input data is of type float32 and the environment variables MXNET_CUDA_ALLOW_TENSOR_CORE
and MXNET_CUDA_TENSOR_OP_MATH_ALLOW_CONVERSION are set to 1, this operator will try to use
pseudo-float16 precision (float32 math with float16 I/O) precision in order to use
Tensor Cores on suitable NVIDIA GPUs. This can sometimes give significant speedups.
.. note:: The operator supports float32 and float64 data types only.
Examples::
// Single matrix multiply
A = [[1.0, 1.0], [1.0, 1.0]]
B = [[1.0, 1.0], [1.0, 1.0], [1.0, 1.0]]
gemm2(A, B, transpose_b=True, alpha=2.0)
= [[4.0, 4.0, 4.0], [4.0, 4.0, 4.0]]
// Batch matrix multiply
A = [[[1.0, 1.0]], [[0.1, 0.1]]]
B = [[[1.0, 1.0]], [[0.1, 0.1]]]
gemm2(A, B, transpose_b=True, alpha=2.0)
= [[[4.0]], [[0.04 ]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\la_op.cc:L161
Declaration
public static Symbol LinalgGemm2(Symbol A, Symbol B, bool transpose_a = false, bool transpose_b = false, double alpha = 1, int axis = -2, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | A | Tensor of input matrices |
| Symbol | B | Tensor of input matrices |
| System.Boolean | transpose_a | Multiply with transposed of first input (A). |
| System.Boolean | transpose_b | Multiply with transposed of second input (B). |
| System.Double | alpha | Scalar factor multiplied with A*B. |
| System.Int32 | axis | Axis corresponding to the matrix row indices. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LinalgPotrf(Symbol, String)
Performs Cholesky factorization of a symmetric positive-definite matrix.
Input is a tensor *A* of dimension *n >= 2*.
If *n=2*, the Cholesky factor *B* of the symmetric, positive definite matrix *A* is
computed. *B* is triangular (entries of upper or lower triangle are all zero), has
positive diagonal entries, and:
*A* = *B* \* *B*\ :sup:`T` if *lower* = *true*
*A* = *B*\ :sup:`T` \* *B* if *lower* = *false*
If *n>2*, *potrf* is performed separately on the trailing two dimensions for all inputs
(batch mode).
.. note:: The operator supports float32 and float64 data types only.
Examples::
// Single matrix factorization
A = [[4.0, 1.0], [1.0, 4.25]]
potrf(A) = [[2.0, 0], [0.5, 2.0]]
// Batch matrix factorization
A = [[[4.0, 1.0], [1.0, 4.25]], [[16.0, 4.0], [4.0, 17.0]]]
potrf(A) = [[[2.0, 0], [0.5, 2.0]], [[4.0, 0], [1.0, 4.0]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\la_op.cc:L212
Declaration
public static Symbol LinalgPotrf(Symbol A, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | A | Tensor of input matrices to be decomposed |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LinalgPotri(Symbol, String)
Performs matrix inversion from a Cholesky factorization.
Input is a tensor *A* of dimension *n >= 2*.
If *n=2*, *A* is a triangular matrix (entries of upper or lower triangle are all zero)
with positive diagonal. We compute:
*out* = *A*\ :sup:`-T` \* *A*\ :sup:`-1` if *lower* = *true*
*out* = *A*\ :sup:`-1` \* *A*\ :sup:`-T` if *lower* = *false*
In other words, if *A* is the Cholesky factor of a symmetric positive definite matrix
*B* (obtained by *potrf*), then
*out* = *B*\ :sup:`-1`
If *n>2*, *potri* is performed separately on the trailing two dimensions for all inputs
(batch mode).
.. note:: The operator supports float32 and float64 data types only.
.. note:: Use this operator only if you are certain you need the inverse of *B*, and
cannot use the Cholesky factor *A* (*potrf*), together with backsubstitution
(*trsm*). The latter is numerically much safer, and also cheaper.
Examples::
// Single matrix inverse
A = [[2.0, 0], [0.5, 2.0]]
potri(A) = [[0.26563, -0.0625], [-0.0625, 0.25]]
// Batch matrix inverse
A = [[[2.0, 0], [0.5, 2.0]], [[4.0, 0], [1.0, 4.0]]]
potri(A) = [[[0.26563, -0.0625], [-0.0625, 0.25]],
[[0.06641, -0.01562], [-0.01562, 0,0625]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\la_op.cc:L273
Declaration
public static Symbol LinalgPotri(Symbol A, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | A | Tensor of lower triangular matrices |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LinalgSumlogdiag(Symbol, String)
Computes the sum of the logarithms of the diagonal elements of a square matrix.
Input is a tensor *A* of dimension *n >= 2*.
If *n=2*, *A* must be square with positive diagonal entries. We sum the natural
logarithms of the diagonal elements, the result has shape (1,).
If *n>2*, *sumlogdiag* is performed separately on the trailing two dimensions for all
inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only.
Examples::
// Single matrix reduction
A = [[1.0, 1.0], [1.0, 7.0]]
sumlogdiag(A) = [1.9459]
// Batch matrix reduction
A = [[[1.0, 1.0], [1.0, 7.0]], [[3.0, 0], [0, 17.0]]]
sumlogdiag(A) = [1.9459, 3.9318]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\la_op.cc:L443
Declaration
public static Symbol LinalgSumlogdiag(Symbol A, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | A | Tensor of square matrices |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LinalgSyevd(Symbol, String)
Declaration
public static Symbol LinalgSyevd(Symbol A, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | A | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
LinalgSyrk(Symbol, Boolean, Double, String)
Multiplication of matrix with its transpose.
Input is a tensor *A* of dimension *n >= 2*.
If *n=2*, the operator performs the BLAS3 function *syrk*:
*out* = *alpha* \* *A* \* *A*\ :sup:`T`
if *transpose=False*, or
*out* = *alpha* \* *A*\ :sup:`T` \ \* *A*
if *transpose=True*.
If *n>2*, *syrk* is performed separately on the trailing two dimensions for all
inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only.
Examples::
// Single matrix multiply
A = [[1., 2., 3.], [4., 5., 6.]]
syrk(A, alpha=1., transpose=False)
= [[14., 32.],
[32., 77.]]
syrk(A, alpha=1., transpose=True)
= [[17., 22., 27.],
[22., 29., 36.],
[27., 36., 45.]]
// Batch matrix multiply
A = [[[1., 1.]], [[0.1, 0.1]]]
syrk(A, alpha=2., transpose=False) = [[[4.]], [[0.04]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\la_op.cc:L499
Declaration
public static Symbol LinalgSyrk(Symbol A, bool transpose = false, double alpha = 1, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | A | Tensor of input matrices |
| System.Boolean | transpose | Use transpose of input matrix. |
| System.Double | alpha | Scalar factor to be applied to the result. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LinalgTrmm(Symbol, Symbol, Boolean, Boolean, Boolean, Double, String)
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.
If *n=2*, *A* must be triangular. The operator performs the BLAS3 function
*trmm*:
*out* = *alpha* \* *op*\ (*A*) \* *B*
if *rightside=False*, or
*out* = *alpha* \* *B* \* *op*\ (*A*)
if *rightside=True*. Here, *alpha* is a scalar parameter, and *op()* is either the
identity or the matrix transposition (depending on *transpose*).
If *n>2*, *trmm* is performed separately on the trailing two dimensions for all inputs
(batch mode).
.. note:: The operator supports float32 and float64 data types only.
Examples::
// Single triangular matrix multiply
A = [[1.0, 0], [1.0, 1.0]]
B = [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]]
trmm(A, B, alpha=2.0) = [[2.0, 2.0, 2.0], [4.0, 4.0, 4.0]]
// Batch triangular matrix multiply
A = [[[1.0, 0], [1.0, 1.0]], [[1.0, 0], [1.0, 1.0]]]
B = [[[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]], [[0.5, 0.5, 0.5], [0.5, 0.5, 0.5]]]
trmm(A, B, alpha=2.0) = [[[2.0, 2.0, 2.0], [4.0, 4.0, 4.0]],
[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\la_op.cc:L331
Declaration
public static Symbol LinalgTrmm(Symbol A, Symbol B, bool transpose = false, bool rightside = false, bool lower = true, double alpha = 1, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | A | Tensor of lower triangular matrices |
| Symbol | B | Tensor of matrices |
| System.Boolean | transpose | Use transposed of the triangular matrix |
| System.Boolean | rightside | Multiply triangular matrix from the right to non-triangular one. |
| System.Boolean | lower | True if the triangular matrix is lower triangular, false if it is upper triangular. |
| System.Double | alpha | Scalar factor to be applied to the result. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LinalgTrsm(Symbol, Symbol, Boolean, Boolean, Boolean, Double, String)
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.
If *n=2*, *A* must be triangular. The operator performs the BLAS3 function
*trsm*, solving for *out* in:
*op*\ (*A*) \* *out* = *alpha* \* *B*
if *rightside=False*, or
*out* \* *op*\ (*A*) = *alpha* \* *B*
if *rightside=True*. Here, *alpha* is a scalar parameter, and *op()* is either the
identity or the matrix transposition (depending on *transpose*).
If *n>2*, *trsm* is performed separately on the trailing two dimensions for all inputs
(batch mode).
.. note:: The operator supports float32 and float64 data types only.
Examples::
// Single matrix solve
A = [[1.0, 0], [1.0, 1.0]]
B = [[2.0, 2.0, 2.0], [4.0, 4.0, 4.0]]
trsm(A, B, alpha=0.5) = [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]]
// Batch matrix solve
A = [[[1.0, 0], [1.0, 1.0]], [[1.0, 0], [1.0, 1.0]]]
B = [[[2.0, 2.0, 2.0], [4.0, 4.0, 4.0]],
[[4.0, 4.0, 4.0], [8.0, 8.0, 8.0]]]
trsm(A, B, alpha=0.5) = [[[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]],
[[2.0, 2.0, 2.0], [2.0, 2.0, 2.0]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\la_op.cc:L394
Declaration
public static Symbol LinalgTrsm(Symbol A, Symbol B, bool transpose = false, bool rightside = false, bool lower = true, double alpha = 1, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | A | Tensor of lower triangular matrices |
| Symbol | B | Tensor of matrices |
| System.Boolean | transpose | Use transposed of the triangular matrix |
| System.Boolean | rightside | Multiply triangular matrix from the right to non-triangular one. |
| System.Boolean | lower | True if the triangular matrix is lower triangular, false if it is upper triangular. |
| System.Double | alpha | Scalar factor to be applied to the result. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LinearRegressionOutput(Symbol, Symbol, Single, String)
Computes and optimizes for squared loss during backward propagation.
Just outputs ``data`` during forward propagation.
If :math:`\hat{y}_i` is the predicted value of the i-th sample, and :math:`y_i` is the corresponding target value,
then the squared loss estimated over :math:`n` samples is defined as
:math:`\text{SquaredLoss}(\textbf{Y}, \hat{\textbf{Y}} ) = \frac{1}{n} \sum_{i=0}^{n-1} \lVert \textbf{y}_i - \hat{\textbf{y}}_i \rVert_2`
.. note::
Use the LinearRegressionOutput as the final output layer of a net.
The storage type of ``label`` can be ``default`` or ``csr``
- LinearRegressionOutput(default, default) = default
- LinearRegressionOutput(default, csr) = default
By default, gradients of this loss function are scaled by factor `1/m`, where m is the number of regression outputs of a training example.
The parameter `grad_scale` can be used to change this scale to `grad_scale/m`.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\regression_output.cc:L92
Declaration
public static Symbol LinearRegressionOutput(Symbol data, Symbol label, float grad_scale = 1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data to the function. |
| Symbol | label | Input label to the function. |
| System.Single | grad_scale | Scale the gradient by a float factor |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Linspace(Single, Single, Int32, Boolean, Context, DType, String)
Declaration
public static Symbol Linspace(float start, float stop, int num, bool endpoint = true, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | start | |
| System.Single | stop | |
| System.Int32 | num | |
| System.Boolean | endpoint | |
| Context | ctx | |
| DType | dtype | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
Log(Symbol, String)
Returns element-wise Natural logarithmic value of the input.
The natural logarithm is logarithm in base *e*, so that ``log(exp(x)) = x``
The storage type of ``log`` output is always dense
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L990
Declaration
public static Symbol Log(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Log10(Symbol, String)