Returns element-wise Base-10 logarithmic value of the input.
``10**log10(x) = x``
The storage type of ``log10`` output is always dense
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L1003
Declaration
public static Symbol Log10(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 |
Log1P(Symbol, String)
Returns element-wise ``log(1 + x)`` value of the input.
This function is more accurate than ``log(1 + x)`` for small ``x`` so that
:math:`1+x\approx 1`
The storage type of ``log1p`` output depends upon the input storage type:
- log1p(default) = default
- log1p(row_sparse) = row_sparse
- log1p(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L1040
Declaration
public static Symbol Log1P(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 |
Log2(Symbol, String)
Returns element-wise Base-2 logarithmic value of the input.
``2**log2(x) = x``
The storage type of ``log2`` output is always dense
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L1015
Declaration
public static Symbol Log2(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 |
LogicalAnd(Symbol, Symbol, String)
Declaration
public static Symbol LogicalAnd(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 |
LogicalAndScalar(Symbol, Single, String)
Declaration
public static Symbol LogicalAndScalar(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 |
LogicalNot(Symbol, String)
Returns the result of logical NOT (!) function
Example:
logical_not([-2., 0., 1.]) = [0., 1., 0.]
Declaration
public static Symbol LogicalNot(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 |
LogicalOr(Symbol, Symbol, String)
Declaration
public static Symbol LogicalOr(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 |
LogicalOrScalar(Symbol, Single, String)
Declaration
public static Symbol LogicalOrScalar(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 |
LogicalXor(Symbol, Symbol, String)
Declaration
public static Symbol LogicalXor(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 |
LogicalXorScalar(Symbol, Single, String)
Declaration
public static Symbol LogicalXorScalar(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 |
LogisticRegressionOutput(Symbol, Symbol, Single, String)
Applies a logistic function to the input.
The logistic function, also known as the sigmoid function, is computed as
:math:`\frac{1}{1+exp(-\textbf{x})}`.
Commonly, the sigmoid is used to squash the real-valued output of a linear model
:math:`wTx+b` into the [0,1] range so that it can be interpreted as a probability.
It is suitable for binary classification or probability prediction tasks.
.. note::
Use the LogisticRegressionOutput as the final output layer of a net.
The storage type of ``label`` can be ``default`` or ``csr``
- LogisticRegressionOutput(default, default) = default
- LogisticRegressionOutput(default, csr) = default
The loss function used is the Binary Cross Entropy Loss:
:math:`-{(y\log(p) + (1 - y)\log(1 - p))}`
Where `y` is the ground truth probability of positive outcome for a given example, and `p` the probability predicted by the model. 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:L152
Declaration
public static Symbol LogisticRegressionOutput(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 |
LogSoftmax(Symbol, Int32, Nullable<Double>, DType, String)
Computes the log softmax of the input.
This is equivalent to computing softmax followed by log.
Examples::
>>> x = mx.nd.array([1, 2, .1])
>>> mx.nd.log_softmax(x).asnumpy()
array([-1.41702998, -0.41702995, -2.31702995], dtype=float32)
>>> x = mx.nd.array( [[1, 2, .1],[.1, 2, 1]] )
>>> mx.nd.log_softmax(x, axis=0).asnumpy()
array([[-0.34115392, -0.69314718, -1.24115396],
[-1.24115396, -0.69314718, -0.34115392]], dtype=float32)
Declaration
public static Symbol LogSoftmax(Symbol data, int axis = -1, double? temperature = default(double? ), DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.Int32 | axis | The axis along which to compute softmax. |
| System.Nullable<System.Double> | temperature | Temperature parameter in softmax |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to the same as input's dtype if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
LRN(Symbol, UInt32, Single, Single, Single, String)
Declaration
public static Symbol LRN(Symbol data, uint nsize, float alpha = 0.0001F, float beta = 0.75F, float knorm = 2F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | |
| System.UInt32 | nsize | |
| System.Single | alpha | |
| System.Single | beta | |
| System.Single | knorm | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
MAERegressionOutput(Symbol, Symbol, Single, String)
Computes mean absolute error of the input.
MAE is a risk metric corresponding to the expected value of the absolute error.
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 mean absolute error (MAE) estimated over :math:`n` samples is defined as
:math:`\text{MAE}(\textbf{Y}, \hat{\textbf{Y}} ) = \frac{1}{n} \sum_{i=0}^{n-1} \lVert \textbf{y}_i - \hat{\textbf{y}}_i \rVert_1`
.. note::
Use the MAERegressionOutput as the final output layer of a net.
The storage type of ``label`` can be ``default`` or ``csr``
- MAERegressionOutput(default, default) = default
- MAERegressionOutput(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:L120
Declaration
public static Symbol MAERegressionOutput(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 |
MakeLoss(Symbol, Single, Single, MakelossNormalization, String)
Make your own loss function in network construction.
This operator accepts a customized loss function symbol as a terminal loss and
the symbol should be an operator with no backward dependency.
The output of this function is the gradient of loss with respect to the input data.
For example, if you are a making a cross entropy loss function. Assume ``out`` is the
predicted output and ``label`` is the true label, then the cross entropy can be defined as::
cross_entropy = label * log(out) + (1 - label) * log(1 - out)
loss = MakeLoss(cross_entropy)
We will need to use ``MakeLoss`` when we are creating our own loss function or we want to
combine multiple loss functions. Also we may want to stop some variables' gradients
from backpropagation. See more detail in ``BlockGrad`` or ``stop_gradient``.
In addition, we can give a scale to the loss by setting ``grad_scale``,
so that the gradient of the loss will be rescaled in the backpropagation.
.. note:: This operator should be used as a Symbol instead of NDArray.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\make_loss.cc:L71
Declaration
public static Symbol MakeLoss(Symbol data, float grad_scale = 1F, float valid_thresh = 0F, MakelossNormalization normalization = MakelossNormalization.Null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input array. |
| System.Single | grad_scale | Gradient scale as a supplement to unary and binary operators |
| System.Single | valid_thresh | clip each element in the array to 0 when it is less than |
| MakelossNormalization | normalization | If this is set to null, the output gradient will not be normalized. If this is set to batch, the output gradient will be divided by the batch size. If this is set to valid, the output gradient will be divided by the number of valid input elements. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
MakeLoss(Symbol, String)
Make your own loss function in network construction.
This operator accepts a customized loss function symbol as a terminal loss and
the symbol should be an operator with no backward dependency.
The output of this function is the gradient of loss with respect to the input data.
For example, if you are a making a cross entropy loss function. Assume ``out`` is the
predicted output and ``label`` is the true label, then the cross entropy can be defined as::
cross_entropy = label * log(out) + (1 - label) * log(1 - out)
loss = make_loss(cross_entropy)
We will need to use ``make_loss`` when we are creating our own loss function or we want to
combine multiple loss functions. Also we may want to stop some variables' gradients
from backpropagation. See more detail in ``BlockGrad`` or ``stop_gradient``.
The storage type of ``make_loss`` output depends upon the input storage type:
- make_loss(default) = default
- make_loss(row_sparse) = row_sparse
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L314
Declaration
public static Symbol MakeLoss(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 |
Max(Symbol, Shape, Boolean, Boolean, String)
Computes the max of array elements over given axes.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\broadcast_reduce_op_value.cc:L191
Declaration
public static Symbol Max(Symbol data, Shape axis = null, bool keepdims = false, bool exclude = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| Shape | axis | The axis or axes along which to perform the reduction. The default, |
| System.Boolean | keepdims | If this is set to |
| System.Boolean | exclude | Whether to perform reduction on axis that are NOT in axis instead. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Maximum(Symbol, Symbol, String)
Declaration
public static Symbol Maximum(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 |
MaximumScalar(Symbol, Single, String)
Declaration
public static Symbol MaximumScalar(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 |
Mean(Symbol, Shape, Boolean, Boolean, String)
Computes the mean of array elements over given axes.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\broadcast_reduce_op_value.cc:L132
Declaration
public static Symbol Mean(Symbol data, Shape axis = null, bool keepdims = false, bool exclude = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| Shape | axis | The axis or axes along which to perform the reduction. The default, |
| System.Boolean | keepdims | If this is set to |
| System.Boolean | exclude | Whether to perform reduction on axis that are NOT in axis instead. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Mean(Symbol, Int32, Boolean, Boolean, String)
Declaration
public static Symbol Mean(Symbol data, int axis, bool keepdims = false, bool exclude = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | |
| System.Int32 | axis | |
| System.Boolean | keepdims | |
| System.Boolean | exclude | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
Min(Symbol, Shape, Boolean, Boolean, String)
Computes the min of array elements over given axes.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\broadcast_reduce_op_value.cc:L205
Declaration
public static Symbol Min(Symbol data, Shape axis = null, bool keepdims = false, bool exclude = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| Shape | axis | The axis or axes along which to perform the reduction. The default, |
| System.Boolean | keepdims | If this is set to |
| System.Boolean | exclude | Whether to perform reduction on axis that are NOT in axis instead. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Minimum(Symbol, Symbol, String)
Declaration
public static Symbol Minimum(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 |
MinimumScalar(Symbol, Single, String)
Declaration
public static Symbol MinimumScalar(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 |
MinusScalar(Symbol, Single, String)
Declaration
public static Symbol MinusScalar(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 |
Mod(Symbol, Symbol, String)
Declaration
public static Symbol Mod(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 |
ModScalar(Symbol, Single, String)
Declaration
public static Symbol ModScalar(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 |
MpAdamwUpdate(Symbol, Symbol, Symbol, Symbol, Symbol, Symbol, Single, Single, Single, Single, Single, Single, Single, String)
Declaration
public static Symbol MpAdamwUpdate(Symbol weight, Symbol grad, Symbol mean, Symbol var, Symbol weight32, 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 | weight32 | |
| 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 |
MpSgdMomUpdate(Symbol, Symbol, Symbol, Symbol, Single, Single, Single, Single, Single, Boolean, String)
Declaration
public static Symbol MpSgdMomUpdate(Symbol weight, Symbol grad, Symbol mom, Symbol weight32, float lr, float momentum = 0F, 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 | mom | |
| Symbol | weight32 | |
| System.Single | lr | |
| System.Single | momentum | |
| System.Single | wd | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.Boolean | lazy_update | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
MpSgdUpdate(Symbol, Symbol, Symbol, Single, Single, Single, Single, Boolean, String)
Declaration
public static Symbol MpSgdUpdate(Symbol weight, Symbol grad, Symbol weight32, float lr, 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 | weight32 | |
| System.Single | lr | |
| System.Single | wd | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.Boolean | lazy_update | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
MulScalar(Symbol, Single, String)
Multiply an array with a scalar.
``_mul_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:L149
Declaration
public static Symbol MulScalar(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 |
MultiMpSgdMomUpdate(SymbolList, Tuple<Double>, Tuple<Double>, Single, Single, Single, Int32, String)
Declaration
public static Symbol MultiMpSgdMomUpdate(SymbolList data, Tuple<double> lrs, Tuple<double> wds, float momentum = 0F, float rescale_grad = 1F, float clip_gradient = -1F, int num_weights = 1, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| SymbolList | data | |
| Tuple<System.Double> | lrs | |
| Tuple<System.Double> | wds | |
| System.Single | momentum | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.Int32 | num_weights | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
MultiMpSgdUpdate(SymbolList, Tuple<Double>, Tuple<Double>, Single, Single, Int32, String)
Declaration
public static Symbol MultiMpSgdUpdate(SymbolList data, Tuple<double> lrs, Tuple<double> wds, float rescale_grad = 1F, float clip_gradient = -1F, int num_weights = 1, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| SymbolList | data | |
| Tuple<System.Double> | lrs | |
| Tuple<System.Double> | wds | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.Int32 | num_weights | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
MultiSgdMomUpdate(SymbolList, Tuple<Double>, Tuple<Double>, Single, Single, Single, Int32, String)
Declaration
public static Symbol MultiSgdMomUpdate(SymbolList data, Tuple<double> lrs, Tuple<double> wds, float momentum = 0F, float rescale_grad = 1F, float clip_gradient = -1F, int num_weights = 1, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| SymbolList | data | |
| Tuple<System.Double> | lrs | |
| Tuple<System.Double> | wds | |
| System.Single | momentum | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.Int32 | num_weights | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
MultiSgdUpdate(SymbolList, Tuple<Double>, Tuple<Double>, Single, Single, Int32, String)
Declaration
public static Symbol MultiSgdUpdate(SymbolList data, Tuple<double> lrs, Tuple<double> wds, float rescale_grad = 1F, float clip_gradient = -1F, int num_weights = 1, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| SymbolList | data | |
| Tuple<System.Double> | lrs | |
| Tuple<System.Double> | wds | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.Int32 | num_weights | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
Nanprod(Symbol, Shape, Boolean, Boolean, String)
Computes the product of array elements over given axes treating Not a Numbers (``NaN``) as one.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\broadcast_reduce_op_value.cc:L177
Declaration
public static Symbol Nanprod(Symbol data, Shape axis = null, bool keepdims = false, bool exclude = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| Shape | axis | The axis or axes along which to perform the reduction. The default, |
| System.Boolean | keepdims | If this is set to |
| System.Boolean | exclude | Whether to perform reduction on axis that are NOT in axis instead. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Nansum(Symbol, Shape, Boolean, Boolean, String)
Computes the sum of array elements over given axes treating Not a Numbers (``NaN``) as zero.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\broadcast_reduce_op_value.cc:L162
Declaration
public static Symbol Nansum(Symbol data, Shape axis = null, bool keepdims = false, bool exclude = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| Shape | axis | The axis or axes along which to perform the reduction. The default, |
| System.Boolean | keepdims | If this is set to |
| System.Boolean | exclude | Whether to perform reduction on axis that are NOT in axis instead. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Native(SymbolList, IntPtr, Boolean, String)
Stub for implementing an operator implemented in native frontend language.
Declaration
public static Symbol Native(SymbolList data, IntPtr info, bool need_top_grad = true, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| SymbolList | data | Input data for the custom operator. |
| System.IntPtr | info | |
| System.Boolean | need_top_grad | Whether this layer needs out grad for backward. Should be false for loss layers. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Negative(Symbol, String)
Numerical negative of the argument, element-wise.
The storage type of ``negative`` output depends upon the input storage type:
- negative(default) = default
- negative(row_sparse) = row_sparse
- negative(csr) = csr
Declaration
public static Symbol Negative(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 |
NoGradient(String)
Place holder for variable who cannot perform gradient
Declaration
public static Symbol NoGradient(string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Norm(Symbol, Int32, Shape, Nullable<NormOutDtype>, Boolean, String)
Computes the norm on an NDArray.
This operator computes the norm on an NDArray with the specified axis, depending
on the value of the ord parameter. By default, it computes the L2 norm on the entire
array. Currently only ord=2 supports sparse ndarrays.
Examples::
x = [[[1, 2],
[3, 4]],
[[2, 2],
[5, 6]]]
norm(x, ord=2, axis=1) = [[3.1622777 4.472136 ]
[5.3851647 6.3245554]]
norm(x, ord=1, axis=1) = [[4., 6.],
[7., 8.]]
rsp = x.cast_storage('row_sparse')
norm(rsp) = [5.47722578]
csr = x.cast_storage('csr')
norm(csr) = [5.47722578]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\broadcast_reduce_op_value.cc:L350
Declaration
public static Symbol Norm(Symbol data, int ord = 2, Shape axis = null, NormOutDtype? out_dtype = default(NormOutDtype? ), bool keepdims = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| System.Int32 | ord | Order of the norm. Currently ord=1 and ord=2 is supported. |
| Shape | axis | The axis or axes along which to perform the reduction. The default, |
| System.Nullable<NormOutDtype> | out_dtype | The data type of the output. |
| System.Boolean | keepdims | If this is set to |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
NotEqual(Symbol, Symbol, String)
Declaration
public static Symbol NotEqual(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 |
NotEqualScalar(Symbol, Single, String)
Declaration
public static Symbol NotEqualScalar(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 |
OneHot(Symbol, Int32, Double, Double, DType, String)
Returns a one-hot array.
The locations represented by `indices` take value `on_value`, while all
other locations take value `off_value`.
`one_hot` operation with `indices` of shape ``(i0, i1)`` and `depth` of ``d`` would result
in an output array of shape ``(i0, i1, d)`` with::
output[i,j,:] = off_value
output[i,j,indices[i,j]] = on_value
Examples::
one_hot([1,0,2,0], 3) = [[ 0. 1. 0.]
[ 1. 0. 0.]
[ 0. 0. 1.]
[ 1. 0. 0.]]
one_hot([1,0,2,0], 3, on_value=8, off_value=1,
dtype='int32') = [[1 8 1]
[8 1 1]
[1 1 8]
[8 1 1]]
one_hot([[1,0],[1,0],[2,0]], 3) = [[[ 0. 1. 0.]
[ 1. 0. 0.]]
[[ 0. 1. 0.]
[ 1. 0. 0.]]
[[ 0. 0. 1.]
[ 1. 0. 0.]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\indexing_op.cc:L799
Declaration
public static Symbol OneHot(Symbol indices, int depth, double on_value = 1, double off_value = 0, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | indices | array of locations where to set on_value |
| System.Int32 | depth | Depth of the one hot dimension. |
| System.Double | on_value | The value assigned to the locations represented by indices. |
| System.Double | off_value | The value assigned to the locations not represented by indices. |
| DType | dtype | DType of the output |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
OnehotEncode(Symbol, Symbol, String)
Declaration
public static Symbol OnehotEncode(Symbol lhs, Symbol rhs, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | Left operand to the function. |
| Symbol | rhs | Right operand to the function. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Ones(Shape, Context, DType, String)
fill target with ones
Declaration
public static Symbol Ones(Shape shape = null, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| 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 |
OnesLike(Symbol, String)
Return an array of ones with the same shape and type
as the input array.
Examples::
x = [[ 0., 0., 0.],
[ 0., 0., 0.]]
ones_like(x) = [[ 1., 1., 1.],
[ 1., 1., 1.]]
Declaration
public static Symbol OnesLike(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Pad(Symbol, PadMode, Shape, Double, String)
Pads an input array with a constant or edge values of the array.
.. note:: `Pad` is deprecated. Use `pad` instead.
.. note:: Current implementation only supports 4D and 5D input arrays with padding applied
only on axes 1, 2 and 3. Expects axes 4 and 5 in `pad_width` to be zero.
This operation pads an input array with either a `constant_value` or edge values
along each axis of the input array. The amount of padding is specified by `pad_width`.
`pad_width` is a tuple of integer padding widths for each axis of the format
``(before_1, after_1, ... , before_N, after_N)``. The `pad_width` should be of length ``2*N``
where ``N`` is the number of dimensions of the array.
For dimension ``N`` of the input array, ``before_N`` and ``after_N`` indicates how many values
to add before and after the elements of the array along dimension ``N``.
The widths of the higher two dimensions ``before_1``, ``after_1``, ``before_2``,
``after_2`` must be 0.
Example::
x = [[[[ 1. 2. 3.]
[ 4. 5. 6.]]
[[ 7. 8. 9.]
[ 10. 11. 12.]]]
[[[ 11. 12. 13.]
[ 14. 15. 16.]]
[[ 17. 18. 19.]
[ 20. 21. 22.]]]]
pad(x,mode="edge", pad_width=(0,0,0,0,1,1,1,1)) =
[[[[ 1. 1. 2. 3. 3.]
[ 1. 1. 2. 3. 3.]
[ 4. 4. 5. 6. 6.]
[ 4. 4. 5. 6. 6.]]
[[ 7. 7. 8. 9. 9.]
[ 7. 7. 8. 9. 9.]
[ 10. 10. 11. 12. 12.]
[ 10. 10. 11. 12. 12.]]]
[[[ 11. 11. 12. 13. 13.]
[ 11. 11. 12. 13. 13.]
[ 14. 14. 15. 16. 16.]
[ 14. 14. 15. 16. 16.]]
[[ 17. 17. 18. 19. 19.]
[ 17. 17. 18. 19. 19.]
[ 20. 20. 21. 22. 22.]
[ 20. 20. 21. 22. 22.]]]]
pad(x, mode="constant", constant_value=0, pad_width=(0,0,0,0,1,1,1,1)) =
[[[[ 0. 0. 0. 0. 0.]
[ 0. 1. 2. 3. 0.]
[ 0. 4. 5. 6. 0.]
[ 0. 0. 0. 0. 0.]]
[[ 0. 0. 0. 0. 0.]
[ 0. 7. 8. 9. 0.]
[ 0. 10. 11. 12. 0.]
[ 0. 0. 0. 0. 0.]]]
[[[ 0. 0. 0. 0. 0.]
[ 0. 11. 12. 13. 0.]
[ 0. 14. 15. 16. 0.]
[ 0. 0. 0. 0. 0.]]
[[ 0. 0. 0. 0. 0.]
[ 0. 17. 18. 19. 0.]
[ 0. 20. 21. 22. 0.]
[ 0. 0. 0. 0. 0.]]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\pad.cc:L766
Declaration
public static Symbol Pad(Symbol data, PadMode mode, Shape pad_width, double constant_value = 0, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | An n-dimensional input array. |
| PadMode | mode | Padding type to use. "constant" pads with |
| Shape | pad_width | Widths of the padding regions applied to the edges of each axis. It is a tuple of integer
padding widths for each axis of the format |
| System.Double | constant_value | The value used for padding when |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Pick(Symbol, Symbol, Nullable<Int32>, Boolean, PickMode, String)
Picks elements from an input array according to the input indices along the given axis.
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]]
By default, if any index mentioned is too large, it is replaced by the index that addresses
the last element along an axis (the `clip` mode).
This function supports n-dimensional input and (n-1)-dimensional indices arrays.
Examples::
x = [[ 1., 2.],
[ 3., 4.],
[ 5., 6.]]
// picks elements with specified indices along axis 0
pick(x, y=[0,1], 0) = [ 1., 4.]
// picks elements with specified indices along axis 1
pick(x, y=[0,1,0], 1) = [ 1., 4., 5.]
y = [[ 1.],
[ 0.],
[ 2.]]
// picks elements with specified indices along axis 1 using 'wrap' mode
// to place indicies that would normally be out of bounds
pick(x, y=[2,-1,-2], 1, mode='wrap') = [ 1., 4., 5.]
y = [[ 1.],
[ 0.],
[ 2.]]
// picks elements with specified indices along axis 1 and dims are maintained
pick(x,y, 1, keepdims=True) = [[ 2.],
[ 3.],
[ 6.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\broadcast_reduce_op_index.cc:L154
Declaration
public static Symbol Pick(Symbol data, Symbol index, int? axis, bool keepdims = false, PickMode mode = PickMode.Clip, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array |
| Symbol | index | The index array |
| System.Nullable<System.Int32> | axis | int or None. The axis to picking the elements. Negative values means indexing from right to left. If
is |
| System.Boolean | keepdims | If true, the axis where we pick the elements is left in the result as dimension with size one. |
| PickMode | mode | Specify how out-of-bound indices behave. Default is "clip". "clip" means clip to the range. So, if all indices mentioned are too large, they are replaced by the index that addresses the last element along an axis. "wrap" means to wrap around. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
PlusScalar(Symbol, Single, String)
Declaration
public static Symbol PlusScalar(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 |
Pooling(Symbol, Shape, PoolingType, Boolean, Boolean, PoolingConvention, Shape, Shape, Nullable<Int32>, Nullable<Boolean>, String, String)
Performs pooling on the input.
The shapes for 1-D pooling are
- **data** and **out**: *(batch_size, channel, width)* (NCW layout) or
*(batch_size, width, channel)* (NWC layout),
The shapes for 2-D pooling are
- **data** and **out**: *(batch_size, channel, height, width)* (NCHW layout) or
*(batch_size, height, width, channel)* (NHWC layout),
out_height = f(height, kernel[0], pad[0], stride[0])
out_width = f(width, kernel[1], pad[1], stride[1])
The definition of *f* depends on ``pooling_convention``, which has two options:
- **valid** (default)::
f(x, k, p, s) = floor((x+2*p-k)/s)+1
- **full**, which is compatible with Caffe::
f(x, k, p, s) = ceil((x+2*p-k)/s)+1
But ``global_pool`` is set to be true, then do a global pooling, namely reset
``kernel=(height, width)``.
Three pooling options are supported by ``pool_type``:
- **avg**: average pooling
- **max**: max pooling
- **sum**: sum pooling
- **lp**: Lp pooling
For 3-D pooling, an additional *depth* dimension is added before
*height*. Namely the input data and output will have shape *(batch_size, channel, depth,
height, width)* (NCDHW layout) or *(batch_size, depth, height, width, channel)* (NDHWC layout).
Notes on Lp pooling:
Lp pooling was first introduced by this paper: https://arxiv.org/pdf/1204.3968.pdf.
L-1 pooling is simply sum pooling, while L-inf pooling is simply max pooling.
We can see that Lp pooling stands between those two, in practice the most common value for p is 2.
For each window ``X``, the mathematical expression for Lp pooling is:
:math:`f(X) = \sqrt[p]{\sum_{x}^{X} x^p}`
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\nn\pooling.cc:L416
Declaration
public static Symbol Pooling(Symbol data, Shape kernel = null, PoolingType pool_type = PoolingType.Max, bool global_pool = false, bool cudnn_off = false, PoolingConvention pooling_convention = PoolingConvention.Valid, Shape stride = null, Shape pad = null, int? p_value = default(int? ), bool? count_include_pad = default(bool? ), string layout = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data to the pooling operator. |
| Shape | kernel | Pooling kernel size: (y, x) or (d, y, x) |
| PoolingType | pool_type | Pooling type to be applied. |
| System.Boolean | global_pool | Ignore kernel size, do global pooling based on current input feature map. |
| System.Boolean | cudnn_off | Turn off cudnn pooling and use MXNet pooling operator. |
| PoolingConvention | pooling_convention | Pooling convention to be applied. |
| Shape | stride | Stride: for pooling (y, x) or (d, y, x). Defaults to 1 for each dimension. |
| Shape | pad | Pad for pooling: (y, x) or (d, y, x). Defaults to no padding. |
| System.Nullable<System.Int32> | p_value | Value of p for Lp pooling, can be 1 or 2, required for Lp Pooling. |
| System.Nullable<System.Boolean> | count_include_pad | Only used for AvgPool, specify whether to count padding elements for averagecalculation. For example, with a 55 kernel on a 33 corner of a image,the sum of the 9 valid elements will be divided by 25 if this is set to true,or it will be divided by 9 if this is set to false. Defaults to true. |
| System.String | layout | Set layout for input and output. Empty for default layout: NCW for 1d, NCHW for 2d and NCDHW for 3d. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
PoolingV1(Symbol, Shape, PoolingV1PoolType, Boolean, PoolingV1PoolingConvention, Shape, Shape, String)
This operator is DEPRECATED.
Perform pooling on the input.
The shapes for 2-D pooling is
- **data**: *(batch_size, channel, height, width)*
- **out**: *(batch_size, num_filter, out_height, out_width)*, with::
out_height = f(height, kernel[0], pad[0], stride[0])
out_width = f(width, kernel[1], pad[1], stride[1])
The definition of *f* depends on ``pooling_convention``, which has two options:
- **valid** (default)::
f(x, k, p, s) = floor((x+2*p-k)/s)+1
- **full**, which is compatible with Caffe::
f(x, k, p, s) = ceil((x+2*p-k)/s)+1
But ``global_pool`` is set to be true, then do a global pooling, namely reset
``kernel=(height, width)``.
Three pooling options are supported by ``pool_type``:
- **avg**: average pooling
- **max**: max pooling
- **sum**: sum pooling
1-D pooling is special case of 2-D pooling with *weight=1* and
*kernel[1]=1*.
For 3-D pooling, an additional *depth* dimension is added before
*height*. Namely the input data will have shape *(batch_size, channel, depth,
height, width)*.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\pooling_v1.cc:L104
Declaration
public static Symbol PoolingV1(Symbol data, Shape kernel = null, PoolingV1PoolType pool_type = PoolingV1PoolType.Max, bool global_pool = false, PoolingV1PoolingConvention pooling_convention = PoolingV1PoolingConvention.Valid, Shape stride = null, Shape pad = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data to the pooling operator. |
| Shape | kernel | pooling kernel size: (y, x) or (d, y, x) |
| PoolingV1PoolType | pool_type | Pooling type to be applied. |
| System.Boolean | global_pool | Ignore kernel size, do global pooling based on current input feature map. |
| PoolingV1PoolingConvention | pooling_convention | Pooling convention to be applied. |
| Shape | stride | stride: for pooling (y, x) or (d, y, x) |
| Shape | pad | pad for pooling: (y, x) or (d, y, x) |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Power(Symbol, Symbol, String)
Declaration
public static Symbol Power(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 |
PowerScalar(Symbol, Single, String)
Declaration
public static Symbol PowerScalar(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 |
Prod(Symbol, Shape, Boolean, Boolean, String)
Computes the product of array elements over given axes.
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\broadcast_reduce_op_value.cc:L147
Declaration
public static Symbol Prod(Symbol data, Shape axis = null, bool keepdims = false, bool exclude = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| Shape | axis | The axis or axes along which to perform the reduction. The default, |
| System.Boolean | keepdims | If this is set to |
| System.Boolean | exclude | Whether to perform reduction on axis that are NOT in axis instead. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Radians(Symbol, String)
Converts each element of the input array from degrees to radians.
.. math::
radians([0, 90, 180, 270, 360]) = [0, \pi/2, \pi, 3\pi/2, 2\pi]
The storage type of ``radians`` output depends upon the input storage type:
- radians(default) = default
- radians(row_sparse) = row_sparse
- radians(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_trig.cc:L182
Declaration
public static Symbol Radians(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 |
RandomExponential(Single, Shape, Context, DType, String)
Draw random samples from an exponential distribution.
Samples are distributed according to an exponential distribution parametrized by *lambda* (rate).
Example::
exponential(lam=4, shape=(2,2)) = [[ 0.0097189 , 0.08999364],
[ 0.04146638, 0.31715935]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L137
Declaration
public static Symbol RandomExponential(float lam = 1F, Shape shape = null, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | lam | Lambda parameter (rate) of the exponential distribution. |
| Shape | shape | Shape of the output. |
| Context | ctx | Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomExponentialLike(Symbol, Single, String)
Draw random samples from an exponential distribution according to the input array shape.
Samples are distributed according to an exponential distribution parametrized by *lambda* (rate).
Example::
exponential(lam=4, data=ones(2,2)) = [[ 0.0097189 , 0.08999364],
[ 0.04146638, 0.31715935]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L242
Declaration
public static Symbol RandomExponentialLike(Symbol data, float lam = 1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| System.Single | lam | Lambda parameter (rate) of the exponential distribution. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomGamma(Single, Single, Shape, Context, DType, String)
Draw random samples from a gamma distribution.
Samples are distributed according to a gamma distribution parametrized by *alpha* (shape) and *beta* (scale).
Example::
gamma(alpha=9, beta=0.5, shape=(2,2)) = [[ 7.10486984, 3.37695289],
[ 3.91697288, 3.65933681]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L125
Declaration
public static Symbol RandomGamma(float alpha = 1F, float beta = 1F, Shape shape = null, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | alpha | Alpha parameter (shape) of the gamma distribution. |
| System.Single | beta | Beta parameter (scale) of the gamma distribution. |
| Shape | shape | Shape of the output. |
| Context | ctx | Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomGammaLike(Symbol, Single, Single, String)
Draw random samples from a gamma distribution according to the input array shape.
Samples are distributed according to a gamma distribution parametrized by *alpha* (shape) and *beta* (scale).
Example::
gamma(alpha=9, beta=0.5, data=ones(2,2)) = [[ 7.10486984, 3.37695289],
[ 3.91697288, 3.65933681]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L231
Declaration
public static Symbol RandomGammaLike(Symbol data, float alpha = 1F, float beta = 1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| System.Single | alpha | Alpha parameter (shape) of the gamma distribution. |
| System.Single | beta | Beta parameter (scale) of the gamma distribution. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomGeneralizedNegativeBinomial(Single, Single, Shape, Context, DType, String)
Draw random samples from a generalized negative binomial distribution.
Samples are distributed according to a generalized negative binomial distribution parametrized by
*mu* (mean) and *alpha* (dispersion). *alpha* is defined as *1/k* where *k* is the failure limit of the
number of unsuccessful experiments (generalized to real numbers).
Samples will always be returned as a floating point data type.
Example::
generalized_negative_binomial(mu=2.0, alpha=0.3, shape=(2,2)) = [[ 2., 1.],
[ 6., 4.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L179
Declaration
public static Symbol RandomGeneralizedNegativeBinomial(float mu = 1F, float alpha = 1F, Shape shape = null, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | mu | Mean of the negative binomial distribution. |
| System.Single | alpha | Alpha (dispersion) parameter of the negative binomial distribution. |
| Shape | shape | Shape of the output. |
| Context | ctx | Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomGeneralizedNegativeBinomialLike(Symbol, Single, Single, String)
Draw random samples from a generalized negative binomial distribution according to the
input array shape.
Samples are distributed according to a generalized negative binomial distribution parametrized by
*mu* (mean) and *alpha* (dispersion). *alpha* is defined as *1/k* where *k* is the failure limit of the
number of unsuccessful experiments (generalized to real numbers).
Samples will always be returned as a floating point data type.
Example::
generalized_negative_binomial(mu=2.0, alpha=0.3, data=ones(2,2)) = [[ 2., 1.],
[ 6., 4.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L283
Declaration
public static Symbol RandomGeneralizedNegativeBinomialLike(Symbol data, float mu = 1F, float alpha = 1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| System.Single | mu | Mean of the negative binomial distribution. |
| System.Single | alpha | Alpha (dispersion) parameter of the negative binomial distribution. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomNegativeBinomial(Int32, Single, Shape, Context, DType, String)
Draw random samples from a negative binomial distribution.
Samples are distributed according to a negative binomial distribution parametrized by
*k* (limit of unsuccessful experiments) and *p* (failure probability in each experiment).
Samples will always be returned as a floating point data type.
Example::
negative_binomial(k=3, p=0.4, shape=(2,2)) = [[ 4., 7.],
[ 2., 5.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L164
Declaration
public static Symbol RandomNegativeBinomial(int k = 1, float p = 1F, Shape shape = null, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | k | Limit of unsuccessful experiments. |
| System.Single | p | Failure probability in each experiment. |
| Shape | shape | Shape of the output. |
| Context | ctx | Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomNegativeBinomialLike(Symbol, Int32, Single, String)
Draw random samples from a negative binomial distribution according to the input array shape.
Samples are distributed according to a negative binomial distribution parametrized by
*k* (limit of unsuccessful experiments) and *p* (failure probability in each experiment).
Samples will always be returned as a floating point data type.
Example::
negative_binomial(k=3, p=0.4, data=ones(2,2)) = [[ 4., 7.],
[ 2., 5.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L267
Declaration
public static Symbol RandomNegativeBinomialLike(Symbol data, int k = 1, float p = 1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| System.Int32 | k | Limit of unsuccessful experiments. |
| System.Single | p | Failure probability in each experiment. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomNormal(Single, Single, Shape, Context, DType, String)
Draw random samples from a normal (Gaussian) distribution.
.. note:: The existing alias ``normal`` is deprecated.
Samples are distributed according to a normal distribution parametrized by *loc* (mean) and *scale*
(standard deviation).
Example::
normal(loc=0, scale=1, shape=(2,2)) = [[ 1.89171135, -1.16881478],
[-1.23474145, 1.55807114]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L113
Declaration
public static Symbol RandomNormal(float loc = 0F, float scale = 1F, Shape shape = null, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | loc | Mean of the distribution. |
| System.Single | scale | Standard deviation of the distribution. |
| Shape | shape | Shape of the output. |
| Context | ctx | Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomNormalLike(Symbol, Single, Single, String)
Draw random samples from a normal (Gaussian) distribution according to the input array shape.
Samples are distributed according to a normal distribution parametrized by *loc* (mean) and *scale*
(standard deviation).
Example::
normal(loc=0, scale=1, data=ones(2,2)) = [[ 1.89171135, -1.16881478],
[-1.23474145, 1.55807114]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L220
Declaration
public static Symbol RandomNormalLike(Symbol data, float loc = 0F, float scale = 1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| System.Single | loc | Mean of the distribution. |
| System.Single | scale | Standard deviation of the distribution. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomPoisson(Single, Shape, Context, DType, String)
Draw random samples from a Poisson distribution.
Samples are distributed according to a Poisson distribution parametrized by *lambda* (rate).
Samples will always be returned as a floating point data type.
Example::
poisson(lam=4, shape=(2,2)) = [[ 5., 2.],
[ 4., 6.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L150
Declaration
public static Symbol RandomPoisson(float lam = 1F, Shape shape = null, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | lam | Lambda parameter (rate) of the Poisson distribution. |
| Shape | shape | Shape of the output. |
| Context | ctx | Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomPoissonLike(Symbol, Single, String)
Draw random samples from a Poisson distribution according to the input array shape.
Samples are distributed according to a Poisson distribution parametrized by *lambda* (rate).
Samples will always be returned as a floating point data type.
Example::
poisson(lam=4, data=ones(2,2)) = [[ 5., 2.],
[ 4., 6.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L254
Declaration
public static Symbol RandomPoissonLike(Symbol data, float lam = 1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| System.Single | lam | Lambda parameter (rate) of the Poisson distribution. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomRandint(Tuple<Double>, Tuple<Double>, Shape, Context, DType, String)
Draw random samples from a discrete uniform distribution.
Samples are uniformly distributed over the half-open interval *[low, high)*
(includes *low*, but excludes *high*).
Example::
randint(low=0, high=5, shape=(2,2)) = [[ 0, 2],
[ 3, 1]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L193
Declaration
public static Symbol RandomRandint(Tuple<double> low, Tuple<double> high, Shape shape = null, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Tuple<System.Double> | low | Lower bound of the distribution. |
| Tuple<System.Double> | high | Upper bound of the distribution. |
| Shape | shape | Shape of the output. |
| Context | ctx | Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to int32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomUniform(Single, Single, Shape, Context, DType, String)
Draw random samples from a uniform distribution.
.. note:: The existing alias ``uniform`` is deprecated.
Samples are uniformly distributed over the half-open interval *[low, high)*
(includes *low*, but excludes *high*).
Example::
uniform(low=0, high=1, shape=(2,2)) = [[ 0.60276335, 0.85794562],
[ 0.54488319, 0.84725171]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L96
Declaration
public static Symbol RandomUniform(float low = 0F, float high = 1F, Shape shape = null, Context ctx = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | low | Lower bound of the distribution. |
| System.Single | high | Upper bound of the distribution. |
| Shape | shape | Shape of the output. |
| Context | ctx | Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RandomUniformLike(Symbol, Single, Single, String)
Draw random samples from a uniform distribution according to the input array shape.
Samples are uniformly distributed over the half-open interval *[low, high)*
(includes *low*, but excludes *high*).
Example::
uniform(low=0, high=1, data=ones(2,2)) = [[ 0.60276335, 0.85794562],
[ 0.54488319, 0.84725171]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\sample_op.cc:L208
Declaration
public static Symbol RandomUniformLike(Symbol data, float low = 0F, float high = 1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input |
| System.Single | low | Lower bound of the distribution. |
| System.Single | high | Upper bound of the distribution. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RavelMultiIndex(Symbol, Shape, String)
Converts a batch of index arrays into an array of flat indices. The operator follows numpy conventions so a single multi index is given by a column of the input matrix. The leading dimension may be left unspecified by using -1 as placeholder.
Examples::
A = [[3,6,6],[4,5,1]]
ravel(A, shape=(7,6)) = [22,41,37]
ravel(A, shape=(-1,6)) = [22,41,37]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\ravel.cc:L42
Declaration
public static Symbol RavelMultiIndex(Symbol data, Shape shape = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Batch of multi-indices |
| Shape | shape | Shape of the array into which the multi-indices apply. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Rcbrt(Symbol, String)
Returns element-wise inverse cube-root value of the input.
.. math::
rcbrt(x) = 1/\sqrt[3]{x}
Example::
rcbrt([1,8,-125]) = [1.0, 0.5, -0.2]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L955
Declaration
public static Symbol Rcbrt(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 |
RdivScalar(Symbol, Single, String)
Declaration
public static Symbol RdivScalar(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 |
Reciprocal(Symbol, String)
Returns the reciprocal of the argument, element-wise.
Calculates 1/x.
Example::
reciprocal([-2, 1, 3, 1.6, 0.2]) = [-0.5, 1.0, 0.33333334, 0.625, 5.0]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L663
Declaration
public static Symbol Reciprocal(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 |
Relu(Symbol, String)
Computes rectified linear activation.
.. math::
max(features, 0)
The storage type of ``relu`` output depends upon the input storage type:
- relu(default) = default
- relu(row_sparse) = row_sparse
- relu(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L85
Declaration
public static Symbol Relu(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 |
Repeat(Symbol, Int32, Nullable<Int32>, String)
Repeats elements of an array.
By default, ``repeat`` flattens the input array into 1-D and then repeats the
elements::
x = [[ 1, 2],
[ 3, 4]]
repeat(x, repeats=2) = [ 1., 1., 2., 2., 3., 3., 4., 4.]
The parameter ``axis`` specifies the axis along which to perform repeat::
repeat(x, repeats=2, axis=1) = [[ 1., 1., 2., 2.],
[ 3., 3., 4., 4.]]
repeat(x, repeats=2, axis=0) = [[ 1., 2.],
[ 1., 2.],
[ 3., 4.],
[ 3., 4.]]
repeat(x, repeats=2, axis=-1) = [[ 1., 1., 2., 2.],
[ 3., 3., 4., 4.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\matrix_op.cc:L820
Declaration
public static Symbol Repeat(Symbol data, int repeats, int? axis = default(int? ), string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data array |
| System.Int32 | repeats | The number of repetitions for each element. |
| System.Nullable<System.Int32> | axis | The axis along which to repeat values. The negative numbers are interpreted counting from the backward. By default, use the flattened input array, and return a flat output array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Reshape(Symbol, Shape, Boolean, String)
Reshapes the input array.
.. note:: ``Reshape`` is deprecated, use ``reshape``
Given an array and a shape, this function returns a copy of the array in the new shape.
The shape is a tuple of integers such as (2,3,4). The size of the new shape should be same as the size of the input array.
Example::
reshape([1,2,3,4], shape=(2,2)) = [[1,2], [3,4]]
Some dimensions of the shape can take special values from the set {0, -1, -2, -3, -4}. The significance of each is explained below:
- ``0`` copy this dimension from the input to the output shape.
Example::
- input shape = (2,3,4), shape = (4,0,2), output shape = (4,3,2)
- input shape = (2,3,4), shape = (2,0,0), output shape = (2,3,4)
- ``-1`` infers the dimension of the output shape by using the remainder of the input dimensions
keeping the size of the new array same as that of the input array.
At most one dimension of shape can be -1.
Example::
- input shape = (2,3,4), shape = (6,1,-1), output shape = (6,1,4)
- input shape = (2,3,4), shape = (3,-1,8), output shape = (3,1,8)
- input shape = (2,3,4), shape=(-1,), output shape = (24,)
- ``-2`` copy all/remainder of the input dimensions to the output shape.
Example::
- input shape = (2,3,4), shape = (-2,), output shape = (2,3,4)
- input shape = (2,3,4), shape = (2,-2), output shape = (2,3,4)
- input shape = (2,3,4), shape = (-2,1,1), output shape = (2,3,4,1,1)
- ``-3`` use the product of two consecutive dimensions of the input shape as the output dimension.
Example::
- input shape = (2,3,4), shape = (-3,4), output shape = (6,4)
- input shape = (2,3,4,5), shape = (-3,-3), output shape = (6,20)
- input shape = (2,3,4), shape = (0,-3), output shape = (2,12)
- input shape = (2,3,4), shape = (-3,-2), output shape = (6,4)
- ``-4`` split one dimension of the input into two dimensions passed subsequent to -4 in shape (can contain -1).
Example::
- input shape = (2,3,4), shape = (-4,1,2,-2), output shape =(1,2,3,4)
- input shape = (2,3,4), shape = (2,-4,-1,3,-2), output shape = (2,1,3,4)
If the argument `reverse` is set to 1, then the special values are inferred from right to left.
Example::
- without reverse=1, for input shape = (10,5,4), shape = (-1,0), output shape would be (40,5)
- with reverse=1, output shape will be (50,4).
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\matrix_op.cc:L222
Declaration
public static Symbol Reshape(Symbol data, Shape shape = null, bool reverse = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data to reshape. |
| Shape | shape | The target shape |
| System.Boolean | reverse | If true then the special values are inferred from right to left |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
ReshapeLike(Symbol, Symbol, String)
Reshape some or all dimensions of `lhs` to have the same shape as some or all dimensions of `rhs`.
Returns a **view** of the `lhs` array with a new shape without altering any data.
Example::
x = [1, 2, 3, 4, 5, 6]
y = [[0, -4], [3, 2], [2, 2]]
reshape_like(x, y) = [[1, 2], [3, 4], [5, 6]]
More precise control over how dimensions are inherited is achieved by specifying \
slices over the `lhs` and `rhs` array dimensions. Only the sliced `lhs` dimensions \
are reshaped to the `rhs` sliced dimensions, with the non-sliced `lhs` dimensions staying the same.
Examples::
- lhs shape = (30,7), rhs shape = (15,2,4), lhs_begin=0, lhs_end=1, rhs_begin=0, rhs_end=2, output shape = (15,2,7)
- lhs shape = (3, 5), rhs shape = (1,15,4), lhs_begin=0, lhs_end=2, rhs_begin=1, rhs_end=2, output shape = (15)
Negative indices are supported, and `None` can be used for either `lhs_end` or `rhs_end` to indicate the end of the range.
Example::
- lhs shape = (30, 12), rhs shape = (4, 2, 2, 3), lhs_begin=-1, lhs_end=None, rhs_begin=1, rhs_end=None, output shape = (30, 2, 2, 3)
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L469
Declaration
public static Symbol ReshapeLike(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 |
Reverse(Symbol, Shape, String)
Reverses the order of elements along given axis while preserving array shape.
Note: reverse and flip are equivalent. We use reverse in the following examples.
Examples::
x = [[ 0., 1., 2., 3., 4.],
[ 5., 6., 7., 8., 9.]]
reverse(x, axis=0) = [[ 5., 6., 7., 8., 9.],
[ 0., 1., 2., 3., 4.]]
reverse(x, axis=1) = [[ 4., 3., 2., 1., 0.],
[ 9., 8., 7., 6., 5.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\matrix_op.cc:L922
Declaration
public static Symbol Reverse(Symbol data, Shape axis, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data array |
| Shape | axis | The axis which to reverse elements. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Rint(Symbol, String)
Returns element-wise rounded value to the nearest integer of the input.
.. note::
- For input ``n.5`` ``rint`` returns ``n`` while ``round`` returns ``n+1``.
- For input ``-n.5`` both ``rint`` and ``round`` returns ``-n-1``.
Example::
rint([-1.5, 1.5, -1.9, 1.9, 2.1]) = [-2., 1., -2., 2., 2.]
The storage type of ``rint`` output depends upon the input storage type:
- rint(default) = default
- rint(row_sparse) = row_sparse
- rint(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L744
Declaration
public static Symbol Rint(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 |
RminusScalar(Symbol, Single, String)
Declaration
public static Symbol RminusScalar(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 |
RmodScalar(Symbol, Single, String)
Declaration
public static Symbol RmodScalar(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 |
RmspropalexUpdate(Symbol, Symbol, Symbol, Symbol, Symbol, Single, Single, Single, Single, Single, Single, Single, Single, String)
Declaration
public static Symbol RmspropalexUpdate(Symbol weight, Symbol grad, Symbol n, Symbol g, Symbol delta, float lr, float gamma1 = 0.95F, float gamma2 = 0.9F, float epsilon = 1E-08F, float wd = 0F, float rescale_grad = 1F, float clip_gradient = -1F, float clip_weights = -1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | weight | |
| Symbol | grad | |
| Symbol | n | |
| Symbol | g | |
| Symbol | delta | |
| System.Single | lr | |
| System.Single | gamma1 | |
| System.Single | gamma2 | |
| System.Single | epsilon | |
| System.Single | wd | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.Single | clip_weights | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
RmspropUpdate(Symbol, Symbol, Symbol, Single, Single, Single, Single, Single, Single, Single, String)
Declaration
public static Symbol RmspropUpdate(Symbol weight, Symbol grad, Symbol n, float lr, float gamma1 = 0.95F, float epsilon = 1E-08F, float wd = 0F, float rescale_grad = 1F, float clip_gradient = -1F, float clip_weights = -1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | weight | |
| Symbol | grad | |
| Symbol | n | |
| System.Single | lr | |
| System.Single | gamma1 | |
| System.Single | epsilon | |
| System.Single | wd | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.Single | clip_weights | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
RNN(Symbol, Symbol, Symbol, Symbol, UInt32, UInt32, RNNMode, Boolean, Single, Boolean, Nullable<Int32>, Nullable<Double>, Nullable<Double>, Boolean, String)
Applies recurrent layers to input data. Currently, vanilla RNN, LSTM and GRU are
implemented, with both multi-layer and bidirectional support.
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.
**Vanilla RNN**
Applies a single-gate recurrent layer to input X. Two kinds of activation function are supported:
ReLU and Tanh.
With ReLU activation function:
.. math::
h_t = relu(W_{ih} * x_t + b_{ih} + W_{hh} * h_{(t-1)} + b_{hh})
With Tanh activtion function:
.. math::
h_t = \tanh(W_{ih} * x_t + b_{ih} + W_{hh} * h_{(t-1)} + b_{hh})
Reference paper: Finding structure in time - Elman, 1988.
https://crl.ucsd.edu/~elman/Papers/fsit.pdf
**LSTM**
Long Short-Term Memory - Hochreiter, 1997. http://www.bioinf.jku.at/publications/older/2604.pdf
.. math::
\begin{array}{ll}
i_t = \mathrm{sigmoid}(W_{ii} x_t + b_{ii} + W_{hi} h_{(t-1)} + b_{hi}) \\
f_t = \mathrm{sigmoid}(W_{if} x_t + b_{if} + W_{hf} h_{(t-1)} + b_{hf}) \\
g_t = \tanh(W_{ig} x_t + b_{ig} + W_{hc} h_{(t-1)} + b_{hg}) \\
o_t = \mathrm{sigmoid}(W_{io} x_t + b_{io} + W_{ho} h_{(t-1)} + b_{ho}) \\
c_t = f_t * c_{(t-1)} + i_t * g_t \\
h_t = o_t * \tanh(c_t)
\end{array}
**GRU**
Gated Recurrent Unit - Cho et al. 2014. http://arxiv.org/abs/1406.1078
The definition of GRU here is slightly different from paper but compatible with CUDNN.
.. math::
\begin{array}{ll}
r_t = \mathrm{sigmoid}(W_{ir} x_t + b_{ir} + W_{hr} h_{(t-1)} + b_{hr}) \\
z_t = \mathrm{sigmoid}(W_{iz} x_t + b_{iz} + W_{hz} h_{(t-1)} + b_{hz}) \\
n_t = \tanh(W_{in} x_t + b_{in} + r_t * (W_{hn} h_{(t-1)}+ b_{hn})) \\
h_t = (1 - z_t) * n_t + z_t * h_{(t-1)} \\
\end{array}
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\rnn.cc:L219
Declaration
public static Symbol RNN(Symbol data, Symbol parameters, Symbol state, Symbol state_cell, uint state_size, uint num_layers, RNNMode mode, bool bidirectional = false, float p = 0F, bool state_outputs = false, int? projection_size = default(int? ), double? lstm_state_clip_min = default(double? ), double? lstm_state_clip_max = default(double? ), bool lstm_state_clip_nan = false, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data to RNN |
| Symbol | parameters | Vector of all RNN trainable parameters concatenated |
| Symbol | state | initial hidden state of the RNN |
| Symbol | state_cell | initial cell state for LSTM networks (only for LSTM) |
| System.UInt32 | state_size | size of the state for each layer |
| System.UInt32 | num_layers | number of stacked layers |
| RNNMode | mode | the type of RNN to compute |
| System.Boolean | bidirectional | whether to use bidirectional recurrent layers |
| System.Single | p | drop rate of the dropout on the outputs of each RNN layer, except the last layer. |
| System.Boolean | state_outputs | Whether to have the states as symbol outputs. |
| System.Nullable<System.Int32> | projection_size | size of project size |
| System.Nullable<System.Double> | lstm_state_clip_min | Minimum clip value of LSTM states. This option must be used together with lstm_state_clip_max. |
| System.Nullable<System.Double> | lstm_state_clip_max | Maximum clip value of LSTM states. This option must be used together with lstm_state_clip_min. |
| System.Boolean | lstm_state_clip_nan | Whether to stop NaN from propagating in state by clipping it to min/max. If clipping range is not specified, this option is ignored. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
RnnParamConcat(SymbolList, Int32, Int32, String)
Declaration
public static Symbol RnnParamConcat(SymbolList data, int num_args, int dim = 1, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| SymbolList | data | List of arrays to concatenate |
| System.Int32 | num_args | Number of inputs to be concated. |
| System.Int32 | dim | the dimension to be concated. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
ROIPooling(Symbol, Symbol, Shape, Single, String)
Performs region of interest(ROI) pooling on the input array.
ROI pooling is a variant of a max pooling layer, in which the output size is fixed and
region of interest is a parameter. Its purpose is to perform max pooling on the inputs
of non-uniform sizes to obtain fixed-size feature maps. ROI pooling is a neural-net
layer mostly used in training a `Fast R-CNN` network for object detection.
This operator takes a 4D feature map as an input array and region proposals as `rois`,
then it pools over sub-regions of input and produces a fixed-sized output array
regardless of the ROI size.
To crop the feature map accordingly, you can resize the bounding box coordinates
by changing the parameters `rois` and `spatial_scale`.
The cropped feature maps are pooled by standard max pooling operation to a fixed size output
indicated by a `pooled_size` parameter. batch_size will change to the number of region
bounding boxes after `ROIPooling`.
The size of each region of interest doesn't have to be perfectly divisible by
the number of pooling sections(`pooled_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.],
[ 24., 25., 26., 27., 28., 29.],
[ 30., 31., 32., 33., 34., 35.],
[ 36., 37., 38., 39., 40., 41.],
[ 42., 43., 44., 45., 46., 47.]]]]
// region of interest i.e. bounding box coordinates.
y = [[0,0,0,4,4]]
// returns array of shape (2,2) according to the given roi with max pooling.
ROIPooling(x, y, (2,2), 1.0) = [[[[ 14., 16.],
[ 26., 28.]]]]
// region of interest is changed due to the change in `spacial_scale` parameter.
ROIPooling(x, y, (2,2), 0.7) = [[[[ 7., 9.],
[ 19., 21.]]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\roi_pooling.cc:L295
Declaration
public static Symbol ROIPooling(Symbol data, Symbol rois, Shape pooled_size, float spatial_scale, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array to the pooling operator, a 4D Feature maps |
| Symbol | rois | Bounding box coordinates, a 2D array of [[batch_index, x1, y1, x2, y2]], where (x1, y1) and (x2, y2)
are top left and bottom right corners of designated region of interest. |
| Shape | pooled_size | ROI pooling output shape (h,w) |
| System.Single | spatial_scale | Ratio of input feature map height (or w) to raw image height (or w). Equals the reciprocal of total stride in convolutional layers |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Round(Symbol, String)
Returns element-wise rounded value to the nearest integer of the input.
Example::
round([-1.5, 1.5, -1.9, 1.9, 2.1]) = [-2., 2., -2., 2., 2.]
The storage type of ``round`` output depends upon the input storage type:
- round(default) = default
- round(row_sparse) = row_sparse
- round(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L723
Declaration
public static Symbol Round(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 |
RpowerScalar(Symbol, Single, String)
Declaration
public static Symbol RpowerScalar(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 |
Rsqrt(Symbol, String)
Returns element-wise inverse square-root value of the input.
.. math::
rsqrt(x) = 1/\sqrt{x}
Example::
rsqrt([4,9,16]) = [0.5, 0.33333334, 0.25]
The storage type of ``rsqrt`` output is always dense
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L883
Declaration
public static Symbol Rsqrt(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 |
SampleExponential(Symbol, Shape, DType, String)
Concurrent sampling from multiple
exponential distributions with parameters lambda (rate).
The parameters of the distributions are provided as an input array.
Let *[s]* be the shape of the input array, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.
For any valid *n*-dimensional index *i* with respect to the input array, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input value at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input array.
Examples::
lam = [ 1.0, 8.5 ]
// Draw a single sample for each distribution
sample_exponential(lam) = [ 0.51837951, 0.09994757]
// Draw a vector containing two samples for each distribution
sample_exponential(lam, shape=(2)) = [[ 0.51837951, 0.19866663],
[ 0.09994757, 0.50447971]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\multisample_op.cc:L284
Declaration
public static Symbol SampleExponential(Symbol lam, Shape shape = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lam | Lambda (rate) parameters of the distributions. |
| Shape | shape | Shape to be sampled from each random distribution. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SampleGamma(Symbol, Symbol, Shape, DType, String)
Concurrent sampling from multiple
gamma distributions with parameters *alpha* (shape) and *beta* (scale).
The parameters of the distributions are provided as input arrays.
Let *[s]* be the shape of the input arrays, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.
For any valid *n*-dimensional index *i* with respect to the input arrays, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.
Examples::
alpha = [ 0.0, 2.5 ]
beta = [ 1.0, 0.7 ]
// Draw a single sample for each distribution
sample_gamma(alpha, beta) = [ 0. , 2.25797319]
// Draw a vector containing two samples for each distribution
sample_gamma(alpha, beta, shape=(2)) = [[ 0. , 0. ],
[ 2.25797319, 1.70734084]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\multisample_op.cc:L282
Declaration
public static Symbol SampleGamma(Symbol alpha, Symbol beta, Shape shape = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | alpha | Alpha (shape) parameters of the distributions. |
| Symbol | beta | Beta (scale) parameters of the distributions. |
| Shape | shape | Shape to be sampled from each random distribution. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SampleGeneralizedNegativeBinomial(Symbol, Symbol, Shape, DType, String)
Concurrent sampling from multiple
generalized negative binomial distributions with parameters *mu* (mean) and *alpha* (dispersion).
The parameters of the distributions are provided as input arrays.
Let *[s]* be the shape of the input arrays, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.
For any valid *n*-dimensional index *i* with respect to the input arrays, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.
Samples will always be returned as a floating point data type.
Examples::
mu = [ 2.0, 2.5 ]
alpha = [ 1.0, 0.1 ]
// Draw a single sample for each distribution
sample_generalized_negative_binomial(mu, alpha) = [ 0., 3.]
// Draw a vector containing two samples for each distribution
sample_generalized_negative_binomial(mu, alpha, shape=(2)) = [[ 0., 3.],
[ 3., 1.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\multisample_op.cc:L293
Declaration
public static Symbol SampleGeneralizedNegativeBinomial(Symbol mu, Symbol alpha, Shape shape = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | mu | Means of the distributions. |
| Symbol | alpha | Alpha (dispersion) parameters of the distributions. |
| Shape | shape | Shape to be sampled from each random distribution. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SampleMultinomial(Symbol, Shape, Boolean, DType, String)
Concurrent sampling from multiple multinomial distributions.
*data* is an *n* dimensional array whose last dimension has length *k*, where
*k* is the number of possible outcomes of each multinomial distribution. This
operator will draw *shape* samples from each distribution. If shape is empty
one sample will be drawn from each distribution.
If *get_prob* is true, a second array containing log likelihood of the drawn
samples will also be returned. This is usually used for reinforcement learning
where you can provide reward as head gradient for this array to estimate
gradient.
Note that the input distribution must be normalized, i.e. *data* must sum to
1 along its last axis.
Examples::
probs = [[0, 0.1, 0.2, 0.3, 0.4], [0.4, 0.3, 0.2, 0.1, 0]]
// Draw a single sample for each distribution
sample_multinomial(probs) = [3, 0]
// Draw a vector containing two samples for each distribution
sample_multinomial(probs, shape=(2)) = [[4, 2],
[0, 0]]
// requests log likelihood
sample_multinomial(probs, get_prob=True) = [2, 1], [0.2, 0.3]
Declaration
public static Symbol SampleMultinomial(Symbol data, Shape shape = null, bool get_prob = false, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Distribution probabilities. Must sum to one on the last axis. |
| Shape | shape | Shape to be sampled from each random distribution. |
| System.Boolean | get_prob | Whether to also return the log probability of sampled result. This is usually used for differentiating through stochastic variables, e.g. in reinforcement learning. |
| DType | dtype | DType of the output in case this can't be inferred. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SampleNegativeBinomial(Symbol, Symbol, Shape, DType, String)
Concurrent sampling from multiple
negative binomial distributions with parameters *k* (failure limit) and *p* (failure probability).
The parameters of the distributions are provided as input arrays.
Let *[s]* be the shape of the input arrays, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.
For any valid *n*-dimensional index *i* with respect to the input arrays, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.
Samples will always be returned as a floating point data type.
Examples::
k = [ 20, 49 ]
p = [ 0.4 , 0.77 ]
// Draw a single sample for each distribution
sample_negative_binomial(k, p) = [ 15., 16.]
// Draw a vector containing two samples for each distribution
sample_negative_binomial(k, p, shape=(2)) = [[ 15., 50.],
[ 16., 12.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\multisample_op.cc:L289
Declaration
public static Symbol SampleNegativeBinomial(Symbol k, Symbol p, Shape shape = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | k | Limits of unsuccessful experiments. |
| Symbol | p | Failure probabilities in each experiment. |
| Shape | shape | Shape to be sampled from each random distribution. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SampleNormal(Symbol, Symbol, Shape, DType, String)
Concurrent sampling from multiple
normal distributions with parameters *mu* (mean) and *sigma* (standard deviation).
The parameters of the distributions are provided as input arrays.
Let *[s]* be the shape of the input arrays, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.
For any valid *n*-dimensional index *i* with respect to the input arrays, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.
Examples::
mu = [ 0.0, 2.5 ]
sigma = [ 1.0, 3.7 ]
// Draw a single sample for each distribution
sample_normal(mu, sigma) = [-0.56410581, 0.95934606]
// Draw a vector containing two samples for each distribution
sample_normal(mu, sigma, shape=(2)) = [[-0.56410581, 0.2928229 ],
[ 0.95934606, 4.48287058]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\multisample_op.cc:L279
Declaration
public static Symbol SampleNormal(Symbol mu, Symbol sigma, Shape shape = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | mu | Means of the distributions. |
| Symbol | sigma | Standard deviations of the distributions. |
| Shape | shape | Shape to be sampled from each random distribution. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SamplePoisson(Symbol, Shape, DType, String)
Concurrent sampling from multiple
Poisson distributions with parameters lambda (rate).
The parameters of the distributions are provided as an input array.
Let *[s]* be the shape of the input array, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.
For any valid *n*-dimensional index *i* with respect to the input array, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input value at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input array.
Samples will always be returned as a floating point data type.
Examples::
lam = [ 1.0, 8.5 ]
// Draw a single sample for each distribution
sample_poisson(lam) = [ 0., 13.]
// Draw a vector containing two samples for each distribution
sample_poisson(lam, shape=(2)) = [[ 0., 4.],
[ 13., 8.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\multisample_op.cc:L286
Declaration
public static Symbol SamplePoisson(Symbol lam, Shape shape = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lam | Lambda (rate) parameters of the distributions. |
| Shape | shape | Shape to be sampled from each random distribution. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SampleUniform(Symbol, Symbol, Shape, DType, String)
Concurrent sampling from multiple
uniform distributions on the intervals given by *[low,high)*.
The parameters of the distributions are provided as input arrays.
Let *[s]* be the shape of the input arrays, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.
For any valid *n*-dimensional index *i* with respect to the input arrays, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.
Examples::
low = [ 0.0, 2.5 ]
high = [ 1.0, 3.7 ]
// Draw a single sample for each distribution
sample_uniform(low, high) = [ 0.40451524, 3.18687344]
// Draw a vector containing two samples for each distribution
sample_uniform(low, high, shape=(2)) = [[ 0.40451524, 0.18017688],
[ 3.18687344, 3.68352246]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\multisample_op.cc:L277
Declaration
public static Symbol SampleUniform(Symbol low, Symbol high, Shape shape = null, DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | low | Lower bounds of the distributions. |
| Symbol | high | Upper bounds of the distributions. |
| Shape | shape | Shape to be sampled from each random distribution. |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SampleUniqueZipfian(Int32, Shape, String)
Draw random samples from an an approximately log-uniform
or Zipfian distribution without replacement.
This operation takes a 2-D shape `(batch_size, num_sampled)`,
and randomly generates *num_sampled* samples from the range of integers [0, range_max)
for each instance in the batch.
The elements in each instance are drawn without replacement from the base distribution.
The base distribution for this operator is an approximately log-uniform or Zipfian distribution:
P(class) = (log(class + 2) - log(class + 1)) / log(range_max + 1)
Additionaly, it also returns the number of trials used to obtain `num_sampled` samples for
each instance in the batch.
Example::
samples, trials = _sample_unique_zipfian(750000, shape=(4, 8192))
unique(samples[0]) = 8192
unique(samples[3]) = 8192
trials[0] = 16435
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\random\unique_sample_op.cc:L66
Declaration
public static Symbol SampleUniqueZipfian(int range_max, Shape shape = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | range_max | The number of possible classes. |
| Shape | shape | 2-D shape of the output, where shape[0] is the batch size, and shape[1] is the number of candidates to sample for each batch. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
ScatterElemwiseDiv(Symbol, Symbol, String)
Divides arguments element-wise. If the left-hand-side input is 'row_sparse', then
only the values which exist in the left-hand sparse array are computed. The 'missing' values
are ignored.
The storage type of ``_scatter_elemwise_div`` output depends on storage types of inputs
- _scatter_elemwise_div(row_sparse, row_sparse) = row_sparse
- _scatter_elemwise_div(row_sparse, dense) = row_sparse
- _scatter_elemwise_div(row_sparse, csr) = row_sparse
- otherwise, ``_scatter_elemwise_div`` behaves exactly like elemwise_div and generates output
with default storage
Declaration
public static Symbol ScatterElemwiseDiv(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 |
ScatterMinusScalar(Symbol, Single, String)
Subtracts a scalar to a tensor element-wise. If the left-hand-side input is
'row_sparse' or 'csr', then only the values which exist in the left-hand sparse array are computed.
The 'missing' values are ignored.
The storage type of ``_scatter_minus_scalar`` output depends on storage types of inputs
- _scatter_minus_scalar(row_sparse, scalar) = row_sparse
- _scatter_minus_scalar(csr, scalar) = csr
- otherwise, ``_scatter_minus_scalar`` behaves exactly like _minus_scalar and generates output
with default storage
Declaration
public static Symbol ScatterMinusScalar(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 |
ScatterNd(Symbol, Symbol, Shape, String)
Declaration
public static Symbol ScatterNd(Symbol data, Symbol indices, Shape shape, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | |
| Symbol | indices | |
| Shape | shape | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
ScatterPlusScalar(Symbol, Single, String)
Adds a scalar to a tensor element-wise. If the left-hand-side input is
'row_sparse' or 'csr', then only the values which exist in the left-hand sparse array are computed.
The 'missing' values are ignored.
The storage type of ``_scatter_plus_scalar`` output depends on storage types of inputs
- _scatter_plus_scalar(row_sparse, scalar) = row_sparse
- _scatter_plus_scalar(csr, scalar) = csr
- otherwise, ``_scatter_plus_scalar`` behaves exactly like _plus_scalar and generates output
with default storage
Declaration
public static Symbol ScatterPlusScalar(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 |
ScatterSetNd(Symbol, Symbol, Symbol, Shape, String)
This operator has the same functionality as scatter_nd
except that it does not reset the elements not indexed by the input
index `NDArray` in the input data `NDArray`. output should be explicitly
given and be the same as lhs.
.. note:: This operator is for internal use only.
Examples::
data = [2, 3, 0]
indices = [[1, 1, 0], [0, 1, 0]]
out = [[1, 1], [1, 1]]
_scatter_set_nd(lhs=out, rhs=data, indices=indices, out=out)
out = [[0, 1], [2, 3]]
Declaration
public static Symbol ScatterSetNd(Symbol lhs, Symbol rhs, Symbol indices, Shape shape, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | source input |
| Symbol | rhs | value to assign |
| Symbol | indices | indices |
| Shape | shape | Shape of output. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SequenceLast(Symbol, Symbol, Boolean, Int32, String)
Takes the last element of a sequence.
This function takes an n-dimensional input array of the form
[max_sequence_length, batch_size, other_feature_dims] and returns a (n-1)-dimensional array
of the form [batch_size, other_feature_dims].
Parameter `sequence_length` is used to handle variable-length sequences. `sequence_length` should be
an input array of positive ints of dimension [batch_size]. To use this parameter,
set `use_sequence_length` to `True`, otherwise each example in the batch is assumed
to have the max sequence length.
.. note:: Alternatively, you can also use `take` operator.
Example::
x = [[[ 1., 2., 3.],
[ 4., 5., 6.],
[ 7., 8., 9.]],
[[ 10., 11., 12.],
[ 13., 14., 15.],
[ 16., 17., 18.]],
[[ 19., 20., 21.],
[ 22., 23., 24.],
[ 25., 26., 27.]]]
// returns last sequence when sequence_length parameter is not used
SequenceLast(x) = [[ 19., 20., 21.],
[ 22., 23., 24.],
[ 25., 26., 27.]]
// sequence_length is used
SequenceLast(x, sequence_length=[1,1,1], use_sequence_length=True) =
[[ 1., 2., 3.],
[ 4., 5., 6.],
[ 7., 8., 9.]]
// sequence_length is used
SequenceLast(x, sequence_length=[1,2,3], use_sequence_length=True) =
[[ 1., 2., 3.],
[ 13., 14., 15.],
[ 25., 26., 27.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\sequence_last.cc:L100
Declaration
public static Symbol SequenceLast(Symbol data, Symbol sequence_length, bool use_sequence_length = false, int axis = 0, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | n-dimensional input array of the form [max_sequence_length, batch_size, other_feature_dims] where n>2 |
| Symbol | sequence_length | vector of sequence lengths of the form [batch_size] |
| System.Boolean | use_sequence_length | If set to true, this layer takes in an extra input parameter |
| System.Int32 | axis | The sequence axis. Only values of 0 and 1 are currently supported. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SequenceMask(Symbol, Symbol, Boolean, Single, Int32, String)
Sets all elements outside the sequence to a constant value.
This function takes an n-dimensional input array of the form
[max_sequence_length, batch_size, other_feature_dims] and returns an array of the same shape.
Parameter `sequence_length` is used to handle variable-length sequences. `sequence_length`
should be an input array of positive ints of dimension [batch_size].
To use this parameter, set `use_sequence_length` to `True`,
otherwise each example in the batch is assumed to have the max sequence length and
this operator works as the `identity` operator.
Example::
x = [[[ 1., 2., 3.],
[ 4., 5., 6.]],
[[ 7., 8., 9.],
[ 10., 11., 12.]],
[[ 13., 14., 15.],
[ 16., 17., 18.]]]
// Batch 1
B1 = [[ 1., 2., 3.],
[ 7., 8., 9.],
[ 13., 14., 15.]]
// Batch 2
B2 = [[ 4., 5., 6.],
[ 10., 11., 12.],
[ 16., 17., 18.]]
// works as identity operator when sequence_length parameter is not used
SequenceMask(x) = [[[ 1., 2., 3.],
[ 4., 5., 6.]],
[[ 7., 8., 9.],
[ 10., 11., 12.]],
[[ 13., 14., 15.],
[ 16., 17., 18.]]]
// sequence_length [1,1] means 1 of each batch will be kept
// and other rows are masked with default mask value = 0
SequenceMask(x, sequence_length=[1,1], use_sequence_length=True) =
[[[ 1., 2., 3.],
[ 4., 5., 6.]],
[[ 0., 0., 0.],
[ 0., 0., 0.]],
[[ 0., 0., 0.],
[ 0., 0., 0.]]]
// sequence_length [2,3] means 2 of batch B1 and 3 of batch B2 will be kept
// and other rows are masked with value = 1
SequenceMask(x, sequence_length=[2,3], use_sequence_length=True, value=1) =
[[[ 1., 2., 3.],
[ 4., 5., 6.]],
[[ 7., 8., 9.],
[ 10., 11., 12.]],
[[ 1., 1., 1.],
[ 16., 17., 18.]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\sequence_mask.cc:L186
Declaration
public static Symbol SequenceMask(Symbol data, Symbol sequence_length, bool use_sequence_length = false, float value = 0F, int axis = 0, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | n-dimensional input array of the form [max_sequence_length, batch_size, other_feature_dims] where n>2 |
| Symbol | sequence_length | vector of sequence lengths of the form [batch_size] |
| System.Boolean | use_sequence_length | If set to true, this layer takes in an extra input parameter |
| System.Single | value | The value to be used as a mask. |
| System.Int32 | axis | The sequence axis. Only values of 0 and 1 are currently supported. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SequenceReverse(Symbol, Symbol, Boolean, Int32, String)
Reverses the elements of each sequence.
This function takes an n-dimensional input array of the form [max_sequence_length, batch_size, other_feature_dims]
and returns an array of the same shape.
Parameter `sequence_length` is used to handle variable-length sequences.
`sequence_length` should be an input array of positive ints of dimension [batch_size].
To use this parameter, set `use_sequence_length` to `True`,
otherwise each example in the batch is assumed to have the max sequence length.
Example::
x = [[[ 1., 2., 3.],
[ 4., 5., 6.]],
[[ 7., 8., 9.],
[ 10., 11., 12.]],
[[ 13., 14., 15.],
[ 16., 17., 18.]]]
// Batch 1
B1 = [[ 1., 2., 3.],
[ 7., 8., 9.],
[ 13., 14., 15.]]
// Batch 2
B2 = [[ 4., 5., 6.],
[ 10., 11., 12.],
[ 16., 17., 18.]]
// returns reverse sequence when sequence_length parameter is not used
SequenceReverse(x) = [[[ 13., 14., 15.],
[ 16., 17., 18.]],
[[ 7., 8., 9.],
[ 10., 11., 12.]],
[[ 1., 2., 3.],
[ 4., 5., 6.]]]
// sequence_length [2,2] means 2 rows of
// both batch B1 and B2 will be reversed.
SequenceReverse(x, sequence_length=[2,2], use_sequence_length=True) =
[[[ 7., 8., 9.],
[ 10., 11., 12.]],
[[ 1., 2., 3.],
[ 4., 5., 6.]],
[[ 13., 14., 15.],
[ 16., 17., 18.]]]
// sequence_length [2,3] means 2 of batch B2 and 3 of batch B3
// will be reversed.
SequenceReverse(x, sequence_length=[2,3], use_sequence_length=True) =
[[[ 7., 8., 9.],
[ 16., 17., 18.]],
[[ 1., 2., 3.],
[ 10., 11., 12.]],
[[ 13., 14, 15.],
[ 4., 5., 6.]]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\sequence_reverse.cc:L122
Declaration
public static Symbol SequenceReverse(Symbol data, Symbol sequence_length, bool use_sequence_length = false, int axis = 0, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | n-dimensional input array of the form [max_sequence_length, batch_size, other dims] where n>2 |
| Symbol | sequence_length | vector of sequence lengths of the form [batch_size] |
| System.Boolean | use_sequence_length | If set to true, this layer takes in an extra input parameter |
| System.Int32 | axis | The sequence axis. Only 0 is currently supported. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SgdMomUpdate(Symbol, Symbol, Symbol, Single, Single, Single, Single, Single, Boolean, String)
Declaration
public static Symbol SgdMomUpdate(Symbol weight, Symbol grad, Symbol mom, float lr, float momentum = 0F, 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 | mom | |
| System.Single | lr | |
| System.Single | momentum | |
| System.Single | wd | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.Boolean | lazy_update | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
SgdUpdate(Symbol, Symbol, Single, Single, Single, Single, Boolean, String)
Declaration
public static Symbol SgdUpdate(Symbol weight, Symbol grad, float lr, 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 | |
| System.Single | lr | |
| System.Single | wd | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.Boolean | lazy_update | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
ShapeArray(Symbol, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, String)
Returns a 1D int64 array containing the shape of data.
Example::
shape_array([[1,2,3,4], [5,6,7,8]]) = [2,4]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L529
Declaration
public static Symbol ShapeArray(Symbol data, int? lhs_begin = default(int? ), int? lhs_end = default(int? ), int? rhs_begin = default(int? ), int? rhs_end = default(int? ), string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input Array. |
| System.Nullable<System.Int32> | lhs_begin | Defaults to 0. The beginning index along which the lhs dimensions are to be reshaped. Supports negative indices. |
| System.Nullable<System.Int32> | lhs_end | Defaults to None. The ending index along which the lhs dimensions are to be used for reshaping. Supports negative indices. |
| System.Nullable<System.Int32> | rhs_begin | Defaults to 0. The beginning index along which the rhs dimensions are to be used for reshaping. Supports negative indices. |
| System.Nullable<System.Int32> | rhs_end | Defaults to None. The ending index along which the rhs dimensions are to be used for reshaping. Supports negative indices. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Shuffle(Symbol, String)
Randomly shuffle the elements.
This shuffles the array along the first axis.
The order of the elements in each subarray does not change.
For example, if a 2D array is given, the order of the rows randomly changes,
but the order of the elements in each row does not change.
Declaration
public static Symbol Shuffle(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Data to be shuffled. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Sigmoid(Symbol, String)
Computes sigmoid of x element-wise.
.. math::
y = 1 / (1 + exp(-x))
The storage type of ``sigmoid`` output is always dense
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L101
Declaration
public static Symbol Sigmoid(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 |
Sign(Symbol, String)
Returns element-wise sign of the input.
Example::
sign([-2, 0, 3]) = [-1, 0, 1]
The storage type of ``sign`` output depends upon the input storage type:
- sign(default) = default
- sign(row_sparse) = row_sparse
- sign(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L704
Declaration
public static Symbol Sign(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 |
SignsgdUpdate(Symbol, Symbol, Single, Single, Single, Single, String)
Declaration
public static Symbol SignsgdUpdate(Symbol weight, Symbol grad, float lr, float wd = 0F, float rescale_grad = 1F, float clip_gradient = -1F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | weight | |
| Symbol | grad | |
| System.Single | lr | |
| System.Single | wd | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
SignumUpdate(Symbol, Symbol, Symbol, Single, Single, Single, Single, Single, Single, String)
Declaration
public static Symbol SignumUpdate(Symbol weight, Symbol grad, Symbol mom, float lr, float momentum = 0F, float wd = 0F, float rescale_grad = 1F, float clip_gradient = -1F, float wd_lh = 0F, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | weight | |
| Symbol | grad | |
| Symbol | mom | |
| System.Single | lr | |
| System.Single | momentum | |
| System.Single | wd | |
| System.Single | rescale_grad | |
| System.Single | clip_gradient | |
| System.Single | wd_lh | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
Sin(Symbol, String)
Computes the element-wise sine of the input array.
The input should be in radians (:math:`2\pi` rad equals 360 degrees).
.. math::
sin([0, \pi/4, \pi/2]) = [0, 0.707, 1]
The storage type of ``sin`` output depends upon the input storage type:
- sin(default) = default
- sin(row_sparse) = row_sparse
- sin(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_trig.cc:L46
Declaration
public static Symbol Sin(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 |
Sinh(Symbol, String)
Returns the hyperbolic sine of the input array, computed element-wise.
.. math::
sinh(x) = 0.5\times(exp(x) - exp(-x))
The storage type of ``sinh`` output depends upon the input storage type:
- sinh(default) = default
- sinh(row_sparse) = row_sparse
- sinh(csr) = csr
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_trig.cc:L201
Declaration
public static Symbol Sinh(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 |
SizeArray(Symbol, String)
Returns a 1D int64 array containing the size of data.
Example::
size_array([[1,2,3,4], [5,6,7,8]]) = [8]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\elemwise_unary_op_basic.cc:L581
Declaration
public static Symbol SizeArray(Symbol data, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input Array. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
Slice(Symbol, Shape, Shape, Shape, String)
Declaration
public static Symbol Slice(Symbol data, Shape begin, Shape end, Shape step = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | |
| Shape | begin | |
| Shape | end | |
| Shape | step | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
SliceAssign(Symbol, Symbol, Shape, Shape, Shape, String)
Assign the rhs to a cropped subset of lhs.
Requirements
------------
- output should be explicitly given and be the same as lhs.
- lhs and rhs are of the same data type, and on the same device.
From:C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\matrix_op.cc:559
Declaration
public static Symbol SliceAssign(Symbol lhs, Symbol rhs, Shape begin, Shape end, Shape step = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | lhs | Source input |
| Symbol | rhs | value to assign |
| Shape | begin | starting indices for the slice operation, supports negative indices. |
| Shape | end | ending indices for the slice operation, supports negative indices. |
| Shape | step | step for the slice operation, supports negative values. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SliceAssignScalar(Symbol, Shape, Shape, Double, Shape, String)
(Assign the scalar to a cropped subset of the input.
Requirements
------------
- output should be explicitly given and be the same as input
)
From:C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\matrix_op.cc:584
Declaration
public static Symbol SliceAssignScalar(Symbol data, Shape begin, Shape end, double scalar = 0, Shape step = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Source input |
| Shape | begin | starting indices for the slice operation, supports negative indices. |
| Shape | end | ending indices for the slice operation, supports negative indices. |
| System.Double | scalar | The scalar value for assignment. |
| Shape | step | step for the slice operation, supports negative values. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SliceAxis(Symbol, Int32, Int32, Nullable<Int32>, String)
Slices along a given axis.
Returns an array slice along a given `axis` starting from the `begin` index
to the `end` index.
Examples::
x = [[ 1., 2., 3., 4.],
[ 5., 6., 7., 8.],
[ 9., 10., 11., 12.]]
slice_axis(x, axis=0, begin=1, end=3) = [[ 5., 6., 7., 8.],
[ 9., 10., 11., 12.]]
slice_axis(x, axis=1, begin=0, end=2) = [[ 1., 2.],
[ 5., 6.],
[ 9., 10.]]
slice_axis(x, axis=1, begin=-3, end=-1) = [[ 2., 3.],
[ 6., 7.],
[ 10., 11.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\matrix_op.cc:L620
Declaration
public static Symbol SliceAxis(Symbol data, int axis, int begin, int? end, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Source input |
| System.Int32 | axis | Axis along which to be sliced, supports negative indexes. |
| System.Int32 | begin | The beginning index along the axis to be sliced, supports negative indexes. |
| System.Nullable<System.Int32> | end | The ending index along the axis to be sliced, supports negative indexes. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SliceLike(Symbol, Symbol, Shape, String)
Slices a region of the array like the shape of another array.
This function is similar to ``slice``, however, the `begin` are always `0`s
and `end` of specific axes are inferred from the second input `shape_like`.
Given the second `shape_like` input of ``shape=(d_0, d_1, ..., d_n-1)``,
a ``slice_like`` operator with default empty `axes`, it performs the
following operation:
`` out = slice(input, begin=(0, 0, ..., 0), end=(d_0, d_1, ..., d_n-1))``.
When `axes` is not empty, it is used to speficy which axes are being sliced.
Given a 4-d input data, ``slice_like`` operator with ``axes=(0, 2, -1)``
will perform the following operation:
`` out = slice(input, begin=(0, 0, 0, 0), end=(d_0, None, d_2, d_3))``.
Note that it is allowed to have first and second input with different dimensions,
however, you have to make sure the `axes` are specified and not exceeding the
dimension limits.
For example, given `input_1` with ``shape=(2,3,4,5)`` and `input_2` with
``shape=(1,2,3)``, it is not allowed to use:
`` out = slice_like(a, b)`` because ndim of `input_1` is 4, and ndim of `input_2`
is 3.
The following is allowed in this situation:
`` out = slice_like(a, b, axes=(0, 2))``
Example::
x = [[ 1., 2., 3., 4.],
[ 5., 6., 7., 8.],
[ 9., 10., 11., 12.]]
y = [[ 0., 0., 0.],
[ 0., 0., 0.]]
slice_like(x, y) = [[ 1., 2., 3.]
[ 5., 6., 7.]]
slice_like(x, y, axes=(0, 1)) = [[ 1., 2., 3.]
[ 5., 6., 7.]]
slice_like(x, y, axes=(0)) = [[ 1., 2., 3., 4.]
[ 5., 6., 7., 8.]]
slice_like(x, y, axes=(-1)) = [[ 1., 2., 3.]
[ 5., 6., 7.]
[ 9., 10., 11.]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\tensor\matrix_op.cc:L689
Declaration
public static Symbol SliceLike(Symbol data, Symbol shape_like, Shape axes = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Source input |
| Symbol | shape_like | Shape like input |
| Shape | axes | List of axes on which input data will be sliced according to the corresponding size of the second input. By default will slice on all axes. Negative axes are supported. |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SmoothL1(Symbol, Single, String)
Declaration
public static Symbol SmoothL1(Symbol data, float scalar, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | |
| System.Single | scalar | |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol |
Softmax(Symbol, Int32, Nullable<Double>, DType, String)
Applies the softmax function.
The resulting array contains elements in the range (0,1) and the elements along the given axis sum up to 1.
.. math::
softmax(\mathbf{z/t})_j = \frac{e^{z_j/t}}{\sum_{k=1}^K e^{z_k/t}}
for :math:`j = 1, ..., K`
t is the temperature parameter in softmax function. By default, t equals 1.0
Example::
x = [[ 1. 1. 1.]
[ 1. 1. 1.]]
softmax(x,axis=0) = [[ 0.5 0.5 0.5]
[ 0.5 0.5 0.5]]
softmax(x,axis=1) = [[ 0.33333334, 0.33333334, 0.33333334],
[ 0.33333334, 0.33333334, 0.33333334]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\nn\softmax.cc:L93
Declaration
public static Symbol Softmax(Symbol data, int axis = -1, double? temperature = default(double? ), DType dtype = null, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| System.Int32 | axis | The axis along which to compute softmax. |
| System.Nullable<System.Double> | temperature | Temperature parameter in softmax |
| DType | dtype | DType of the output in case this can't be inferred. Defaults to the same as input's dtype if not defined (dtype=None). |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SoftmaxActivation(Symbol, SoftmaxMode, String)
Applies softmax activation to input. This is intended for internal layers.
.. note::
This operator has been deprecated, please use `softmax`.
If `mode` = ``instance``, this operator will compute a softmax for each instance in the batch.
This is the default mode.
If `mode` = ``channel``, this operator will compute a k-class softmax at each position
of each instance, where `k` = ``num_channel``. This mode can only be used when the input array
has at least 3 dimensions.
This can be used for `fully convolutional network`, `image segmentation`, etc.
Example::
>>> input_array = mx.nd.array([[3., 0.5, -0.5, 2., 7.],
>>> [2., -.4, 7., 3., 0.2]])
>>> softmax_act = mx.nd.SoftmaxActivation(input_array)
>>> print softmax_act.asnumpy()
[[ 1.78322066e-02 1.46375655e-03 5.38485940e-04 6.56010211e-03 9.73605454e-01]
[ 6.56221947e-03 5.95310994e-04 9.73919690e-01 1.78379621e-02 1.08472735e-03]]
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\nn\softmax_activation.cc:L59
Declaration
public static Symbol SoftmaxActivation(Symbol data, SoftmaxMode mode = SoftmaxMode.Instance, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | The input array. |
| SoftmaxMode | mode | Specifies how to compute the softmax. If set to |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SoftmaxCrossEntropy(Symbol, Symbol, String)
Calculate cross entropy of softmax output and one-hot label.
- This operator computes the cross entropy in two steps:
- Applies softmax function on the input array.
- Computes and returns the cross entropy loss between the softmax output and the labels.
- The softmax function and cross entropy loss is given by:
- Softmax Function:
.. math:: \text{softmax}(x)_i = \frac{exp(x_i)}{\sum_j exp(x_j)}
- Cross Entropy Function:
.. math:: \text{CE(label, output)} = - \sum_i \text{label}_i \log(\text{output}_i)
Example::
x = [[1, 2, 3],
[11, 7, 5]]
label = [2, 0]
softmax(x) = [[0.09003057, 0.24472848, 0.66524094],
[0.97962922, 0.01794253, 0.00242826]]
softmax_cross_entropy(data, label) = - log(0.66524084) - log(0.97962922) = 0.4281871
Defined in C:\Jenkins\workspace\mxnet\mxnet\src\operator\loss_binary_op.cc:L59
Declaration
public static Symbol SoftmaxCrossEntropy(Symbol data, Symbol label, string symbol_name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Symbol | data | Input data |
| Symbol | label | Input label |
| System.String | symbol_name |
Returns
| Type | Description |
|---|---|
| Symbol | returns new symbol |
SoftmaxOutput(Symbol, Symbol, Single, Single, Boolean, Boolean, Boolean, SoftmaxoutputNormalization, Boolean, Single, String)
Computes the gradient of cross entropy loss with respect to softmax output.
- This operator computes the gradient in two steps.
The cross entropy loss does not actually need to be computed.
- Applies softmax function on the input array.
- Computes and returns the gradient of cross entropy loss w.r.t. the softmax output.
- The softmax function, cross entropy loss and gradient is given by:
- Softmax Function:
.. math:: \text{softmax}(x)_i = \frac{exp(x_i)}{\sum_j exp(x_j)}
- Cross Entropy Function:
.. math:: \text{CE(label, output)} = - \sum_i \text{label}_i \log(\text{output}_i)
- The gradient of cross entropy loss w.r.t softmax output:
.. math:: \text{gradient} = \text{output} - \text{label}
- During forward propagation, the softmax function is computed for each instance in the input array.
For general *N*-D input arrays with shape :math:`(d_1, d_2, ..., d_n)`. The size is
:math:`s=d_1 \cdot d_2 \cdot \cdot \cdot d_n`. We can use the parameters `preserve_shape`
and `multi_output` to specify the way to compute softmax:
- By default, `preserve_shape` is ``false``. This operator will reshape the input array
into a 2-D array with shape :math:`(d_1, \frac{s}{d_1})` and then compute the softmax function for
each row in the reshaped array, and afterwards reshape it back to the original shape
:math:`(d_1, d_2, ..., d_n)`.
- If `preserve_shape` is ``true``, the softmax function will be computed along
the last axis (`axis` = ``-1``).
- If `multi_output` is ``true``, the softmax function will be computed along
the second axis (`axis` = ``1``).
- During backward propagation, the gradient of cross-entropy loss w.r.t softmax output array is computed.
The provided label can be a one-hot label array or a probability label array.
- If the parameter `use_ignore` is ``true``, `ignore_label` can specify input instances
with a particular label to be ignored during backward propagation. **This has no effect when
softmax `output` has same shape as `label`**.
Example::