Symbolic API
#
Base.reshape
— Method.
reshape(sym::SymbolicNode, dim; reverse=false, name)
reshape(sym::SymbolicNode, dim...; reverse=false, name)
Reshape SymbolicNode operator
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:
- with
reverse=false
, for input shape = (10,5,4), shape = (-1,0), output shape would be (40,5) - with
reverse=true
, output shape will be (50,4).
#
Base.Broadcast.broadcast_axes
— Method.
broadcast_axes(data, axis, size)
broadcastaxes is an alias of broadcastaxis.
Broadcasts the input array over particular axes.
Broadcasting is allowed on axes with size 1, such as from (2,1,3,1)
to (2,8,3,9)
. Elements will be duplicated on the broadcasted axes.
broadcast_axes
is an alias to the function broadcast_axis
.
Example::
// given x of shape (1,2,1) x = [[[ 1.], [ 2.]]]
// broadcast x on on axis 2 broadcastaxis(x, axis=2, size=3) = [[[ 1., 1., 1.], [ 2., 2., 2.]]] // broadcast x on on axes 0 and 2 broadcastaxis(x, axis=(0,2), size=(2,3)) = [[[ 1., 1., 1.], [ 2., 2., 2.]], [[ 1., 1., 1.], [ 2., 2., 2.]]]
Defined in src/operator/tensor/broadcastreduceop_value.cc:L92
Arguments
data::NDArray-or-SymbolicNode
: The inputaxis::Shape(tuple), optional, default=[]
: The axes to perform the broadcasting.size::Shape(tuple), optional, default=[]
: Target sizes of the broadcasting axes.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.cos
— Method.
cos(data)
Computes the element-wise cosine of the input array.
The input should be in radians (:math:2\pi
rad equals 360 degrees).
.. math:: cos([0, \pi/4, \pi/2]) = [1, 0.707, 0]
The storage type of $cos$ output is always dense
Defined in src/operator/tensor/elemwiseunaryop_trig.cc:L90
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.cosh
— Method.
cosh(data)
Returns the hyperbolic cosine of the input array, computed element-wise.
.. math:: cosh(x) = 0.5\times(exp(x) + exp(-x))
The storage type of $cosh$ output is always dense
Defined in src/operator/tensor/elemwiseunaryop_trig.cc:L409
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.prod
— Method.
prod(data, axis, keepdims, exclude)
Computes the product of array elements over given axes.
Defined in src/operator/tensor/./broadcastreduceop.h:L30
Arguments
data::NDArray-or-SymbolicNode
: The input-
axis::Shape or None, optional, default=None
: The axis or axes along which to perform the reduction.`` The default,
axis=(), will compute over all elements into a scalar array with shape
(1,)`.If
axis
is int, a reduction is performed on a particular axis.If
axis
is a tuple of ints, a reduction is performed on all the axes specified in the tuple.If
exclude
is true, reduction will be performed on the axes that are NOT in axis instead.Negative values means indexing from right to left.
`` *
keepdims::boolean, optional, default=0: If this is set to
True, the reduced axes are left in the result as dimension with size one. *
exclude::boolean, optional, default=0: Whether to perform reduction on axis that are NOT in axis instead. *
name::Symbol: The name of the
SymbolicNode. (e.g.
:my_symbol), optional. *
attrs::Dict{Symbol,String}: The attributes associated with this
SymbolicNode`.
#
Base.sin
— Method.
sin(data)
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(rowsparse) = rowsparse
- sin(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_trig.cc:L47
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.sinh
— Method.
sinh(data)
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(rowsparse) = rowsparse
- sinh(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_trig.cc:L371
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.sum
— Method.
sum(data, axis, keepdims, exclude)
Computes the sum of array elements over given axes.
.. Note::
sum
and sum_axis
are equivalent. For ndarray of csr storage type summation along axis 0 and axis 1 is supported. Setting keepdims or exclude to True will cause a fallback to dense operator.
Example::
data = [[[1, 2], [2, 3], [1, 3]], [[1, 4], [4, 3], [5, 2]], [[7, 1], [7, 2], [7, 3]]]
sum(data, axis=1) [[ 4. 8.] [ 10. 9.] [ 21. 6.]]
sum(data, axis=[1,2]) [ 12. 19. 27.]
data = [[1, 2, 0], [3, 0, 1], [4, 1, 0]]
csr = cast_storage(data, 'csr')
sum(csr, axis=0) [ 8. 3. 1.]
sum(csr, axis=1) [ 3. 4. 5.]
Defined in src/operator/tensor/broadcastreducesum_value.cc:L66
Arguments
data::NDArray-or-SymbolicNode
: The input-
axis::Shape or None, optional, default=None
: The axis or axes along which to perform the reduction.`` The default,
axis=(), will compute over all elements into a scalar array with shape
(1,)`.If
axis
is int, a reduction is performed on a particular axis.If
axis
is a tuple of ints, a reduction is performed on all the axes specified in the tuple.If
exclude
is true, reduction will be performed on the axes that are NOT in axis instead.Negative values means indexing from right to left.
`` *
keepdims::boolean, optional, default=0: If this is set to
True, the reduced axes are left in the result as dimension with size one. *
exclude::boolean, optional, default=0: Whether to perform reduction on axis that are NOT in axis instead. *
name::Symbol: The name of the
SymbolicNode. (e.g.
:my_symbol), optional. *
attrs::Dict{Symbol,String}: The attributes associated with this
SymbolicNode`.
#
Base.tan
— Method.
tan(data)
Computes the element-wise tangent of the input array.
The input should be in radians (:math:2\pi
rad equals 360 degrees).
.. math:: tan([0, \pi/4, \pi/2]) = [0, 1, -inf]
The storage type of $tan$ output depends upon the input storage type:
- tan(default) = default
- tan(rowsparse) = rowsparse
- tan(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_trig.cc:L140
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.tanh
— Method.
tanh(data)
Returns the hyperbolic tangent of the input array, computed element-wise.
.. math:: tanh(x) = sinh(x) / cosh(x)
The storage type of $tanh$ output depends upon the input storage type:
- tanh(default) = default
- tanh(rowsparse) = rowsparse
- tanh(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_trig.cc:L451
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.arccos
— Method.
arccos(data)
Returns element-wise inverse cosine of the input array.
The input should be in range [-1, 1]
. The output is in the closed interval :math:[0, \pi]
.. math:: arccos([-1, -.707, 0, .707, 1]) = [\pi, 3\pi/4, \pi/2, \pi/4, 0]
The storage type of $arccos$ output is always dense
Defined in src/operator/tensor/elemwiseunaryop_trig.cc:L233
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.arccosh
— Method.
arccosh(data)
Returns the element-wise inverse hyperbolic cosine of the input array, computed element-wise.
The storage type of $arccosh$ output is always dense
Defined in src/operator/tensor/elemwiseunaryop_trig.cc:L535
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.arcsin
— Method.
arcsin(data)
Returns element-wise inverse sine of the input array.
The input should be in the range [-1, 1]
. The output is in the closed interval of [:math:-\pi/2
, :math:\pi/2
].
.. math:: arcsin([-1, -.707, 0, .707, 1]) = [-\pi/2, -\pi/4, 0, \pi/4, \pi/2]
The storage type of $arcsin$ output depends upon the input storage type:
- arcsin(default) = default
- arcsin(rowsparse) = rowsparse
- arcsin(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_trig.cc:L187
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.arcsinh
— Method.
arcsinh(data)
Returns the element-wise inverse hyperbolic sine of the input array, computed element-wise.
The storage type of $arcsinh$ output depends upon the input storage type:
- arcsinh(default) = default
- arcsinh(rowsparse) = rowsparse
- arcsinh(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_trig.cc:L494
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.arctan
— Method.
arctan(data)
Returns element-wise inverse tangent of the input array.
The output is in the closed interval :math:[-\pi/2, \pi/2]
.. math:: arctan([-1, 0, 1]) = [-\pi/4, 0, \pi/4]
The storage type of $arctan$ output depends upon the input storage type:
- arctan(default) = default
- arctan(rowsparse) = rowsparse
- arctan(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_trig.cc:L282
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.arctanh
— Method.
arctanh(data)
Returns the element-wise inverse hyperbolic tangent of the input array, computed element-wise.
The storage type of $arctanh$ output depends upon the input storage type:
- arctanh(default) = default
- arctanh(rowsparse) = rowsparse
- arctanh(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_trig.cc:L579
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.broadcast_axis
— Method.
broadcast_axis(data, axis, size)
Broadcasts the input array over particular axes.
Broadcasting is allowed on axes with size 1, such as from (2,1,3,1)
to (2,8,3,9)
. Elements will be duplicated on the broadcasted axes.
broadcast_axes
is an alias to the function broadcast_axis
.
Example::
// given x of shape (1,2,1) x = [[[ 1.], [ 2.]]]
// broadcast x on on axis 2 broadcastaxis(x, axis=2, size=3) = [[[ 1., 1., 1.], [ 2., 2., 2.]]] // broadcast x on on axes 0 and 2 broadcastaxis(x, axis=(0,2), size=(2,3)) = [[[ 1., 1., 1.], [ 2., 2., 2.]], [[ 1., 1., 1.], [ 2., 2., 2.]]]
Defined in src/operator/tensor/broadcastreduceop_value.cc:L92
Arguments
data::NDArray-or-SymbolicNode
: The inputaxis::Shape(tuple), optional, default=[]
: The axes to perform the broadcasting.size::Shape(tuple), optional, default=[]
: Target sizes of the broadcasting axes.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.broadcast_to
— Method.
broadcast_to(data, shape)
Broadcasts the input array to a new shape.
Broadcasting is a mechanism that allows NDArrays to perform arithmetic operations with arrays of different shapes efficiently without creating multiple copies of arrays. Also see, Broadcasting <https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html>
_ for more explanation.
Broadcasting is allowed on axes with size 1, such as from (2,1,3,1)
to (2,8,3,9)
. Elements will be duplicated on the broadcasted axes.
For example::
broadcast_to([[1,2,3]], shape=(2,3)) = [[ 1., 2., 3.], [ 1., 2., 3.]])
The dimension which you do not want to change can also be kept as 0
which means copy the original value. So with shape=(2,0)
, we will obtain the same result as in the above example.
Defined in src/operator/tensor/broadcastreduceop_value.cc:L116
Arguments
data::NDArray-or-SymbolicNode
: The inputshape::Shape(tuple), optional, default=[]
: The shape of the desired array. We can set the dim to zero if it's same as the original. E.gA = broadcast_to(B, shape=(10, 0, 0))
has the same meaning asA = broadcast_axis(B, axis=0, size=10)
.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.clip
— Method.
clip(data, a_min, a_max)
Clips (limits) the values in an array. Given an interval, values outside the interval are clipped to the interval edges. Clipping $x$ between a_min
and a_max
would be:: .. math:: clip(x, amin, amax) = \max(\min(x, amax), amin)) Example:: x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] clip(x,1,8) = [ 1., 1., 2., 3., 4., 5., 6., 7., 8., 8.] The storage type of $clip$ output depends on storage types of inputs and the amin, amax
parameter values:
- clip(default) = default
- clip(rowsparse, amin <= 0, amax >= 0) = rowsparse
- clip(csr, amin <= 0, amax >= 0) = csr
- clip(rowsparse, amin < 0, a_max < 0) = default
- clip(rowsparse, amin > 0, a_max > 0) = default
- clip(csr, amin < 0, amax < 0) = csr
- clip(csr, amin > 0, amax > 0) = csr
Defined in src/operator/tensor/matrix_op.cc:L676
Arguments
data::NDArray-or-SymbolicNode
: Input array.a_min::float, required
: Minimum valuea_max::float, required
: Maximum valuename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.expand_dims
— Method.
expand_dims(data, axis)
Inserts a new axis of size 1 into the array shape For example, given $x$ with shape $(2,3,4)$, then $expand_dims(x, axis=1)$ will return a new array with shape $(2,1,3,4)$.
Defined in src/operator/tensor/matrix_op.cc:L394
Arguments
data::NDArray-or-SymbolicNode
: Source inputaxis::int, required
: Position where new axis is to be inserted. Suppose that the inputNDArray
's dimension isndim
, the range of the inserted axis is[-ndim, ndim]
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.log_softmax
— Method.
log_softmax(data, axis, temperature, dtype, use_length)
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)
Arguments
data::NDArray-or-SymbolicNode
: The input array.axis::int, optional, default='-1'
: The axis along which to compute softmax.temperature::double or None, optional, default=None
: Temperature parameter in softmaxdtype::{None, 'float16', 'float32', 'float64'},optional, default='None'
: DType of the output in case this can't be inferred. Defaults to the same as input's dtype if not defined (dtype=None).use_length::boolean or None, optional, default=0
: Whether to use the length input as a mask over the data input.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.relu
— Method.
relu(data)
Computes rectified linear activation.
.. math:: max(features, 0)
The storage type of $relu$ output depends upon the input storage type:
- relu(default) = default
- relu(rowsparse) = rowsparse
- relu(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_basic.cc:L85
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.sigmoid
— Method.
sigmoid(data)
Computes sigmoid of x element-wise.
.. math:: y = 1 / (1 + exp(-x))
The storage type of $sigmoid$ output is always dense
Defined in src/operator/tensor/elemwiseunaryop_basic.cc:L119
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.softmax
— Method.
softmax(data, length, axis, temperature, dtype, use_length)
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^{zj/t}}{\sum{k=1}^K e^{zk/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 src/operator/nn/softmax.cc:L135
Arguments
data::NDArray-or-SymbolicNode
: The input array.length::NDArray-or-SymbolicNode
: The length array.axis::int, optional, default='-1'
: The axis along which to compute softmax.temperature::double or None, optional, default=None
: Temperature parameter in softmaxdtype::{None, 'float16', 'float32', 'float64'},optional, default='None'
: DType of the output in case this can't be inferred. Defaults to the same as input's dtype if not defined (dtype=None).use_length::boolean or None, optional, default=0
: Whether to use the length input as a mask over the data input.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Statistics.mean
— Method.
mean(data, axis, keepdims, exclude)
Computes the mean of array elements over given axes.
Defined in src/operator/tensor/./broadcastreduceop.h:L83
Arguments
data::NDArray-or-SymbolicNode
: The input-
axis::Shape or None, optional, default=None
: The axis or axes along which to perform the reduction.`` The default,
axis=(), will compute over all elements into a scalar array with shape
(1,)`.If
axis
is int, a reduction is performed on a particular axis.If
axis
is a tuple of ints, a reduction is performed on all the axes specified in the tuple.If
exclude
is true, reduction will be performed on the axes that are NOT in axis instead.Negative values means indexing from right to left.
`` *
keepdims::boolean, optional, default=0: If this is set to
True, the reduced axes are left in the result as dimension with size one. *
exclude::boolean, optional, default=0: Whether to perform reduction on axis that are NOT in axis instead. *
name::Symbol: The name of the
SymbolicNode. (e.g.
:my_symbol), optional. *
attrs::Dict{Symbol,String}: The attributes associated with this
SymbolicNode`.
#
MXNet.mx.SymbolicNode
— Type.
SymbolicNode
SymbolicNode is the basic building block of the symbolic graph in MXNet.jl. It's a callable object and supports following calls:
(s::SymbolicNode)(args::SymbolicNode...)
(s::SymbolicNode)(; kwargs...)
Make a new node by composing s
with args
. Or the arguments can be specified using keyword arguments.
#
MXNet.mx.Variable
— Method.
Variable(name::Union{Symbol,AbstractString}; attrs)
Create a symbolic variable with the given name. This is typically used as a placeholder. For example, the data node, acting as the starting point of a network architecture.
Arguments
attrs::Dict{Symbol,<:AbstractString}
: The attributes associated with thisVariable
.
#
MXNet.mx.@var
— Macro.
@var <symbols>...
A handy macro for creating mx.Variable
.
julia> x = @mx.var x
MXNet.mx.SymbolicNode x
julia> x, y, z = @mx.var x y z
(MXNet.mx.SymbolicNode x, MXNet.mx.SymbolicNode y, MXNet.mx.SymbolicNode z)
#
Base.:*
— Method.
.*(x, y)
Elementwise multiplication of SymbolicNode
.
#
Base.:+
— Method.
+(args...)
.+(args...)
Elementwise summation of SymbolicNode
.
#
Base.:-
— Method.
-(x, y)
.-(x, y)
Elementwise substraction of SymbolicNode
. Operating with Real
is available.
#
Base.:/
— Method.
./(x, y)
- Elementwise dividing a
SymbolicNode
by a scalar or anotherSymbolicNode
of the same shape.
- Elementwise divide a scalar by an
SymbolicNode
. - Matrix division (solving linear systems) is not implemented yet.
#
Base.:^
— Function.
.^(x, y)
Elementwise power of SymbolicNode
and NDArray
. Operating with Real
is available.
#
Base.getindex
— Method.
getindex(self :: SymbolicNode, idx :: Union{Int, Base.Symbol, AbstractString})
Get a node representing the specified output of this node. The index could be a symbol or string indicating the name of the output, or a 1-based integer indicating the index, as in the list of list_outputs
.
#
MXNet.mx.grad
— Method.
grad(s::SymbolicNode, wrt::Vector{Symbol})
Get the autodiff gradient of the current SymbolicNode
. This function can only be used if the current symbol is a loss function.
Arguments:
s::SymbolicNode
: current node.wrt::Vector{Symbol}
: the names of the arguments to the gradient.
Returns a gradient symbol of the corresponding gradient.
#
MXNet.mx.infer_shape
— Method.
infer_shape(self :: SymbolicNode, args...)
infer_shape(self :: SymbolicNode; kwargs...)
Do shape inference according to the input shapes. The input shapes could be provided as a list of shapes, which should specify the shapes of inputs in the same order as the arguments returned by list_arguments
. Alternatively, the shape information could be specified via keyword arguments.
Returns a 3-tuple containing shapes of all the arguments, shapes of all the outputs and shapes of all the auxiliary variables. If shape inference failed due to incomplete or incompatible inputs, the return value will be (nothing, nothing, nothing)
.
#
MXNet.mx.infer_type
— Method.
infer_type(self :: SymbolicNode; kwargs...)
infer_type(self :: SymbolicNode, args...)
Do type inference according to the input types. The input types could be provided as a list of types, which should specify the types of inputs in the same order as the arguments returned by list_arguments
. Alternatively, the type information could be specified via keyword arguments.
Returns a 3-tuple containing types of all the arguments, types of all the outputs and types of all the auxiliary variables. If type inference failed due to incomplete or incompatible inputs, the return value will be (nothing, nothing, nothing)
.
#
Base.Iterators.Flatten
— Method.
Flatten(data)
Flattens the input array into a 2-D array by collapsing the higher dimensions. .. note:: Flatten
is deprecated. Use flatten
instead. For an input array with shape $(d1, d2, ..., dk)$, flatten
operation reshapes the input array into an output array of shape $(d1, d2...dk)$. Note that the behavior of this function is different from numpy.ndarray.flatten, which behaves similar to mxnet.ndarray.reshape((-1,)). Example:: x = [[ [1,2,3], [4,5,6], [7,8,9] ], [ [1,2,3], [4,5,6], [7,8,9] ]], flatten(x) = [[ 1., 2., 3., 4., 5., 6., 7., 8., 9.], [ 1., 2., 3., 4., 5., 6., 7., 8., 9.]]
Defined in src/operator/tensor/matrix_op.cc:L249
Arguments
data::NDArray-or-SymbolicNode
: Input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.Math.cbrt
— Method.
cbrt(data)
Returns element-wise cube-root value of the input.
.. math:: cbrt(x) = \sqrt[3]{x}
Example::
cbrt([1, 8, -125]) = [1, 2, -5]
The storage type of $cbrt$ output depends upon the input storage type:
- cbrt(default) = default
- cbrt(rowsparse) = rowsparse
- cbrt(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_pow.cc:L270
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base._div
— Method.
_div(lhs, rhs)
div is an alias of elemwisediv.
Divides arguments element-wise.
The storage type of $elemwise_div$ output is always dense
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base._linspace
— Method.
_linspace(start, stop, step, repeat, infer_range, ctx, dtype)
Return evenly spaced numbers over a specified interval. Similar to Numpy
Arguments
start::double, required
: Start of interval. The interval includes this value. The default start value is 0.stop::double or None, optional, default=None
: End of interval. The interval does not include this value, except in some cases where step is not an integer and floating point round-off affects the length of out.step::double, optional, default=1
: Spacing between values.repeat::int, optional, default='1'
: The repeating time of all elements. E.g repeat=3, the element a will be repeated three times –> a, a, a.infer_range::boolean, optional, default=0
: When set to True, infer the stop position from the start, step, repeat, and output tensor size.ctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Target data type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base._maximum
— Method.
_maximum(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base._minimum
— Method.
_minimum(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base._sub
— Method.
_sub(lhs, rhs)
sub is an alias of elemwisesub.
Subtracts arguments element-wise.
The storage type of $elemwise_sub$ output depends on storage types of inputs
- elemwisesub(rowsparse, rowsparse) = rowsparse
- elemwise_sub(csr, csr) = csr
- elemwise_sub(default, csr) = default
- elemwise_sub(csr, default) = default
- elemwise_sub(default, rsp) = default
- elemwise_sub(rsp, default) = default
- otherwise, $elemwise_sub$ generates output with default storage
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.abs
— Method.
abs(data)
Returns element-wise absolute value of the input.
Example::
abs([-2, 0, 3]) = [2, 0, 3]
The storage type of $abs$ output depends upon the input storage type:
- abs(default) = default
- abs(rowsparse) = rowsparse
- abs(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_basic.cc:L720
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.argmax
— Method.
argmax(data, axis, keepdims)
Returns indices of the maximum values along an axis.
In the case of multiple occurrences of maximum values, the indices corresponding to the first occurrence are returned.
Examples::
x = [[ 0., 1., 2.], [ 3., 4., 5.]]
// argmax along axis 0 argmax(x, axis=0) = [ 1., 1., 1.]
// argmax along axis 1 argmax(x, axis=1) = [ 2., 2.]
// argmax along axis 1 keeping same dims as an input array argmax(x, axis=1, keepdims=True) = [[ 2.], [ 2.]]
Defined in src/operator/tensor/broadcastreduceop_index.cc:L51
Arguments
data::NDArray-or-SymbolicNode
: The inputaxis::int or None, optional, default='None'
: The axis along which to perform the reduction. Negative values means indexing from right to left. $Requires axis to be set as int, because global reduction is not supported yet.$keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axis is left in the result as dimension with size one.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.argmin
— Method.
argmin(data, axis, keepdims)
Returns indices of the minimum values along an axis.
In the case of multiple occurrences of minimum values, the indices corresponding to the first occurrence are returned.
Examples::
x = [[ 0., 1., 2.], [ 3., 4., 5.]]
// argmin along axis 0 argmin(x, axis=0) = [ 0., 0., 0.]
// argmin along axis 1 argmin(x, axis=1) = [ 0., 0.]
// argmin along axis 1 keeping same dims as an input array argmin(x, axis=1, keepdims=True) = [[ 0.], [ 0.]]
Defined in src/operator/tensor/broadcastreduceop_index.cc:L76
Arguments
data::NDArray-or-SymbolicNode
: The inputaxis::int or None, optional, default='None'
: The axis along which to perform the reduction. Negative values means indexing from right to left. $Requires axis to be set as int, because global reduction is not supported yet.$keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axis is left in the result as dimension with size one.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.ceil
— Method.
ceil(data)
Returns element-wise ceiling of the input.
The ceil of the scalar x is the smallest integer i, such that i >= x.
Example::
ceil([-2.1, -1.9, 1.5, 1.9, 2.1]) = [-2., -1., 2., 2., 3.]
The storage type of $ceil$ output depends upon the input storage type:
- ceil(default) = default
- ceil(rowsparse) = rowsparse
- ceil(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_basic.cc:L817
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.cumsum
— Method.
cumsum(a, axis, dtype)
cumsum is an alias of npcumsum.
Return the cumulative sum of the elements along a given axis.
Defined in src/operator/numpy/np_cumsum.cc:L70
Arguments
a::NDArray-or-SymbolicNode
: Input ndarrayaxis::int or None, optional, default='None'
: Axis along which the cumulative sum is computed. The default (None) is to compute the cumsum over the flattened array.dtype::{None, 'float16', 'float32', 'float64', 'int32', 'int64', 'int8'},optional, default='None'
: Type of the returned array and of the accumulator in which the elements are summed. If dtype is not specified, it defaults to the dtype of a, unless a has an integer dtype with a precision less than that of the default platform integer. In that case, the default platform integer is used.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.exp
— Method.
exp(data)
Returns element-wise exponential value of the input.
.. math:: exp(x) = e^x \approx 2.718^x
Example::
exp([0, 1, 2]) = [1., 2.71828175, 7.38905621]
The storage type of $exp$ output is always dense
Defined in src/operator/tensor/elemwiseunaryop_logexp.cc:L64
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.expm1
— Method.
expm1(data)
Returns $exp(x) - 1$ computed element-wise on the input.
This function provides greater precision than $exp(x) - 1$ for small values of $x$.
The storage type of $expm1$ output depends upon the input storage type:
- expm1(default) = default
- expm1(rowsparse) = rowsparse
- expm1(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_logexp.cc:L244
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.floor
— Method.
floor(data)
Returns element-wise floor of the input.
The floor of the scalar x is the largest integer i, such that i <= x.
Example::
floor([-2.1, -1.9, 1.5, 1.9, 2.1]) = [-3., -2., 1., 1., 2.]
The storage type of $floor$ output depends upon the input storage type:
- floor(default) = default
- floor(rowsparse) = rowsparse
- floor(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_basic.cc:L836
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.identity
— Method.
identity(data)
identity is an alias of _copy.
Returns a copy of the input.
From:src/operator/tensor/elemwiseunaryop_basic.cc:244
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.log
— Method.
log(data)
Returns element-wise Natural logarithmic value of the input.
The natural logarithm is logarithm in base e, so that $log(exp(x)) = x$
The storage type of $log$ output is always dense
Defined in src/operator/tensor/elemwiseunaryop_logexp.cc:L77
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.log10
— Method.
log10(data)
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 src/operator/tensor/elemwiseunaryop_logexp.cc:L94
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.log1p
— Method.
log1p(data)
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(rowsparse) = rowsparse
- log1p(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_logexp.cc:L199
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.log2
— Method.
log2(data)
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 src/operator/tensor/elemwiseunaryop_logexp.cc:L106
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.max
— Method.
max(data, axis, keepdims, exclude)
Computes the max of array elements over given axes.
Defined in src/operator/tensor/./broadcastreduceop.h:L31
Arguments
data::NDArray-or-SymbolicNode
: The input-
axis::Shape or None, optional, default=None
: The axis or axes along which to perform the reduction.`` The default,
axis=(), will compute over all elements into a scalar array with shape
(1,)`.If
axis
is int, a reduction is performed on a particular axis.If
axis
is a tuple of ints, a reduction is performed on all the axes specified in the tuple.If
exclude
is true, reduction will be performed on the axes that are NOT in axis instead.Negative values means indexing from right to left.
`` *
keepdims::boolean, optional, default=0: If this is set to
True, the reduced axes are left in the result as dimension with size one. *
exclude::boolean, optional, default=0: Whether to perform reduction on axis that are NOT in axis instead. *
name::Symbol: The name of the
SymbolicNode. (e.g.
:my_symbol), optional. *
attrs::Dict{Symbol,String}: The attributes associated with this
SymbolicNode`.
#
Base.min
— Method.
min(data, axis, keepdims, exclude)
Computes the min of array elements over given axes.
Defined in src/operator/tensor/./broadcastreduceop.h:L46
Arguments
data::NDArray-or-SymbolicNode
: The input-
axis::Shape or None, optional, default=None
: The axis or axes along which to perform the reduction.`` The default,
axis=(), will compute over all elements into a scalar array with shape
(1,)`.If
axis
is int, a reduction is performed on a particular axis.If
axis
is a tuple of ints, a reduction is performed on all the axes specified in the tuple.If
exclude
is true, reduction will be performed on the axes that are NOT in axis instead.Negative values means indexing from right to left.
`` *
keepdims::boolean, optional, default=0: If this is set to
True, the reduced axes are left in the result as dimension with size one. *
exclude::boolean, optional, default=0: Whether to perform reduction on axis that are NOT in axis instead. *
name::Symbol: The name of the
SymbolicNode. (e.g.
:my_symbol), optional. *
attrs::Dict{Symbol,String}: The attributes associated with this
SymbolicNode`.
#
Base.repeat
— Method.
repeat(data, repeats, axis)
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 src/operator/tensor/matrix_op.cc:L743
Arguments
data::NDArray-or-SymbolicNode
: Input data arrayrepeats::int, required
: The number of repetitions for each element.axis::int or None, optional, default='None'
: 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.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.reverse
— Method.
reverse(data, axis)
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 src/operator/tensor/matrix_op.cc:L831
Arguments
data::NDArray-or-SymbolicNode
: Input data arrayaxis::Shape(tuple), required
: The axis which to reverse elements.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.round
— Method.
round(data)
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(rowsparse) = rowsparse
- round(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_basic.cc:L777
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.sign
— Method.
sign(data)
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(rowsparse) = rowsparse
- sign(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_basic.cc:L758
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.sort
— Method.
sort(data, axis, is_ascend)
Returns a sorted copy of an input array along the given axis.
Examples::
x = [[ 1, 4], [ 3, 1]]
// sorts along the last axis sort(x) = [[ 1., 4.], [ 1., 3.]]
// flattens and then sorts sort(x, axis=None) = [ 1., 1., 3., 4.]
// sorts along the first axis sort(x, axis=0) = [[ 1., 1.], [ 3., 4.]]
// in a descend order sort(x, is_ascend=0) = [[ 4., 1.], [ 3., 1.]]
Defined in src/operator/tensor/ordering_op.cc:L132
Arguments
data::NDArray-or-SymbolicNode
: The input arrayaxis::int or None, optional, default='-1'
: Axis along which to choose sort the input tensor. If not given, the flattened array is used. Default is -1.is_ascend::boolean, optional, default=1
: Whether to sort in ascending or descending order.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.split
— Method.
split(data, num_outputs, axis, squeeze_axis)
split is an alias of SliceChannel.
Splits an array along a particular axis into multiple sub-arrays.
.. note:: $SliceChannel$ is deprecated. Use $split$ instead.
Note that num_outputs
should evenly divide the length of the axis along which to split the array.
Example::
x = [[[ 1.] [ 2.]] [[ 3.] [ 4.]] [[ 5.] [ 6.]]] x.shape = (3, 2, 1)
y = split(x, axis=1, num_outputs=2) // a list of 2 arrays with shape (3, 1, 1) y = [[[ 1.]] [[ 3.]] [[ 5.]]]
[[[ 2.]]
[[ 4.]]
[[ 6.]]]
y[0].shape = (3, 1, 1)
z = split(x, axis=0, num_outputs=3) // a list of 3 arrays with shape (1, 2, 1) z = [[[ 1.] [ 2.]]]
[[[ 3.]
[ 4.]]]
[[[ 5.]
[ 6.]]]
z[0].shape = (1, 2, 1)
squeeze_axis=1
removes the axis with length 1 from the shapes of the output arrays. Note that setting squeeze_axis
to $1$ removes axis with length 1 only along the axis
which it is split. Also squeeze_axis
can be set to true only if $input.shape[axis] == num_outputs$.
Example::
z = split(x, axis=0, numoutputs=3, squeezeaxis=1) // a list of 3 arrays with shape (2, 1) z = [[ 1.] [ 2.]]
[[ 3.]
[ 4.]]
[[ 5.]
[ 6.]]
z[0].shape = (2 ,1 )
Defined in src/operator/slice_channel.cc:L106
Arguments
data::NDArray-or-SymbolicNode
: The inputnum_outputs::int, required
: Number of splits. Note that this should evenly divide the length of theaxis
.axis::int, optional, default='1'
: Axis along which to split.squeeze_axis::boolean, optional, default=0
: If true, Removes the axis with length 1 from the shapes of the output arrays. Note that settingsqueeze_axis
to $true$ removes axis with length 1 only along theaxis
which it is split. Alsosqueeze_axis
can be set to $true$ only if $input.shape[axis] == num_outputs$.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.sqrt
— Method.
sqrt(data)
Returns element-wise square-root value of the input.
.. math:: \textrm{sqrt}(x) = \sqrt{x}
Example::
sqrt([4, 9, 16]) = [2, 3, 4]
The storage type of $sqrt$ output depends upon the input storage type:
- sqrt(default) = default
- sqrt(rowsparse) = rowsparse
- sqrt(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_pow.cc:L170
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.transpose
— Method.
transpose(data, axes)
Permutes the dimensions of an array. Examples:: x = [[ 1, 2], [ 3, 4]] transpose(x) = [[ 1., 3.], [ 2., 4.]] x = [[[ 1., 2.], [ 3., 4.]], [[ 5., 6.], [ 7., 8.]]] transpose(x) = [[[ 1., 5.], [ 3., 7.]], [[ 2., 6.], [ 4., 8.]]] transpose(x, axes=(1,0,2)) = [[[ 1., 2.], [ 5., 6.]], [[ 3., 4.], [ 7., 8.]]]
Defined in src/operator/tensor/matrix_op.cc:L327
Arguments
data::NDArray-or-SymbolicNode
: Source inputaxes::Shape(tuple), optional, default=[]
: Target axis order. By default the axes will be inverted.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
Base.trunc
— Method.
trunc(data)
Return the element-wise truncated value of the input.
The truncated value of the scalar x is the nearest integer i which is closer to zero than x is. In short, the fractional part of the signed number x is discarded.
Example::
trunc([-2.1, -1.9, 1.5, 1.9, 2.1]) = [-2., -1., 1., 1., 2.]
The storage type of $trunc$ output depends upon the input storage type:
- trunc(default) = default
- trunc(rowsparse) = rowsparse
- trunc(csr) = csr
Defined in src/operator/tensor/elemwiseunaryop_basic.cc:L856
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
LinearAlgebra.diag
— Method.
diag(data, k, axis1, axis2)
Extracts a diagonal or constructs a diagonal array.
$diag$'s behavior depends on the input array dimensions:
- 1-D arrays: constructs a 2-D array with the input as its diagonal, all other elements are zero.
-
N-D arrays: extracts the diagonals of the sub-arrays with axes specified by $axis1$ and $axis2$. The output shape would be decided by removing the axes numbered $axis1$ and $axis2$ from the input shape and appending to the result a new axis with the size of the diagonals in question.
For example, when the input shape is
(2, 3, 4, 5)
, $axis1$ and $axis2$ are 0 and 2 respectively and $k$ is 0, the resulting shape would be(3, 5, 2)
.
Examples::
x = [[1, 2, 3], [4, 5, 6]]
diag(x) = [1, 5]
diag(x, k=1) = [2, 6]
diag(x, k=-1) = [4]
x = [1, 2, 3]
diag(x) = [[1, 0, 0], [0, 2, 0], [0, 0, 3]]
diag(x, k=1) = [[0, 1, 0], [0, 0, 2], [0, 0, 0]]
diag(x, k=-1) = [[0, 0, 0], [1, 0, 0], [0, 2, 0]]
x = [[[1, 2], [3, 4]],
[[5, 6],
[7, 8]]]
diag(x) = [[1, 7], [2, 8]]
diag(x, k=1) = [[3], [4]]
diag(x, axis1=-2, axis2=-1) = [[1, 4], [5, 8]]
Defined in src/operator/tensor/diag_op.cc:L86
Arguments
data::NDArray-or-SymbolicNode
: Input ndarrayk::int, optional, default='0'
: Diagonal in question. The default is 0. Use k>0 for diagonals above the main diagonal, and k<0 for diagonals below the main diagonal. If input has shape (S0 S1) k must be between -S0 and S1axis1::int, optional, default='0'
: The first axis of the sub-arrays of interest. Ignored when the input is a 1-D array.axis2::int, optional, default='1'
: The second axis of the sub-arrays of interest. Ignored when the input is a 1-D array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
LinearAlgebra.dot
— Method.
dot(lhs, rhs, transpose_a, transpose_b, forward_stype)
Dot product of two arrays.
$dot$'s behavior depends on the input array dimensions:
- 1-D arrays: inner product of vectors
- 2-D arrays: matrix multiplication
-
N-D arrays: a sum product over the last axis of the first input and the first axis of the second input
For example, given 3-D $x$ with shape
(n,m,k)
and $y$ with shape(k,r,s)
, the result array will have shape(n,m,r,s)
. It is computed by::dot(x,y)[i,j,a,b] = sum(x[i,j,:]*y[:,a,b])
Example::
x = reshape([0,1,2,3,4,5,6,7], shape=(2,2,2)) y = reshape([7,6,5,4,3,2,1,0], shape=(2,2,2)) dot(x,y)[0,0,1,1] = 0 sum(x[0,0,:]*y[:,1,1]) = 0
The storage type of $dot$ output depends on storage types of inputs, transpose option and forward_stype option for output storage type. Implemented sparse operations include:
- dot(default, default, transposea=True/False, transposeb=True/False) = default
- dot(csr, default, transpose_a=True) = default
- dot(csr, default, transposea=True) = rowsparse
- dot(csr, default) = default
- dot(csr, row_sparse) = default
- dot(default, csr) = csr (CPU only)
- dot(default, csr, forward_stype='default') = default
- dot(default, csr, transposeb=True, forwardstype='default') = default
If the combination of input storage types and forward_stype does not match any of the above patterns, $dot$ will fallback and generate output with default storage.
.. Note::
If the storage type of the lhs is "csr", the storage type of gradient w.r.t rhs will be
"row_sparse". Only a subset of optimizers support sparse gradients, including SGD, AdaGrad
and Adam. Note that by default lazy updates is turned on, which may perform differently
from standard updates. For more details, please check the Optimization API at:
https://mxnet.incubator.apache.org/api/python/optimization/optimization.html
Defined in src/operator/tensor/dot.cc:L77
Arguments
lhs::NDArray-or-SymbolicNode
: The first inputrhs::NDArray-or-SymbolicNode
: The second inputtranspose_a::boolean, optional, default=0
: If true then transpose the first input before dot.transpose_b::boolean, optional, default=0
: If true then transpose the second input before dot.forward_stype::{None, 'csr', 'default', 'row_sparse'},optional, default='None'
: The desired storage type of the forward output given by user, if thecombination of input storage types and this hint does not matchany implemented ones, the dot operator will perform fallback operationand still produce an output of the desired storage type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
LinearAlgebra.norm
— Method.
norm(data, ord, axis, out_dtype, keepdims)
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.caststorage('rowsparse')
norm(rsp) = [5.47722578]
csr = x.cast_storage('csr')
norm(csr) = [5.47722578]
Defined in src/operator/tensor/broadcastreducenorm_value.cc:L88
Arguments
data::NDArray-or-SymbolicNode
: The inputord::int, optional, default='2'
: Order of the norm. Currently ord=1 and ord=2 is supported.axis::Shape or None, optional, default=None
: The axis or axes along which to perform the reduction. The default,axis=()
, will compute over all elements into a scalar array with shape(1,)
. Ifaxis
is int, a reduction is performed on a particular axis. Ifaxis
is a 2-tuple, it specifies the axes that hold 2-D matrices, and the matrix norms of these matrices are computed.out_dtype::{None, 'float16', 'float32', 'float64', 'int32', 'int64', 'int8'},optional, default='None'
: The data type of the output.keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axis is left in the result as dimension with size one.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Activation
— Method.
Activation(data, act_type)
Applies an activation function element-wise to the input.
The following activation functions are supported:
relu
: Rectified Linear Unit, :math:y = max(x, 0)
sigmoid
: :math:y = \frac{1}{1 + exp(-x)}
tanh
: Hyperbolic tangent, :math:y = \frac{exp(x) - exp(-x)}{exp(x) + exp(-x)}
softrelu
: Soft ReLU, or SoftPlus, :math:y = log(1 + exp(x))
softsign
: :math:y = \frac{x}{1 + abs(x)}
Defined in src/operator/nn/activation.cc:L164
Arguments
data::NDArray-or-SymbolicNode
: The input array.act_type::{'relu', 'sigmoid', 'softrelu', 'softsign', 'tanh'}, required
: Activation function to be applied.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.BatchNorm
— Method.
BatchNorm(data, gamma, beta, moving_mean, moving_var, eps, momentum, fix_gamma, use_global_stats, output_mean_var, axis, cudnn_off, min_calib_range, max_calib_range)
Batch normalization.
Normalizes a data batch by mean and variance, and applies a scale $gamma$ as well as offset $beta$.
Assume the input has more than one dimension and we normalize along axis 1. We first compute the mean and variance along this axis:
.. math::
data_mean[i] = mean(data[:,i,:,...]) \ data_var[i] = var(data[:,i,:,...])
Then compute the normalized output, which has the same shape as input, as following:
.. math::
out[:,i,:,...] = \frac{data[:,i,:,...] - data_mean[i]}{\sqrt{data_var[i]+\epsilon}} * gamma[i] + beta[i]
Both mean and var returns a scalar by treating the input as a vector.
Assume the input has size k on axis 1, then both $gamma$ and $beta$ have shape (k,). If $output_mean_var$ is set to be true, then outputs both $data_mean$ and the inverse of $data_var$, which are needed for the backward pass. Note that gradient of these two outputs are blocked.
Besides the inputs and the outputs, this operator accepts two auxiliary states, $moving_mean$ and $moving_var$, which are k-length vectors. They are global statistics for the whole dataset, which are updated by::
movingmean = movingmean * momentum + datamean * (1 - momentum) movingvar = movingvar * momentum + datavar * (1 - momentum)
If $use_global_stats$ is set to be true, then $moving_mean$ and $moving_var$ are used instead of $data_mean$ and $data_var$ to compute the output. It is often used during inference.
The parameter $axis$ specifies which axis of the input shape denotes the 'channel' (separately normalized groups). The default is 1. Specifying -1 sets the channel axis to be the last item in the input shape.
Both $gamma$ and $beta$ are learnable parameters. But if $fix_gamma$ is true, then set $gamma$ to 1 and its gradient to 0.
.. Note:: When $fix_gamma$ is set to True, no sparse support is provided. If $fix_gamma is$ set to False, the sparse tensors will fallback.
Defined in src/operator/nn/batch_norm.cc:L608
Arguments
data::NDArray-or-SymbolicNode
: Input data to batch normalizationgamma::NDArray-or-SymbolicNode
: gamma arraybeta::NDArray-or-SymbolicNode
: beta arraymoving_mean::NDArray-or-SymbolicNode
: running mean of inputmoving_var::NDArray-or-SymbolicNode
: running variance of inputeps::double, optional, default=0.0010000000474974513
: Epsilon to prevent div 0. Must be no less than CUDNNBNMIN_EPSILON defined in cudnn.h when using cudnn (usually 1e-5)momentum::float, optional, default=0.899999976
: Momentum for moving averagefix_gamma::boolean, optional, default=1
: Fix gamma while traininguse_global_stats::boolean, optional, default=0
: Whether use global moving statistics instead of local batch-norm. This will force change batch-norm into a scale shift operator.output_mean_var::boolean, optional, default=0
: Output the mean and inverse stdaxis::int, optional, default='1'
: Specify which shape axis the channel is specifiedcudnn_off::boolean, optional, default=0
: Do not select CUDNN operator, if availablemin_calib_range::float or None, optional, default=None
: The minimum scalar value in the form of float32 obtained through calibration. If present, it will be used to by quantized batch norm op to calculate primitive scale.Note: this calib_range is to calib bn output.max_calib_range::float or None, optional, default=None
: The maximum scalar value in the form of float32 obtained through calibration. If present, it will be used to by quantized batch norm op to calculate primitive scale.Note: this calib_range is to calib bn output.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.BatchNorm_v1
— Method.
BatchNorm_v1(data, gamma, beta, eps, momentum, fix_gamma, use_global_stats, output_mean_var)
Batch normalization.
This operator is DEPRECATED. Perform BatchNorm on the input.
Normalizes a data batch by mean and variance, and applies a scale $gamma$ as well as offset $beta$.
Assume the input has more than one dimension and we normalize along axis 1. We first compute the mean and variance along this axis:
.. math::
data_mean[i] = mean(data[:,i,:,...]) \ data_var[i] = var(data[:,i,:,...])
Then compute the normalized output, which has the same shape as input, as following:
.. math::
out[:,i,:,...] = \frac{data[:,i,:,...] - data_mean[i]}{\sqrt{data_var[i]+\epsilon}} * gamma[i] + beta[i]
Both mean and var returns a scalar by treating the input as a vector.
Assume the input has size k on axis 1, then both $gamma$ and $beta$ have shape (k,). If $output_mean_var$ is set to be true, then outputs both $data_mean$ and $data_var$ as well, which are needed for the backward pass.
Besides the inputs and the outputs, this operator accepts two auxiliary states, $moving_mean$ and $moving_var$, which are k-length vectors. They are global statistics for the whole dataset, which are updated by::
movingmean = movingmean * momentum + datamean * (1 - momentum) movingvar = movingvar * momentum + datavar * (1 - momentum)
If $use_global_stats$ is set to be true, then $moving_mean$ and $moving_var$ are used instead of $data_mean$ and $data_var$ to compute the output. It is often used during inference.
Both $gamma$ and $beta$ are learnable parameters. But if $fix_gamma$ is true, then set $gamma$ to 1 and its gradient to 0.
There's no sparse support for this operator, and it will exhibit problematic behavior if used with sparse tensors.
Defined in src/operator/batchnormv1.cc:L94
Arguments
data::NDArray-or-SymbolicNode
: Input data to batch normalizationgamma::NDArray-or-SymbolicNode
: gamma arraybeta::NDArray-or-SymbolicNode
: beta arrayeps::float, optional, default=0.00100000005
: Epsilon to prevent div 0momentum::float, optional, default=0.899999976
: Momentum for moving averagefix_gamma::boolean, optional, default=1
: Fix gamma while traininguse_global_stats::boolean, optional, default=0
: Whether use global moving statistics instead of local batch-norm. This will force change batch-norm into a scale shift operator.output_mean_var::boolean, optional, default=0
: Output All,normal mean and varname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.BilinearSampler
— Method.
BilinearSampler(data, grid, cudnn_off)
Applies bilinear sampling to input feature map.
Bilinear Sampling is the key of [NIPS2015] \"Spatial Transformer Networks\". The usage of the operator is very similar to remap function in OpenCV, except that the operator has the backward pass.
Given :math:data
and :math:grid
, then the output is computed by
.. math:: x{src} = grid[batch, 0, y, x{dst}] \ y = grid[batch, 1, y{dst}, x] \ output[batch, channel, y{dst}, x] = G(data[batch, channel, y{src}, x)
:math:x_{dst}
, :math:y_{dst}
enumerate all spatial locations in :math:output
, and :math:G()
denotes the bilinear interpolation kernel. The out-boundary points will be padded with zeros.The shape of the output will be (data.shape[0], data.shape[1], grid.shape[2], grid.shape[3]).
The operator assumes that :math:data
has 'NCHW' layout and :math:grid
has been normalized to [-1, 1].
BilinearSampler often cooperates with GridGenerator which generates sampling grids for BilinearSampler. GridGenerator supports two kinds of transformation: $affine$ and $warp$. If users want to design a CustomOp to manipulate :math:grid
, please firstly refer to the code of GridGenerator.
Example 1::
Zoom out data two times
data = array([[[[1, 4, 3, 6], [1, 8, 8, 9], [0, 4, 1, 5], [1, 0, 1, 3]]]])
affine_matrix = array([[2, 0, 0], [0, 2, 0]])
affinematrix = reshape(affinematrix, shape=(1, 6))
grid = GridGenerator(data=affinematrix, transformtype='affine', target_shape=(4, 4))
out = BilinearSampler(data, grid)
out [[[[ 0, 0, 0, 0], [ 0, 3.5, 6.5, 0], [ 0, 1.25, 2.5, 0], [ 0, 0, 0, 0]]]
Example 2::
shift data horizontally by -1 pixel
data = array([[[[1, 4, 3, 6], [1, 8, 8, 9], [0, 4, 1, 5], [1, 0, 1, 3]]]])
warp_maxtrix = array([[[[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]]])
grid = GridGenerator(data=warpmatrix, transformtype='warp') out = BilinearSampler(data, grid)
out [[[[ 4, 3, 6, 0], [ 8, 8, 9, 0], [ 4, 1, 5, 0], [ 0, 1, 3, 0]]]
Defined in src/operator/bilinear_sampler.cc:L255
Arguments
data::NDArray-or-SymbolicNode
: Input data to the BilinearsamplerOp.grid::NDArray-or-SymbolicNode
: Input grid to the BilinearsamplerOp.grid has two channels: xsrc, ysrccudnn_off::boolean or None, optional, default=None
: whether to turn cudnn offname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.BlockGrad
— Method.
BlockGrad(data)
Stops gradient computation.
Stops the accumulated gradient of the inputs from flowing through this operator in the backward direction. In other words, this operator prevents the contribution of its inputs to be taken into account for computing gradients.
Example::
v1 = [1, 2] v2 = [0, 1] a = Variable('a') b = Variable('b') bstopgrad = stopgradient(3 * b) loss = MakeLoss(bstop_grad + a)
executor = loss.simplebind(ctx=cpu(), a=(1,2), b=(1,2)) executor.forward(istrain=True, a=v1, b=v2) executor.outputs [ 1. 5.]
executor.backward() executor.grad_arrays [ 0. 0.] [ 1. 1.]
Defined in src/operator/tensor/elemwiseunaryop_basic.cc:L325
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.CTCLoss
— Method.
CTCLoss(data, label, data_lengths, label_lengths, use_data_lengths, use_label_lengths, blank_label)
Connectionist Temporal Classification Loss.
.. note:: The existing alias $contrib_CTCLoss$ is deprecated.
The shapes of the inputs and outputs:
- data:
(sequence_length, batch_size, alphabet_size)
- label:
(batch_size, label_sequence_length)
- out:
(batch_size)
The data
tensor consists of sequences of activation vectors (without applying softmax), with i-th channel in the last dimension corresponding to i-th label for i between 0 and alphabet*size-1 (i.e always 0-indexed). Alphabet size should include one additional value reserved for blank label. When blank*label
is"first"
, the0
-th channel is be reserved for activation of blank label, or otherwise if it is "last",(alphabet_size-1)
-th channel should be reserved for blank label.
$label$ is an index matrix of integers. When blank_label
is $"first"$, the value 0 is then reserved for blank label, and should not be passed in this matrix. Otherwise, when blank_label
is $"last"$, the value (alphabet_size-1)
is reserved for blank label.
If a sequence of labels is shorter than labelsequencelength, use the special padding value at the end of the sequence to conform it to the correct length. The padding value is 0
when blank_label
is $"first"$, and -1
otherwise.
For example, suppose the vocabulary is [a, b, c]
, and in one batch we have three sequences 'ba', 'cbb', and 'abac'. When blank_label
is $"first"$, we can index the labels as {'a': 1, 'b': 2, 'c': 3}
, and we reserve the 0-th channel for blank label in data tensor. The resulting label
tensor should be padded to be::
[[2, 1, 0, 0], [3, 2, 2, 0], [1, 2, 1, 3]]
When blank_label
is $"last"$, we can index the labels as {'a': 0, 'b': 1, 'c': 2}
, and we reserve the channel index 3 for blank label in data tensor. The resulting label
tensor should be padded to be::
[[1, 0, -1, -1], [2, 1, 1, -1], [0, 1, 0, 2]]
$out$ is a list of CTC loss values, one per example in the batch.
See Connectionist Temporal Classification: Labelling Unsegmented Sequence Data with Recurrent Neural Networks, A. Graves et al. for more information on the definition and the algorithm.
Defined in src/operator/nn/ctc_loss.cc:L100
Arguments
data::NDArray-or-SymbolicNode
: Input ndarraylabel::NDArray-or-SymbolicNode
: Ground-truth labels for the loss.data_lengths::NDArray-or-SymbolicNode
: Lengths of data for each of the samples. Only required when usedatalengths is true.label_lengths::NDArray-or-SymbolicNode
: Lengths of labels for each of the samples. Only required when uselabellengths is true.use_data_lengths::boolean, optional, default=0
: Whether the data lenghts are decided bydata_lengths
. If false, the lengths are equal to the max sequence length.use_label_lengths::boolean, optional, default=0
: Whether the label lenghts are decided bylabel_lengths
, or derived frompadding_mask
. If false, the lengths are derived from the first occurrence of the value ofpadding_mask
. The value ofpadding_mask
is $0$ when first CTC label is reserved for blank, and $-1$ when last label is reserved for blank. Seeblank_label
.blank_label::{'first', 'last'},optional, default='first'
: Set the label that is reserved for blank label.If "first", 0-th label is reserved, and label values for tokens in the vocabulary are between $1$ and $alphabet_size-1$, and the padding mask is $-1$. If "last", last label value $alphabet_size-1$ is reserved for blank label instead, and label values for tokens in the vocabulary are between $0$ and $alphabet_size-2$, and the padding mask is $0$.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Cast
— Method.
Cast(data, dtype)
Casts all elements of the input to a new type.
.. note:: $Cast$ is deprecated. Use $cast$ instead.
Example::
cast([0.9, 1.3], dtype='int32') = [0, 1] cast([1e20, 11.1], dtype='float16') = [inf, 11.09375] cast([300, 11.1, 10.9, -1, -3], dtype='uint8') = [44, 11, 10, 255, 253]
Defined in src/operator/tensor/elemwiseunaryop_basic.cc:L664
Arguments
data::NDArray-or-SymbolicNode
: The input.dtype::{'bfloat16', 'bool', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'}, required
: Output data type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Concat
— Method.
Concat(data, num_args, dim)
Note: Concat takes variable number of positional inputs. So instead of calling as Concat([x, y, z], numargs=3), one should call via Concat(x, y, z), and numargs will be determined automatically.
Joins input arrays along a given axis.
.. note:: Concat
is deprecated. Use concat
instead.
The dimensions of the input arrays should be the same except the axis along which they will be concatenated. The dimension of the output array along the concatenated axis will be equal to the sum of the corresponding dimensions of the input arrays.
The storage type of $concat$ output depends on storage types of inputs
- concat(csr, csr, ..., csr, dim=0) = csr
- otherwise, $concat$ generates output with default storage
Example::
x = [[1,1],[2,2]] y = [[3,3],[4,4],[5,5]] z = [[6,6], [7,7],[8,8]]
concat(x,y,z,dim=0) = [[ 1., 1.], [ 2., 2.], [ 3., 3.], [ 4., 4.], [ 5., 5.], [ 6., 6.], [ 7., 7.], [ 8., 8.]]
Note that you cannot concat x,y,z along dimension 1 since dimension 0 is not the same for all the input arrays.
concat(y,z,dim=1) = [[ 3., 3., 6., 6.], [ 4., 4., 7., 7.], [ 5., 5., 8., 8.]]
Defined in src/operator/nn/concat.cc:L384
Arguments
data::NDArray-or-SymbolicNode[]
: List of arrays to concatenatenum_args::int, required
: Number of inputs to be concated.dim::int, optional, default='1'
: the dimension to be concated.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Convolution
— Method.
Convolution(data, weight, bias, kernel, stride, dilate, pad, num_filter, num_group, workspace, no_bias, cudnn_tune, cudnn_off, layout)
Compute N-D convolution on (N+2)-D input.
In the 2-D convolution, given input data with shape (batch_size, channel, height, width), the output is computed by
.. math::
out[n,i,:,:] = bias[i] + \sum_{j=0}^{channel} data[n,j,:,:] \star weight[i,j,:,:]
where :math:\star
is the 2-D cross-correlation operator.
For general 2-D convolution, the shapes are
- data: (batch_size, channel, height, width)
- weight: (num_filter, channel, kernel[0], kernel[1])
- bias: (num_filter,)
- out: (batchsize, numfilter, outheight, outwidth).
Define::
f(x,k,p,s,d) = floor((x+2p-d(k-1)-1)/s)+1
then we have::
outheight=f(height, kernel[0], pad[0], stride[0], dilate[0]) outwidth=f(width, kernel[1], pad[1], stride[1], dilate[1])
If $no_bias$ is set to be true, then the $bias$ term is ignored.
The default data $layout$ is NCHW, namely (batch_size, channel, height, width). We can choose other layouts such as NWC.
If $num_group$ is larger than 1, denoted by g, then split the input $data$ evenly into g parts along the channel axis, and also evenly split $weight$ along the first dimension. Next compute the convolution on the i-th part of the data with the i-th weight part. The output is obtained by concatenating all the g results.
1-D convolution does not have height dimension but only width in space.
- data: (batch_size, channel, width)
- weight: (num_filter, channel, kernel[0])
- bias: (num_filter,)
- out: (batchsize, numfilter, out_width).
3-D convolution adds an additional depth dimension besides height and width. The shapes are
- data: (batch_size, channel, depth, height, width)
- weight: (num_filter, channel, kernel[0], kernel[1], kernel[2])
- bias: (num_filter,)
- out: (batchsize, numfilter, outdepth, outheight, out_width).
Both $weight$ and $bias$ are learnable parameters.
There are other options to tune the performance.
-
cudnn_tune: enable this option leads to higher startup time but may give faster speed. Options are
- off: no tuning
- limited_workspace:run test and pick the fastest algorithm that doesn't exceed workspace limit.
- fastest: pick the fastest algorithm and ignore workspace limit.
- None (default): the behavior is determined by environment variable $MXNET_CUDNN_AUTOTUNE_DEFAULT$. 0 for off, 1 for limited workspace (default), 2 for fastest.
- workspace: A large number leads to more (GPU) memory usage but may improve the performance.
Defined in src/operator/nn/convolution.cc:L475
Arguments
data::NDArray-or-SymbolicNode
: Input data to the ConvolutionOp.weight::NDArray-or-SymbolicNode
: Weight matrix.bias::NDArray-or-SymbolicNode
: Bias parameter.kernel::Shape(tuple), required
: Convolution kernel size: (w,), (h, w) or (d, h, w)stride::Shape(tuple), optional, default=[]
: Convolution stride: (w,), (h, w) or (d, h, w). Defaults to 1 for each dimension.dilate::Shape(tuple), optional, default=[]
: Convolution dilate: (w,), (h, w) or (d, h, w). Defaults to 1 for each dimension.pad::Shape(tuple), optional, default=[]
: Zero pad for convolution: (w,), (h, w) or (d, h, w). Defaults to no padding.num_filter::int (non-negative), required
: Convolution filter(channel) numbernum_group::int (non-negative), optional, default=1
: Number of group partitions.workspace::long (non-negative), optional, default=1024
: Maximum temporary workspace allowed (MB) in convolution.This parameter has two usages. When CUDNN is not used, it determines the effective batch size of the convolution kernel. When CUDNN is used, it controls the maximum temporary storage used for tuning the best CUDNN kernel whenlimited_workspace
strategy is used.no_bias::boolean, optional, default=0
: Whether to disable bias parameter.cudnn_tune::{None, 'fastest', 'limited_workspace', 'off'},optional, default='None'
: Whether to pick convolution algo by running performance test.cudnn_off::boolean, optional, default=0
: Turn off cudnn for this layer.layout::{None, 'NCDHW', 'NCHW', 'NCW', 'NDHWC', 'NHWC'},optional, default='None'
: Set layout for input, output and weight. Empty for default layout: NCW for 1d, NCHW for 2d and NCDHW for 3d.NHWC and NDHWC are only supported on GPU.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Convolution_v1
— Method.
Convolution_v1(data, weight, bias, kernel, stride, dilate, pad, num_filter, num_group, workspace, no_bias, cudnn_tune, cudnn_off, layout)
This operator is DEPRECATED. Apply convolution to input then add a bias.
Arguments
data::NDArray-or-SymbolicNode
: Input data to the ConvolutionV1Op.weight::NDArray-or-SymbolicNode
: Weight matrix.bias::NDArray-or-SymbolicNode
: Bias parameter.kernel::Shape(tuple), required
: convolution kernel size: (h, w) or (d, h, w)stride::Shape(tuple), optional, default=[]
: convolution stride: (h, w) or (d, h, w)dilate::Shape(tuple), optional, default=[]
: convolution dilate: (h, w) or (d, h, w)pad::Shape(tuple), optional, default=[]
: pad for convolution: (h, w) or (d, h, w)num_filter::int (non-negative), required
: convolution filter(channel) numbernum_group::int (non-negative), optional, default=1
: Number of group partitions. Equivalent to slicing input into num_group partitions, apply convolution on each, then concatenate the resultsworkspace::long (non-negative), optional, default=1024
: Maximum temporary workspace allowed for convolution (MB).This parameter determines the effective batch size of the convolution kernel, which may be smaller than the given batch size. Also, the workspace will be automatically enlarged to make sure that we can run the kernel with batch_size=1no_bias::boolean, optional, default=0
: Whether to disable bias parameter.cudnn_tune::{None, 'fastest', 'limited_workspace', 'off'},optional, default='None'
: Whether to pick convolution algo by running performance test. Leads to higher startup time but may give faster speed. Options are: 'off': no tuning 'limitedworkspace': run test and pick the fastest algorithm that doesn't exceed workspace limit. 'fastest': pick the fastest algorithm and ignore workspace limit. If set to None (default), behavior is determined by environment variable MXNETCUDNNAUTOTUNEDEFAULT: 0 for off, 1 for limited workspace (default), 2 for fastest.cudnn_off::boolean, optional, default=0
: Turn off cudnn for this layer.layout::{None, 'NCDHW', 'NCHW', 'NDHWC', 'NHWC'},optional, default='None'
: Set layout for input, output and weight. Empty for default layout: NCHW for 2d and NCDHW for 3d.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Correlation
— Method.
Correlation(data1, data2, kernel_size, max_displacement, stride1, stride2, pad_size, is_multiply)
Applies correlation to inputs.
The correlation layer performs multiplicative patch comparisons between two feature maps.
Given two multi-channel feature maps :math:f_{1}, f_{2}
, with :math:w
, :math:h
, and :math:c
being their width, height, and number of channels, the correlation layer lets the network compare each patch from :math:f_{1}
with each patch from :math:f_{2}
.
For now we consider only a single comparison of two patches. The 'correlation' of two patches centered at :math:x_{1}
in the first map and :math:x_{2}
in the second map is then defined as:
.. math::
c(x{1}, x) = \sum*{o \in [-k,k] \times [-k,k]}
for a square patch of size :math:K:=2k+1
.
Note that the equation above is identical to one step of a convolution in neural networks, but instead of convolving data with a filter, it convolves data with other data. For this reason, it has no training weights.
Computing :math:c(x_{1}, x_{2})
involves :math:c * K^{2}
multiplications. Comparing all patch combinations involves :math:w^{2}*h^{2}
such computations.
Given a maximum displacement :math:d
, for each location :math:x_{1}
it computes correlations :math:c(x_{1}, x_{2})
only in a neighborhood of size :math:D:=2d+1
, by limiting the range of :math:x_{2}
. We use strides :math:s_{1}, s_{2}
, to quantize :math:x_{1}
globally and to quantize :math:x_{2}
within the neighborhood centered around :math:x_{1}
.
The final output is defined by the following expression:
.. math:: out[n, q, i, j] = c(x{i, j}, x)
where :math:i
and :math:j
enumerate spatial locations in :math:f_{1}
, and :math:q
denotes the :math:q^{th}
neighborhood of :math:x_{i,j}
.
Defined in src/operator/correlation.cc:L197
Arguments
data1::NDArray-or-SymbolicNode
: Input data1 to the correlation.data2::NDArray-or-SymbolicNode
: Input data2 to the correlation.kernel_size::int (non-negative), optional, default=1
: kernel size for Correlation must be an odd numbermax_displacement::int (non-negative), optional, default=1
: Max displacement of Correlationstride1::int (non-negative), optional, default=1
: stride1 quantize data1 globallystride2::int (non-negative), optional, default=1
: stride2 quantize data2 within the neighborhood centered around data1pad_size::int (non-negative), optional, default=0
: pad for Correlationis_multiply::boolean, optional, default=1
: operation type is either multiplication or subductionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Crop
— Method.
Crop(data, num_args, offset, h_w, center_crop)
Note: Crop takes variable number of positional inputs. So instead of calling as Crop([x, y, z], numargs=3), one should call via Crop(x, y, z), and numargs will be determined automatically.
.. note:: Crop
is deprecated. Use slice
instead.
Crop the 2nd and 3rd dim of input data, with the corresponding size of hw or with width and height of the second input symbol, i.e., with one input, we need hw to specify the crop height and width, otherwise the second input symbol's size will be used
Defined in src/operator/crop.cc:L49
Arguments
data::SymbolicNode or SymbolicNode[]
: Tensor or List of Tensors, the second input will be used as crop_like shape referencenum_args::int, required
: Number of inputs for crop, if equals one, then we will use the hwfor crop height and width, else if equals two, then we will use the heightand width of the second input symbol, we name croplike hereoffset::Shape(tuple), optional, default=[0,0]
: crop offset coordinate: (y, x)h_w::Shape(tuple), optional, default=[0,0]
: crop height and width: (h, w)center_crop::boolean, optional, default=0
: If set to true, then it will use be the centercrop,or it will crop using the shape of croplikename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Custom
— Method.
Custom(data, op_type)
Apply a custom operator implemented in a frontend language (like Python).
Custom operators should override required methods like forward
and backward
. The custom operator must be registered before it can be used. Please check the tutorial here: https://mxnet.incubator.apache.org/api/faq/new_op
Defined in src/operator/custom/custom.cc:L546
Arguments
data::NDArray-or-SymbolicNode[]
: Input data for the custom operator.op_type::string
: Name of the custom operator. This is the name that is passed tomx.operator.register
to register the operator.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Deconvolution
— Method.
Deconvolution(data, weight, bias, kernel, stride, dilate, pad, adj, target_shape, num_filter, num_group, workspace, no_bias, cudnn_tune, cudnn_off, layout)
Computes 1D or 2D transposed convolution (aka fractionally strided convolution) of the input tensor. This operation can be seen as the gradient of Convolution operation with respect to its input. Convolution usually reduces the size of the input. Transposed convolution works the other way, going from a smaller input to a larger output while preserving the connectivity pattern.
Arguments
data::NDArray-or-SymbolicNode
: Input tensor to the deconvolution operation.weight::NDArray-or-SymbolicNode
: Weights representing the kernel.bias::NDArray-or-SymbolicNode
: Bias added to the result after the deconvolution operation.kernel::Shape(tuple), required
: Deconvolution kernel size: (w,), (h, w) or (d, h, w). This is same as the kernel size used for the corresponding convolutionstride::Shape(tuple), optional, default=[]
: The stride used for the corresponding convolution: (w,), (h, w) or (d, h, w). Defaults to 1 for each dimension.dilate::Shape(tuple), optional, default=[]
: Dilation factor for each dimension of the input: (w,), (h, w) or (d, h, w). Defaults to 1 for each dimension.pad::Shape(tuple), optional, default=[]
: The amount of implicit zero padding added during convolution for each dimension of the input: (w,), (h, w) or (d, h, w). $(kernel-1)/2$ is usually a good choice. Iftarget_shape
is set,pad
will be ignored and a padding that will generate the target shape will be used. Defaults to no padding.adj::Shape(tuple), optional, default=[]
: Adjustment for output shape: (w,), (h, w) or (d, h, w). Iftarget_shape
is set,adj
will be ignored and computed accordingly.target_shape::Shape(tuple), optional, default=[]
: Shape of the output tensor: (w,), (h, w) or (d, h, w).num_filter::int (non-negative), required
: Number of output filters.num_group::int (non-negative), optional, default=1
: Number of groups partition.workspace::long (non-negative), optional, default=512
: Maximum temporary workspace allowed (MB) in deconvolution.This parameter has two usages. When CUDNN is not used, it determines the effective batch size of the deconvolution kernel. When CUDNN is used, it controls the maximum temporary storage used for tuning the best CUDNN kernel whenlimited_workspace
strategy is used.no_bias::boolean, optional, default=1
: Whether to disable bias parameter.cudnn_tune::{None, 'fastest', 'limited_workspace', 'off'},optional, default='None'
: Whether to pick convolution algorithm by running performance test.cudnn_off::boolean, optional, default=0
: Turn off cudnn for this layer.layout::{None, 'NCDHW', 'NCHW', 'NCW', 'NDHWC', 'NHWC'},optional, default='None'
: Set layout for input, output and weight. Empty for default layout, NCW for 1d, NCHW for 2d and NCDHW for 3d.NHWC and NDHWC are only supported on GPU.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Dropout
— Method.
Dropout(data, p, mode, axes, cudnn_off)
Applies dropout operation to input array.
- During training, each element of the input is set to zero with probability p. The whole array is rescaled by :math:
1/(1-p)
to keep the expected sum of the input unchanged. - During testing, this operator does not change the input if mode is 'training'. If mode is 'always', the same computaion as during training will be applied.
Example::
random.seed(998) inputarray = array([[3., 0.5, -0.5, 2., 7.], [2., -0.4, 7., 3., 0.2]]) a = symbol.Variable('a') dropout = symbol.Dropout(a, p = 0.2) executor = dropout.simplebind(a = input_array.shape)
If training
executor.forward(istrain = True, a = inputarray) executor.outputs [[ 3.75 0.625 -0. 2.5 8.75 ] [ 2.5 -0.5 8.75 3.75 0. ]]
If testing
executor.forward(istrain = False, a = inputarray) executor.outputs [[ 3. 0.5 -0.5 2. 7. ] [ 2. -0.4 7. 3. 0.2 ]]
Defined in src/operator/nn/dropout.cc:L95
Arguments
data::NDArray-or-SymbolicNode
: Input array to which dropout will be applied.p::float, optional, default=0.5
: Fraction of the input that gets dropped out during training time.mode::{'always', 'training'},optional, default='training'
: Whether to only turn on dropout during training or to also turn on for inference.axes::Shape(tuple), optional, default=[]
: Axes for variational dropout kernel.cudnn_off::boolean or None, optional, default=0
: Whether to turn off cudnn in dropout operator. This option is ignored if axes is specified.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.ElementWiseSum
— Method.
ElementWiseSum(args)
ElementWiseSum is an alias of add_n.
Note: ElementWiseSum takes variable number of positional inputs. So instead of calling as ElementWiseSum([x, y, z], numargs=3), one should call via ElementWiseSum(x, y, z), and numargs will be determined automatically.
Adds all input arguments element-wise.
.. math:: add_n(a1, a2, ..., an) = a1 + a2 + ... + an
$add_n$ is potentially more efficient than calling $add$ by n
times.
The storage type of $add_n$ output depends on storage types of inputs
- addn(rowsparse, rowsparse, ..) = rowsparse
- add_n(default, csr, default) = default
- add_n(any input combinations longer than 4 (>4) with at least one default type) = default
- otherwise, $add_n$ falls all inputs back to default storage and generates default storage
Defined in src/operator/tensor/elemwise_sum.cc:L155
Arguments
args::NDArray-or-SymbolicNode[]
: Positional input argumentsname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Embedding
— Method.
Embedding(data, weight, input_dim, output_dim, dtype, sparse_grad)
Maps integer indices to vector representations (embeddings).
This operator maps words to real-valued vectors in a high-dimensional space, called word embeddings. These embeddings can capture semantic and syntactic properties of the words. For example, it has been noted that in the learned embedding spaces, similar words tend to be close to each other and dissimilar words far apart.
For an input array of shape (d1, ..., dK), the shape of an output array is (d1, ..., dK, outputdim). All the input values should be integers in the range [0, inputdim).
If the inputdim is ip0 and outputdim is op0, then shape of the embedding weight matrix must be (ip0, op0).
When "sparsegrad" is False, if any index mentioned is too large, it is replaced by the index that addresses the last vector in an embedding matrix. When "sparsegrad" is True, an error will be raised if invalid indices are found.
Examples::
inputdim = 4 outputdim = 5
// Each row in weight matrix y represents a word. So, y = (w0,w1,w2,w3) y = [[ 0., 1., 2., 3., 4.], [ 5., 6., 7., 8., 9.], [ 10., 11., 12., 13., 14.], [ 15., 16., 17., 18., 19.]]
// Input array x represents n-grams(2-gram). So, x = [(w1,w3), (w0,w2)] x = [[ 1., 3.], [ 0., 2.]]
// Mapped input x to its vector representation y. Embedding(x, y, 4, 5) = [[[ 5., 6., 7., 8., 9.], [ 15., 16., 17., 18., 19.]],
[[ 0., 1., 2., 3., 4.],
[ 10., 11., 12., 13., 14.]]]
The storage type of weight can be either row_sparse or default.
.. Note::
If "sparse_grad" is set to True, the storage type of gradient w.r.t weights will be
"row_sparse". Only a subset of optimizers support sparse gradients, including SGD, AdaGrad
and Adam. Note that by default lazy updates is turned on, which may perform differently
from standard updates. For more details, please check the Optimization API at:
https://mxnet.incubator.apache.org/api/python/optimization/optimization.html
Defined in src/operator/tensor/indexing_op.cc:L597
Arguments
data::NDArray-or-SymbolicNode
: The input array to the embedding operator.weight::NDArray-or-SymbolicNode
: The embedding weight matrix.input_dim::int, required
: Vocabulary size of the input indices.output_dim::int, required
: Dimension of the embedding vectors.dtype::{'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Data type of weight.sparse_grad::boolean, optional, default=0
: Compute row sparse gradient in the backward calculation. If set to True, the grad's storage type is row_sparse.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.FullyConnected
— Method.
FullyConnected(data, weight, bias, num_hidden, no_bias, flatten)
Applies a linear transformation: :math:Y = XW^T + b
.
If $flatten$ is set to be true, then the shapes are:
- data:
(batch_size, x1, x2, ..., xn)
- weight:
(num_hidden, x1 * x2 * ... * xn)
- bias:
(num_hidden,)
- out:
(batch_size, num_hidden)
If $flatten$ is set to be false, then the shapes are:
- data:
(x1, x2, ..., xn, input_dim)
- weight:
(num_hidden, input_dim)
- bias:
(num_hidden,)
- out:
(x1, x2, ..., xn, num_hidden)
The learnable parameters include both $weight$ and $bias$.
If $no_bias$ is set to be true, then the $bias$ term is ignored.
.. Note::
The sparse support for FullyConnected is limited to forward evaluation with `row_sparse`
weight and bias, where the length of `weight.indices` and `bias.indices` must be equal
to `num_hidden`. This could be useful for model inference with `row_sparse` weights
trained with importance sampling or noise contrastive estimation.
To compute linear transformation with 'csr' sparse data, sparse.dot is recommended instead
of sparse.FullyConnected.
Defined in src/operator/nn/fully_connected.cc:L286
Arguments
data::NDArray-or-SymbolicNode
: Input data.weight::NDArray-or-SymbolicNode
: Weight matrix.bias::NDArray-or-SymbolicNode
: Bias parameter.num_hidden::int, required
: Number of hidden nodes of the output.no_bias::boolean, optional, default=0
: Whether to disable bias parameter.flatten::boolean, optional, default=1
: Whether to collapse all but the first axis of the input data tensor.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.GridGenerator
— Method.
GridGenerator(data, transform_type, target_shape)
Generates 2D sampling grid for bilinear sampling.
Arguments
data::NDArray-or-SymbolicNode
: Input data to the function.transform_type::{'affine', 'warp'}, required
: The type of transformation. Foraffine
, input data should be an affine matrix of size (batch, 6). Forwarp
, input data should be an optical flow of size (batch, 2, h, w).target_shape::Shape(tuple), optional, default=[0,0]
: Specifies the output shape (H, W). This is required if transformation type isaffine
. If transformation type iswarp
, this parameter is ignored.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.GroupNorm
— Method.
GroupNorm(data, gamma, beta, num_groups, eps, output_mean_var)
Group normalization.
The input channels are separated into $num_groups$ groups, each containing $num_channels / num_groups$ channels. The mean and standard-deviation are calculated separately over the each group.
.. math::
data = data.reshape((N, numgroups, C // numgroups, ...)) out = \frac{data - mean(data, axis)}{\sqrt{var(data, axis) + \epsilon}} * gamma + beta
Both $gamma$ and $beta$ are learnable parameters.
Defined in src/operator/nn/group_norm.cc:L76
Arguments
data::NDArray-or-SymbolicNode
: Input datagamma::NDArray-or-SymbolicNode
: gamma arraybeta::NDArray-or-SymbolicNode
: beta arraynum_groups::int, optional, default='1'
: Total number of groups.eps::float, optional, default=9.99999975e-06
: Anepsilon
parameter to prevent division by 0.output_mean_var::boolean, optional, default=0
: Output the mean and std calculated along the given axis.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.IdentityAttachKLSparseReg
— Method.
IdentityAttachKLSparseReg(data, sparseness_target, penalty, momentum)
Apply a sparse regularization to the output a sigmoid activation function.
Arguments
data::NDArray-or-SymbolicNode
: Input data.sparseness_target::float, optional, default=0.100000001
: The sparseness targetpenalty::float, optional, default=0.00100000005
: The tradeoff parameter for the sparseness penaltymomentum::float, optional, default=0.899999976
: The momentum for running averagename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.InstanceNorm
— Method.
InstanceNorm(data, gamma, beta, eps)
Applies instance normalization to the n-dimensional input array.
This operator takes an n-dimensional input array where (n>2) and normalizes the input using the following formula:
.. math::
out = \frac{x - mean[data]}{ \sqrt{Var[data]} + \epsilon} * gamma + beta
This layer is similar to batch normalization layer (BatchNorm
) with two differences: first, the normalization is carried out per example (instance), not over a batch. Second, the same normalization is applied both at test and train time. This operation is also known as contrast normalization
.
If the input data is of shape [batch, channel, spacialdim1, spacialdim2, ...], gamma
and beta
parameters must be vectors of shape [channel].
This implementation is based on this paper [1]_
.. [1] Instance Normalization: The Missing Ingredient for Fast Stylization, D. Ulyanov, A. Vedaldi, V. Lempitsky, 2016 (arXiv:1607.08022v2).
Examples::
// Input of shape (2,1,2) x = [[[ 1.1, 2.2]], [[ 3.3, 4.4]]]
// gamma parameter of length 1 gamma = [1.5]
// beta parameter of length 1 beta = [0.5]
// Instance normalization is calculated with the above formula InstanceNorm(x,gamma,beta) = [[[-0.997527 , 1.99752665]], [[-0.99752653, 1.99752724]]]
Defined in src/operator/instance_norm.cc:L94
Arguments
data::NDArray-or-SymbolicNode
: An n-dimensional input array (n > 2) of the form [batch, channel, spatialdim1, spatialdim2, ...].gamma::NDArray-or-SymbolicNode
: A vector of length 'channel', which multiplies the normalized input.beta::NDArray-or-SymbolicNode
: A vector of length 'channel', which is added to the product of the normalized input and the weight.eps::float, optional, default=0.00100000005
: Anepsilon
parameter to prevent division by 0.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.L2Normalization
— Method.
L2Normalization(data, eps, mode)
Normalize the input array using the L2 norm.
For 1-D NDArray, it computes::
out = data / sqrt(sum(data ** 2) + eps)
For N-D NDArray, if the input array has shape (N, N, ..., N),
with $mode$ = $instance$, it normalizes each instance in the multidimensional array by its L2 norm.::
for i in 0...N out[i,:,:,...,:] = data[i,:,:,...,:] / sqrt(sum(data[i,:,:,...,:] ** 2) + eps)
with $mode$ = $channel$, it normalizes each channel in the array by its L2 norm.::
for i in 0...N out[:,i,:,...,:] = data[:,i,:,...,:] / sqrt(sum(data[:,i,:,...,:] ** 2) + eps)
with $mode$ = $spatial$, it normalizes the cross channel norm for each position in the array by its L2 norm.::
for dim in 2...N for i in 0...N out[.....,i,...] = take(out, indices=i, axis=dim) / sqrt(sum(take(out, indices=i, axis=dim) ** 2) + eps) -dim-
Example::
x = [[[1,2], [3,4]], [[2,2], [5,6]]]
L2Normalization(x, mode='instance') =[[[ 0.18257418 0.36514837] [ 0.54772252 0.73029673]] [[ 0.24077171 0.24077171] [ 0.60192931 0.72231513]]]
L2Normalization(x, mode='channel') =[[[ 0.31622776 0.44721359] [ 0.94868326 0.89442718]] [[ 0.37139067 0.31622776] [ 0.92847669 0.94868326]]]
L2Normalization(x, mode='spatial') =[[[ 0.44721359 0.89442718] [ 0.60000002 0.80000001]] [[ 0.70710677 0.70710677] [ 0.6401844 0.76822126]]]
Defined in src/operator/l2_normalization.cc:L195
Arguments
data::NDArray-or-SymbolicNode
: Input array to normalize.eps::float, optional, default=1.00000001e-10
: A small constant for numerical stability.mode::{'channel', 'instance', 'spatial'},optional, default='instance'
: Specify the dimension along which to compute L2 norm.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.LRN
— Method.
LRN(data, alpha, beta, knorm, nsize)
Applies local response normalization to the input.
The local response normalization layer performs "lateral inhibition" by normalizing over local input regions.
If :math:a_{x,y}^{i}
is the activity of a neuron computed by applying kernel :math:i
at position :math:(x, y)
and then applying the ReLU nonlinearity, the response-normalized activity :math:b_{x,y}^{i}
is given by the expression:
.. math:: b{x,y}^{i} = \frac{a^{i}}{\Bigg({k + \frac{\alpha}{n} \sum{j=max(0, i-\frac{n}{2})}^{min(N-1, i+\frac{n}{2})} (a^{j})^{2}}\Bigg)^{\beta}}
where the sum runs over :math:n
"adjacent" kernel maps at the same spatial position, and :math:N
is the total number of kernels in the layer.
Defined in src/operator/nn/lrn.cc:L157
Arguments
data::NDArray-or-SymbolicNode
: Input data to LRNalpha::float, optional, default=9.99999975e-05
: The variance scaling parameter :math:lpha
in the LRN expression.beta::float, optional, default=0.75
: The power parameter :math:eta
in the LRN expression.knorm::float, optional, default=2
: The parameter :math:k
in the LRN expression.nsize::int (non-negative), required
: normalization window width in elements.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.LayerNorm
— Method.
LayerNorm(data, gamma, beta, axis, eps, output_mean_var)
Layer normalization.
Normalizes the channels of the input tensor by mean and variance, and applies a scale $gamma$ as well as offset $beta$.
Assume the input has more than one dimension and we normalize along axis 1. We first compute the mean and variance along this axis and then compute the normalized output, which has the same shape as input, as following:
.. math::
out = \frac{data - mean(data, axis)}{\sqrt{var(data, axis) + \epsilon}} * gamma + beta
Both $gamma$ and $beta$ are learnable parameters.
Unlike BatchNorm and InstanceNorm, the mean and var are computed along the channel dimension.
Assume the input has size k on axis 1, then both $gamma$ and $beta$ have shape (k,). If $output_mean_var$ is set to be true, then outputs both $data_mean$ and $data_std$. Note that no gradient will be passed through these two outputs.
The parameter $axis$ specifies which axis of the input shape denotes the 'channel' (separately normalized groups). The default is -1, which sets the channel axis to be the last item in the input shape.
Defined in src/operator/nn/layer_norm.cc:L201
Arguments
data::NDArray-or-SymbolicNode
: Input data to layer normalizationgamma::NDArray-or-SymbolicNode
: gamma arraybeta::NDArray-or-SymbolicNode
: beta arrayaxis::int, optional, default='-1'
: The axis to perform layer normalization. Usually, this should be be axis of the channel dimension. Negative values means indexing from right to left.eps::float, optional, default=9.99999975e-06
: Anepsilon
parameter to prevent division by 0.output_mean_var::boolean, optional, default=0
: Output the mean and std calculated along the given axis.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.LeakyReLU
— Method.
LeakyReLU(data, gamma, act_type, slope, lower_bound, upper_bound)
Applies Leaky rectified linear unit activation element-wise to the input.
Leaky ReLUs attempt to fix the "dying ReLU" problem by allowing a small slope
when the input is negative and has a slope of one when input is positive.
The following modified ReLU Activation functions are supported:
- elu: Exponential Linear Unit.
y = x > 0 ? x : slope * (exp(x)-1)
- selu: Scaled Exponential Linear Unit.
y = lambda * (x > 0 ? x : alpha * (exp(x) - 1))
where lambda = 1.0507009873554804934193349852946 and alpha = 1.6732632423543772848170429916717. - leaky: Leaky ReLU.
y = x > 0 ? x : slope * x
- prelu: Parametric ReLU. This is same as leaky except that
slope
is learnt during training. - rrelu: Randomized ReLU. same as leaky but the
slope
is uniformly and randomly chosen from [lowerbound, upperbound) for training, while fixed to be (lowerbound+upperbound)/2 for inference.
Defined in src/operator/leaky_relu.cc:L162
Arguments
data::NDArray-or-SymbolicNode
: Input data to activation function.gamma::NDArray-or-SymbolicNode
: Input data to activation function.act_type::{'elu', 'gelu', 'leaky', 'prelu', 'rrelu', 'selu'},optional, default='leaky'
: Activation function to be applied.slope::float, optional, default=0.25
: Init slope for the activation. (For leaky and elu only)lower_bound::float, optional, default=0.125
: Lower bound of random slope. (For rrelu only)upper_bound::float, optional, default=0.333999991
: Upper bound of random slope. (For rrelu only)name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.LinearRegressionOutput
— Method.
LinearRegressionOutput(data, label, grad_scale)
Computes and optimizes for squared loss during backward propagation. Just outputs $data$ during forward propagation.
If :math:\hat{y}_i
is the predicted value of the i-th sample, and :math:y_i
is the corresponding target value, then the squared loss estimated over :math:n
samples is defined as
:math:\text{SquaredLoss}(\textbf{Y}, \hat{\textbf{Y}} ) = \frac{1}{n} \sum_{i=0}^{n-1} \lVert \textbf{y}_i - \hat{\textbf{y}}_i \rVert_2
.. note:: Use the LinearRegressionOutput as the final output layer of a net.
The storage type of $label$ can be $default$ or $csr$
- LinearRegressionOutput(default, default) = default
- LinearRegressionOutput(default, csr) = default
By default, gradients of this loss function are scaled by factor 1/m
, where m is the number of regression outputs of a training example. The parameter grad_scale
can be used to change this scale to grad_scale/m
.
Defined in src/operator/regression_output.cc:L92
Arguments
data::NDArray-or-SymbolicNode
: Input data to the function.label::NDArray-or-SymbolicNode
: Input label to the function.grad_scale::float, optional, default=1
: Scale the gradient by a float factorname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.LogisticRegressionOutput
— Method.
LogisticRegressionOutput(data, label, grad_scale)
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 src/operator/regression_output.cc:L152
Arguments
data::NDArray-or-SymbolicNode
: Input data to the function.label::NDArray-or-SymbolicNode
: Input label to the function.grad_scale::float, optional, default=1
: Scale the gradient by a float factorname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.MAERegressionOutput
— Method.
MAERegressionOutput(data, label, grad_scale)
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 src/operator/regression_output.cc:L120
Arguments
data::NDArray-or-SymbolicNode
: Input data to the function.label::NDArray-or-SymbolicNode
: Input label to the function.grad_scale::float, optional, default=1
: Scale the gradient by a float factorname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.MakeLoss
— Method.
MakeLoss(data, grad_scale, valid_thresh, normalization)
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::
crossentropy = label * log(out) + (1 - label) * log(1 - out) loss = MakeLoss(crossentropy)
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 src/operator/make_loss.cc:L70
Arguments
data::NDArray-or-SymbolicNode
: Input array.grad_scale::float, optional, default=1
: Gradient scale as a supplement to unary and binary operatorsvalid_thresh::float, optional, default=0
: clip each element in the array to 0 when it is less than $valid_thresh$. This is used when $normalization$ is set to $'valid'$.normalization::{'batch', 'null', 'valid'},optional, default='null'
: 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.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Pad
— Method.
Pad(data, mode, pad_width, constant_value)
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", constantvalue=0, padwidth=(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 src/operator/pad.cc:L765
Arguments
data::NDArray-or-SymbolicNode
: An n-dimensional input array.mode::{'constant', 'edge', 'reflect'}, required
: Padding type to use. "constant" pads withconstant_value
"edge" pads using the edge values of the input array "reflect" pads by reflecting values with respect to the edges.pad_width::Shape(tuple), required
: 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 $(before_1, after_1, ... , before_N, after_N)$. It should be of length $2*N$ where $N$ is the number of dimensions of the array.This is equivalent to pad_width in numpy.pad, but flattened.constant_value::double, optional, default=0
: The value used for padding whenmode
is "constant".name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Pooling
— Method.
Pooling(data, kernel, pool_type, global_pool, cudnn_off, pooling_convention, stride, pad, p_value, count_include_pad, layout)
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),
outheight = f(height, kernel[0], pad[0], stride[0]) outwidth = 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
When $global_pool$ is set to be true, then global pooling is performed. It will reset $kernel=(height, width)$ and set the appropiate padding to 0.
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 src/operator/nn/pooling.cc:L416
Arguments
data::NDArray-or-SymbolicNode
: Input data to the pooling operator.kernel::Shape(tuple), optional, default=[]
: Pooling kernel size: (y, x) or (d, y, x)pool_type::{'avg', 'lp', 'max', 'sum'},optional, default='max'
: Pooling type to be applied.global_pool::boolean, optional, default=0
: Ignore kernel size, do global pooling based on current input feature map.cudnn_off::boolean, optional, default=0
: Turn off cudnn pooling and use MXNet pooling operator.pooling_convention::{'full', 'same', 'valid'},optional, default='valid'
: Pooling convention to be applied.stride::Shape(tuple), optional, default=[]
: Stride: for pooling (y, x) or (d, y, x). Defaults to 1 for each dimension.pad::Shape(tuple), optional, default=[]
: Pad for pooling: (y, x) or (d, y, x). Defaults to no padding.p_value::int or None, optional, default='None'
: Value of p for Lp pooling, can be 1 or 2, required for Lp Pooling.count_include_pad::boolean or None, optional, default=None
: 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.layout::{None, 'NCDHW', 'NCHW', 'NCW', 'NDHWC', 'NHWC', 'NWC'},optional, default='None'
: Set layout for input and output. Empty for default layout: NCW for 1d, NCHW for 2d and NCDHW for 3d.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Pooling_v1
— Method.
Pooling_v1(data, kernel, pool_type, global_pool, pooling_convention, stride, pad)
This operator is DEPRECATED. Perform pooling on the input.
The shapes for 2-D pooling is
- data: (batch_size, channel, height, width)
-
out: (batchsize, numfilter, outheight, outwidth), with::
outheight = f(height, kernel[0], pad[0], stride[0]) outwidth = 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 src/operator/pooling_v1.cc:L103
Arguments
data::NDArray-or-SymbolicNode
: Input data to the pooling operator.kernel::Shape(tuple), optional, default=[]
: pooling kernel size: (y, x) or (d, y, x)pool_type::{'avg', 'max', 'sum'},optional, default='max'
: Pooling type to be applied.global_pool::boolean, optional, default=0
: Ignore kernel size, do global pooling based on current input feature map.pooling_convention::{'full', 'valid'},optional, default='valid'
: Pooling convention to be applied.stride::Shape(tuple), optional, default=[]
: stride: for pooling (y, x) or (d, y, x)pad::Shape(tuple), optional, default=[]
: pad for pooling: (y, x) or (d, y, x)name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.RNN
— Method.
RNN(data, parameters, state, state_cell, sequence_length, state_size, num_layers, bidirectional, mode, p, state_outputs, projection_size, lstm_state_clip_min, lstm_state_clip_max, lstm_state_clip_nan, use_sequence_length)
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 MXNETCUDAALLOWTENSORCORE and MXNETCUDATENSOROPMATHALLOWCONVERSION 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:: ht = relu(W * xt + b + W{hh} * h + b_{hh})
With Tanh activtion function:
.. math:: ht = \tanh(W * xt + b + W{hh} * h + 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::
With the projection size being set, LSTM could use the projection feature to reduce the parameters size and give some speedups without significant damage to the accuracy.
Long Short-Term Memory Based Recurrent Neural Network Architectures for Large Vocabulary Speech Recognition - Sak et al. 2014. https://arxiv.org/abs/1402.1128
.. math::
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::
Defined in src/operator/rnn.cc:L375
Arguments
data::NDArray-or-SymbolicNode
: Input data to RNNparameters::NDArray-or-SymbolicNode
: Vector of all RNN trainable parameters concatenatedstate::NDArray-or-SymbolicNode
: initial hidden state of the RNNstate_cell::NDArray-or-SymbolicNode
: initial cell state for LSTM networks (only for LSTM)sequence_length::NDArray-or-SymbolicNode
: Vector of valid sequence lengths for each element in batch. (Only used if usesequencelength kwarg is True)state_size::int (non-negative), required
: size of the state for each layernum_layers::int (non-negative), required
: number of stacked layersbidirectional::boolean, optional, default=0
: whether to use bidirectional recurrent layersmode::{'gru', 'lstm', 'rnn_relu', 'rnn_tanh'}, required
: the type of RNN to computep::float, optional, default=0
: drop rate of the dropout on the outputs of each RNN layer, except the last layer.state_outputs::boolean, optional, default=0
: Whether to have the states as symbol outputs.projection_size::int or None, optional, default='None'
: size of project sizelstm_state_clip_min::double or None, optional, default=None
: Minimum clip value of LSTM states. This option must be used together with lstmstateclip_max.lstm_state_clip_max::double or None, optional, default=None
: Maximum clip value of LSTM states. This option must be used together with lstmstateclip_min.lstm_state_clip_nan::boolean, optional, default=0
: Whether to stop NaN from propagating in state by clipping it to min/max. If clipping range is not specified, this option is ignored.use_sequence_length::boolean, optional, default=0
: If set to true, this layer takes in an extra input parametersequence_length
to specify variable length sequencename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.ROIPooling
— Method.
ROIPooling(data, rois, pooled_size, spatial_scale)
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 src/operator/roi_pooling.cc:L224
Arguments
data::NDArray-or-SymbolicNode
: The input array to the pooling operator, a 4D Feature mapsrois::NDArray-or-SymbolicNode
: 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.batch*index
indicates the index of corresponding image in the input arraypooled_size::Shape(tuple), required
: ROI pooling output shape (h,w)spatial_scale::float, required
: Ratio of input feature map height (or w) to raw image height (or w). Equals the reciprocal of total stride in convolutional layersname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.SVMOutput
— Method.
SVMOutput(data, label, margin, regularization_coefficient, use_linear)
Computes support vector machine based transformation of the input.
This tutorial demonstrates using SVM as output layer for classification instead of softmax: https://github.com/apache/mxnet/tree/v1.x/example/svm_mnist.
Arguments
data::NDArray-or-SymbolicNode
: Input data for SVM transformation.label::NDArray-or-SymbolicNode
: Class label for the input data.margin::float, optional, default=1
: The loss function penalizes outputs that lie outside this margin. Default margin is 1.regularization_coefficient::float, optional, default=1
: Regularization parameter for the SVM. This balances the tradeoff between coefficient size and error.use_linear::boolean, optional, default=0
: Whether to use L1-SVM objective. L2-SVM objective is used by default.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.SequenceLast
— Method.
SequenceLast(data, sequence_length, use_sequence_length, axis)
Takes the last element of a sequence.
This function takes an n-dimensional input array of the form [maxsequencelength, batchsize, otherfeaturedims] and returns a (n-1)-dimensional array of the form [batchsize, otherfeaturedims].
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
toTrue
, 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.]]
// sequencelength is used SequenceLast(x, sequencelength=[1,1,1], usesequencelength=True) = [[ 1., 2., 3.], [ 4., 5., 6.], [ 7., 8., 9.]]
// sequencelength is used SequenceLast(x, sequencelength=[1,2,3], usesequencelength=True) = [[ 1., 2., 3.], [ 13., 14., 15.], [ 25., 26., 27.]]
Defined in src/operator/sequence_last.cc:L105
Arguments
data::NDArray-or-SymbolicNode
: n-dimensional input array of the form [maxsequencelength, batchsize, otherfeature_dims] where n>2sequence_length::NDArray-or-SymbolicNode
: vector of sequence lengths of the form [batch_size]use_sequence_length::boolean, optional, default=0
: If set to true, this layer takes in an extra input parametersequence_length
to specify variable length sequenceaxis::int, optional, default='0'
: The sequence axis. Only values of 0 and 1 are currently supported.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.SequenceMask
— Method.
SequenceMask(data, sequence_length, use_sequence_length, value, axis)
Sets all elements outside the sequence to a constant value.
This function takes an n-dimensional input array of the form [maxsequencelength, batchsize, otherfeature_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
toTrue
, otherwise each example in the batch is assumed to have the max sequence length and this operator works as theidentity
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.]]]
// sequencelength [1,1] means 1 of each batch will be kept // and other rows are masked with default mask value = 0 SequenceMask(x, sequencelength=[1,1], usesequencelength=True) = [[[ 1., 2., 3.], [ 4., 5., 6.]],
[[ 0., 0., 0.],
[ 0., 0., 0.]],
[[ 0., 0., 0.],
[ 0., 0., 0.]]]
// sequencelength [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, sequencelength=[2,3], usesequencelength=True, value=1) = [[[ 1., 2., 3.], [ 4., 5., 6.]],
[[ 7., 8., 9.],
[ 10., 11., 12.]],
[[ 1., 1., 1.],
[ 16., 17., 18.]]]
Defined in src/operator/sequence_mask.cc:L185
Arguments
data::NDArray-or-SymbolicNode
: n-dimensional input array of the form [maxsequencelength, batchsize, otherfeature_dims] where n>2sequence_length::NDArray-or-SymbolicNode
: vector of sequence lengths of the form [batch_size]use_sequence_length::boolean, optional, default=0
: If set to true, this layer takes in an extra input parametersequence_length
to specify variable length sequencevalue::float, optional, default=0
: The value to be used as a mask.axis::int, optional, default='0'
: The sequence axis. Only values of 0 and 1 are currently supported.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.SequenceReverse
— Method.
SequenceReverse(data, sequence_length, use_sequence_length, axis)
Reverses the elements of each sequence.
This function takes an n-dimensional input array of the form [maxsequencelength, batchsize, otherfeature_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
toTrue
, 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.]]]
// sequencelength [2,2] means 2 rows of // both batch B1 and B2 will be reversed. SequenceReverse(x, sequencelength=[2,2], usesequencelength=True) = [[[ 7., 8., 9.], [ 10., 11., 12.]],
[[ 1., 2., 3.],
[ 4., 5., 6.]],
[[ 13., 14., 15.],
[ 16., 17., 18.]]]
// sequencelength [2,3] means 2 of batch B2 and 3 of batch B3 // will be reversed. SequenceReverse(x, sequencelength=[2,3], usesequencelength=True) = [[[ 7., 8., 9.], [ 16., 17., 18.]],
[[ 1., 2., 3.],
[ 10., 11., 12.]],
[[ 13., 14, 15.],
[ 4., 5., 6.]]]
Defined in src/operator/sequence_reverse.cc:L121
Arguments
data::NDArray-or-SymbolicNode
: n-dimensional input array of the form [maxsequencelength, batch_size, other dims] where n>2sequence_length::NDArray-or-SymbolicNode
: vector of sequence lengths of the form [batch_size]use_sequence_length::boolean, optional, default=0
: If set to true, this layer takes in an extra input parametersequence_length
to specify variable length sequenceaxis::int, optional, default='0'
: The sequence axis. Only 0 is currently supported.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.SliceChannel
— Method.
SliceChannel(data, num_outputs, axis, squeeze_axis)
Splits an array along a particular axis into multiple sub-arrays.
.. note:: $SliceChannel$ is deprecated. Use $split$ instead.
Note that num_outputs
should evenly divide the length of the axis along which to split the array.
Example::
x = [[[ 1.] [ 2.]] [[ 3.] [ 4.]] [[ 5.] [ 6.]]] x.shape = (3, 2, 1)
y = split(x, axis=1, num_outputs=2) // a list of 2 arrays with shape (3, 1, 1) y = [[[ 1.]] [[ 3.]] [[ 5.]]]
[[[ 2.]]
[[ 4.]]
[[ 6.]]]
y[0].shape = (3, 1, 1)
z = split(x, axis=0, num_outputs=3) // a list of 3 arrays with shape (1, 2, 1) z = [[[ 1.] [ 2.]]]
[[[ 3.]
[ 4.]]]
[[[ 5.]
[ 6.]]]
z[0].shape = (1, 2, 1)
squeeze_axis=1
removes the axis with length 1 from the shapes of the output arrays. Note that setting squeeze_axis
to $1$ removes axis with length 1 only along the axis
which it is split. Also squeeze_axis
can be set to true only if $input.shape[axis] == num_outputs$.
Example::
z = split(x, axis=0, numoutputs=3, squeezeaxis=1) // a list of 3 arrays with shape (2, 1) z = [[ 1.] [ 2.]]
[[ 3.]
[ 4.]]
[[ 5.]
[ 6.]]
z[0].shape = (2 ,1 )
Defined in src/operator/slice_channel.cc:L106
Arguments
data::NDArray-or-SymbolicNode
: The inputnum_outputs::int, required
: Number of splits. Note that this should evenly divide the length of theaxis
.axis::int, optional, default='1'
: Axis along which to split.squeeze_axis::boolean, optional, default=0
: If true, Removes the axis with length 1 from the shapes of the output arrays. Note that settingsqueeze_axis
to $true$ removes axis with length 1 only along theaxis
which it is split. Alsosqueeze_axis
can be set to $true$ only if $input.shape[axis] == num_outputs$.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.Softmax
— Method.
Softmax(data, label, grad_scale, ignore_label, multi_output, use_ignore, preserve_shape, normalization, out_grad, smooth_alpha)
Softmax is an alias of SoftmaxOutput.
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(xi)}{\sumj exp(xj)} * Cross Entropy Function:
.. math:: \text{CE(label, output)} = - \sumi \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 parameterspreserve_shape
andmulti_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 softmaxoutput
has same shape aslabel
.Example::
data = [[1,2,3,4],[2,2,2,2],[3,3,3,3],[4,4,4,4]] label = [1,0,2,3] ignorelabel = 1 SoftmaxOutput(data=data, label = label, multioutput=true, useignore=true, ignorelabel=ignore_label)
forward softmax output
[[ 0.0320586 0.08714432 0.23688284 0.64391428] [ 0.25 0.25 0.25 0.25 ] [ 0.25 0.25 0.25 0.25 ] [ 0.25 0.25 0.25 0.25 ]]
backward gradient output
[[ 0. 0. 0. 0. ] [-0.75 0.25 0.25 0.25] [ 0.25 0.25 -0.75 0.25] [ 0.25 0.25 0.25 -0.75]]
notice that the first row is all 0 because label[0] is 1, which is equal to ignore_label.
* The parameter `grad_scale` can be used to rescale the gradient, which is often used to give each loss function different weights. * This operator also supports various ways to normalize the gradient by `normalization`, The `normalization` is applied if softmax output has different shape than the labels. The `normalization` mode can be set to the followings:
- $'null'$: do nothing.
- $'batch'$: divide the gradient by the batch size.
- $'valid'$: divide the gradient by the number of instances which are not ignored.
Defined in src/operator/softmax_output.cc:L242
Arguments
data::NDArray-or-SymbolicNode
: Input array.label::NDArray-or-SymbolicNode
: Ground truth label.grad_scale::float, optional, default=1
: Scales the gradient by a float factor.ignore_label::float, optional, default=-1
: The instances whoselabels
==ignore_label
will be ignored during backward, ifuse_ignore
is set to $true$).multi_output::boolean, optional, default=0
: If set to $true$, the softmax function will be computed along axis $1$. This is applied when the shape of input array differs from the shape of label array.use_ignore::boolean, optional, default=0
: If set to $true$, theignore_label
value will not contribute to the backward gradient.preserve_shape::boolean, optional, default=0
: If set to $true$, the softmax function will be computed along the last axis ($-1$).normalization::{'batch', 'null', 'valid'},optional, default='null'
: Normalizes the gradient.out_grad::boolean, optional, default=0
: Multiplies gradient with output gradient element-wise.smooth_alpha::float, optional, default=0
: Constant for computing a label smoothed version of cross-entropyfor the backwards pass. This constant gets subtracted from theone-hot encoding of the gold label and distributed uniformly toall other labels.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.SoftmaxActivation
— Method.
SoftmaxActivation(data, mode)
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::
inputarray = mx.nd.array([[3., 0.5, -0.5, 2., 7.], [2., -.4, 7., 3., 0.2]]) softmaxact = mx.nd.SoftmaxActivation(inputarray) print softmaxact.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 src/operator/nn/softmax_activation.cc:L58
Arguments
data::NDArray-or-SymbolicNode
: The input array.mode::{'channel', 'instance'},optional, default='instance'
: Specifies how to compute the softmax. If set to $instance$, it computes softmax for each instance. If set to $channel$, It computes cross channel softmax for each position of each instance.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.SoftmaxOutput
— Method.
SoftmaxOutput(data, label, grad_scale, ignore_label, multi_output, use_ignore, preserve_shape, normalization, out_grad, smooth_alpha)
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(xi)}{\sumj exp(xj)} * Cross Entropy Function:
.. math:: \text{CE(label, output)} = - \sumi \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 parameterspreserve_shape
andmulti_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 softmaxoutput
has same shape aslabel
.Example::
data = [[1,2,3,4],[2,2,2,2],[3,3,3,3],[4,4,4,4]] label = [1,0,2,3] ignorelabel = 1 SoftmaxOutput(data=data, label = label, multioutput=true, useignore=true, ignorelabel=ignore_label)
forward softmax output
[[ 0.0320586 0.08714432 0.23688284 0.64391428] [ 0.25 0.25 0.25 0.25 ] [ 0.25 0.25 0.25 0.25 ] [ 0.25 0.25 0.25 0.25 ]]
backward gradient output
[[ 0. 0. 0. 0. ] [-0.75 0.25 0.25 0.25] [ 0.25 0.25 -0.75 0.25] [ 0.25 0.25 0.25 -0.75]]
notice that the first row is all 0 because label[0] is 1, which is equal to ignore_label.
* The parameter `grad_scale` can be used to rescale the gradient, which is often used to give each loss function different weights. * This operator also supports various ways to normalize the gradient by `normalization`, The `normalization` is applied if softmax output has different shape than the labels. The `normalization` mode can be set to the followings:
- $'null'$: do nothing.
- $'batch'$: divide the gradient by the batch size.
- $'valid'$: divide the gradient by the number of instances which are not ignored.
Defined in src/operator/softmax_output.cc:L242
Arguments
data::NDArray-or-SymbolicNode
: Input array.label::NDArray-or-SymbolicNode
: Ground truth label.grad_scale::float, optional, default=1
: Scales the gradient by a float factor.ignore_label::float, optional, default=-1
: The instances whoselabels
==ignore_label
will be ignored during backward, ifuse_ignore
is set to $true$).multi_output::boolean, optional, default=0
: If set to $true$, the softmax function will be computed along axis $1$. This is applied when the shape of input array differs from the shape of label array.use_ignore::boolean, optional, default=0
: If set to $true$, theignore_label
value will not contribute to the backward gradient.preserve_shape::boolean, optional, default=0
: If set to $true$, the softmax function will be computed along the last axis ($-1$).normalization::{'batch', 'null', 'valid'},optional, default='null'
: Normalizes the gradient.out_grad::boolean, optional, default=0
: Multiplies gradient with output gradient element-wise.smooth_alpha::float, optional, default=0
: Constant for computing a label smoothed version of cross-entropyfor the backwards pass. This constant gets subtracted from theone-hot encoding of the gold label and distributed uniformly toall other labels.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.SpatialTransformer
— Method.
SpatialTransformer(data, loc, target_shape, transform_type, sampler_type, cudnn_off)
Applies a spatial transformer to input feature map.
Arguments
data::NDArray-or-SymbolicNode
: Input data to the SpatialTransformerOp.loc::NDArray-or-SymbolicNode
: localisation net, the output dim should be 6 when transform_type is affine. You shold initialize the weight and bias with identity tranform.target_shape::Shape(tuple), optional, default=[0,0]
: output shape(h, w) of spatial transformer: (y, x)transform_type::{'affine'}, required
: transformation typesampler_type::{'bilinear'}, required
: sampling typecudnn_off::boolean or None, optional, default=None
: whether to turn cudnn offname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.SwapAxis
— Method.
SwapAxis(data, dim1, dim2)
Interchanges two axes of an array.
Examples::
x = [[1, 2, 3]]) swapaxes(x, 0, 1) = [[ 1], [ 2], [ 3]]
x = [[[ 0, 1], [ 2, 3]], [[ 4, 5], [ 6, 7]]] // (2,2,2) array
swapaxes(x, 0, 2) = [[[ 0, 4], [ 2, 6]], [[ 1, 5], [ 3, 7]]]
Defined in src/operator/swapaxis.cc:L69
Arguments
data::NDArray-or-SymbolicNode
: Input array.dim1::int, optional, default='0'
: the first axis to be swapped.dim2::int, optional, default='0'
: the second axis to be swapped.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx.UpSampling
— Method.
UpSampling(data, scale, num_filter, sample_type, multi_input_mode, num_args, workspace)
Note: UpSampling takes variable number of positional inputs. So instead of calling as UpSampling([x, y, z], numargs=3), one should call via UpSampling(x, y, z), and numargs will be determined automatically.
Upsamples the given input data.
Two algorithms ($sample_type$) are available for upsampling:
- Nearest Neighbor
- Bilinear
Nearest Neighbor Upsampling
Input data is expected to be NCHW.
Example::
x = [[[[1. 1. 1.] [1. 1. 1.] [1. 1. 1.]]]]
UpSampling(x, scale=2, sample_type='nearest') = [[[[1. 1. 1. 1. 1. 1.] [1. 1. 1. 1. 1. 1.] [1. 1. 1. 1. 1. 1.] [1. 1. 1. 1. 1. 1.] [1. 1. 1. 1. 1. 1.] [1. 1. 1. 1. 1. 1.]]]]
Bilinear Upsampling
Uses deconvolution
algorithm under the hood. You need provide both input data and the kernel.
Input data is expected to be NCHW.
num_filter
is expected to be same as the number of channels.
Example::
x = [[[[1. 1. 1.] [1. 1. 1.] [1. 1. 1.]]]]
w = [[[[1. 1. 1. 1.] [1. 1. 1. 1.] [1. 1. 1. 1.] [1. 1. 1. 1.]]]]
UpSampling(x, w, scale=2, sampletype='bilinear', numfilter=1) = [[[[1. 2. 2. 2. 2. 1.] [2. 4. 4. 4. 4. 2.] [2. 4. 4. 4. 4. 2.] [2. 4. 4. 4. 4. 2.] [2. 4. 4. 4. 4. 2.] [1. 2. 2. 2. 2. 1.]]]]
Defined in src/operator/nn/upsampling.cc:L172
Arguments
data::NDArray-or-SymbolicNode[]
: Array of tensors to upsample. For bilinear upsampling, there should be 2 inputs - 1 data and 1 weight.scale::int, required
: Up sampling scalenum_filter::int, optional, default='0'
: Input filter. Only used by bilinear sampletype.Since bilinear upsampling uses deconvolution, numfilters is set to the number of channels.sample_type::{'bilinear', 'nearest'}, required
: upsampling methodmulti_input_mode::{'concat', 'sum'},optional, default='concat'
: How to handle multiple input. concat means concatenate upsampled images along the channel dimension. sum means add all images together, only available for nearest neighbor upsampling.num_args::int, required
: Number of inputs to be upsampled. For nearest neighbor upsampling, this can be 1-N; the size of output will be(scaleh_0,scalew_0) and all other inputs will be upsampled to thesame size. For bilinear upsampling this must be 2; 1 input and 1 weight.workspace::long (non-negative), optional, default=512
: Tmp workspace for deconvolution (MB)name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._CachedOp
— Method.
_CachedOp(data)
Arguments
data::NDArray-or-SymbolicNode[]
: input data listname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._CachedOpThreadSafe
— Method.
_CachedOpThreadSafe(data)
Arguments
data::NDArray-or-SymbolicNode[]
: input data listname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._CrossDeviceCopy
— Method.
_CrossDeviceCopy()
Special op to copy data cross device
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._CustomFunction
— Method.
_CustomFunction()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Div
— Method.
_Div(lhs, rhs)
Div is an alias of elemwisediv.
Divides arguments element-wise.
The storage type of $elemwise_div$ output is always dense
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._DivScalar
— Method.
_DivScalar(data, scalar, is_int)
DivScalar is an alias of _divscalar.
Divide an array with a scalar.
$_div_scalar$ only operates on data array of input if input is sparse.
For example, if input of shape (100, 100) has only 2 non zero elements, i.e. input.data = [5, 6], scalar = nan, it will result output.data = [nan, nan] instead of 10000 nans.
Defined in src/operator/tensor/elemwisebinaryscalaropbasic.cc:L174
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Equal
— Method.
_Equal(lhs, rhs)
_Equal is an alias of _equal.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._EqualScalar
— Method.
_EqualScalar(data, scalar, is_int)
EqualScalar is an alias of _equalscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Greater
— Method.
_Greater(lhs, rhs)
_Greater is an alias of _greater.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._GreaterEqualScalar
— Method.
_GreaterEqualScalar(data, scalar, is_int)
GreaterEqualScalar is an alias of _greaterequal_scalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._GreaterScalar
— Method.
_GreaterScalar(data, scalar, is_int)
GreaterScalar is an alias of _greaterscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Greater_Equal
— Method.
_Greater_Equal(lhs, rhs)
GreaterEqual is an alias of greaterequal.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Hypot
— Method.
_Hypot(lhs, rhs)
_Hypot is an alias of _hypot.
Given the "legs" of a right triangle, return its hypotenuse.
Defined in src/operator/tensor/elemwisebinaryop_extended.cc:L78
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._HypotScalar
— Method.
_HypotScalar(data, scalar, is_int)
HypotScalar is an alias of _hypotscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Lesser
— Method.
_Lesser(lhs, rhs)
_Lesser is an alias of _lesser.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._LesserEqualScalar
— Method.
_LesserEqualScalar(data, scalar, is_int)
LesserEqualScalar is an alias of _lesserequal_scalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._LesserScalar
— Method.
_LesserScalar(data, scalar, is_int)
LesserScalar is an alias of _lesserscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Lesser_Equal
— Method.
_Lesser_Equal(lhs, rhs)
LesserEqual is an alias of lesserequal.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._LogicalAndScalar
— Method.
_LogicalAndScalar(data, scalar, is_int)
LogicalAndScalar is an alias of _logicaland_scalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._LogicalOrScalar
— Method.
_LogicalOrScalar(data, scalar, is_int)
LogicalOrScalar is an alias of _logicalor_scalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._LogicalXorScalar
— Method.
_LogicalXorScalar(data, scalar, is_int)
LogicalXorScalar is an alias of _logicalxor_scalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Logical_And
— Method.
_Logical_And(lhs, rhs)
LogicalAnd is an alias of logicaland.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Logical_Or
— Method.
_Logical_Or(lhs, rhs)
LogicalOr is an alias of logicalor.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Logical_Xor
— Method.
_Logical_Xor(lhs, rhs)
LogicalXor is an alias of logicalxor.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Maximum
— Method.
_Maximum(lhs, rhs)
_Maximum is an alias of _maximum.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._MaximumScalar
— Method.
_MaximumScalar(data, scalar, is_int)
MaximumScalar is an alias of _maximumscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Minimum
— Method.
_Minimum(lhs, rhs)
_Minimum is an alias of _minimum.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._MinimumScalar
— Method.
_MinimumScalar(data, scalar, is_int)
MinimumScalar is an alias of _minimumscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Minus
— Method.
_Minus(lhs, rhs)
Minus is an alias of elemwisesub.
Subtracts arguments element-wise.
The storage type of $elemwise_sub$ output depends on storage types of inputs
- elemwisesub(rowsparse, rowsparse) = rowsparse
- elemwise_sub(csr, csr) = csr
- elemwise_sub(default, csr) = default
- elemwise_sub(csr, default) = default
- elemwise_sub(default, rsp) = default
- elemwise_sub(rsp, default) = default
- otherwise, $elemwise_sub$ generates output with default storage
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._MinusScalar
— Method.
_MinusScalar(data, scalar, is_int)
MinusScalar is an alias of _minusscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Mod
— Method.
_Mod(lhs, rhs)
_Mod is an alias of _mod.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._ModScalar
— Method.
_ModScalar(data, scalar, is_int)
ModScalar is an alias of _modscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Mul
— Method.
_Mul(lhs, rhs)
Mul is an alias of elemwisemul.
Multiplies arguments element-wise.
The storage type of $elemwise_mul$ output depends on storage types of inputs
- elemwise_mul(default, default) = default
- elemwisemul(rowsparse, rowsparse) = rowsparse
- elemwisemul(default, rowsparse) = row_sparse
- elemwisemul(rowsparse, default) = row_sparse
- elemwise_mul(csr, csr) = csr
- otherwise, $elemwise_mul$ generates output with default storage
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._MulScalar
— Method.
_MulScalar(data, scalar, is_int)
MulScalar is an alias of _mulscalar.
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 src/operator/tensor/elemwisebinaryscalaropbasic.cc:L152
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._NDArray
— Method.
_NDArray(data, info)
Stub for implementing an operator implemented in native frontend language with ndarray.
Arguments
data::NDArray-or-SymbolicNode[]
: Input data for the custom operator.info::ptr, required
:name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Native
— Method.
_Native(data, info, need_top_grad)
Stub for implementing an operator implemented in native frontend language.
Arguments
data::NDArray-or-SymbolicNode[]
: Input data for the custom operator.info::ptr, required
:need_top_grad::boolean, optional, default=1
: Whether this layer needs out grad for backward. Should be false for loss layers.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._NoGradient
— Method.
_NoGradient()
Place holder for variable who cannot perform gradient
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._NotEqualScalar
— Method.
_NotEqualScalar(data, scalar, is_int)
NotEqualScalar is an alias of _notequal_scalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Not_Equal
— Method.
_Not_Equal(lhs, rhs)
NotEqual is an alias of notequal.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Plus
— Method.
_Plus(lhs, rhs)
Plus is an alias of elemwiseadd.
Adds arguments element-wise.
The storage type of $elemwise_add$ output depends on storage types of inputs
- elemwiseadd(rowsparse, rowsparse) = rowsparse
- elemwise_add(csr, csr) = csr
- elemwise_add(default, csr) = default
- elemwise_add(csr, default) = default
- elemwise_add(default, rsp) = default
- elemwise_add(rsp, default) = default
- otherwise, $elemwise_add$ generates output with default storage
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._PlusScalar
— Method.
_PlusScalar(data, scalar, is_int)
PlusScalar is an alias of _plusscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._Power
— Method.
_Power(lhs, rhs)
_Power is an alias of _power.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._PowerScalar
— Method.
_PowerScalar(data, scalar, is_int)
PowerScalar is an alias of _powerscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._RDivScalar
— Method.
_RDivScalar(data, scalar, is_int)
RDivScalar is an alias of _rdivscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._RMinusScalar
— Method.
_RMinusScalar(data, scalar, is_int)
RMinusScalar is an alias of _rminusscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._RModScalar
— Method.
_RModScalar(data, scalar, is_int)
RModScalar is an alias of _rmodscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._RPowerScalar
— Method.
_RPowerScalar(data, scalar, is_int)
RPowerScalar is an alias of _rpowerscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._adamw_update
— Method.
_adamw_update(weight, grad, mean, var, rescale_grad, lr, beta1, beta2, epsilon, wd, eta, clip_gradient)
Update function for AdamW optimizer. AdamW is seen as a modification of Adam by decoupling the weight decay from the optimization steps taken w.r.t. the loss function.
Adam update consists of the following steps, where g represents gradient and m, v are 1st and 2nd order moment estimates (mean and variance).
.. math::
gt = \nabla J(W)\ mt = \beta1 m{t-1} + (1 - \beta1) gt\ vt = \beta2 v + (1 - \beta2) gt^2\ Wt = W - \etat (\alpha \frac{ mt }{ \sqrt{ vt } + \epsilon } + wd W)
It updates the weights using::
m = beta1m + (1-beta1)grad v = beta2v + (1-beta2)(grad**2) w -= eta * (learning_rate * m / (sqrt(v) + epsilon) + w * wd)
Note that gradient is rescaled to grad = rescalegrad * grad. If rescalegrad is NaN, Inf, or 0, the update is skipped.
Defined in src/operator/contrib/adamw.cc:L100
Arguments
weight::NDArray-or-SymbolicNode
: Weightgrad::NDArray-or-SymbolicNode
: Gradientmean::NDArray-or-SymbolicNode
: Moving meanvar::NDArray-or-SymbolicNode
: Moving variancerescale_grad::NDArray-or-SymbolicNode
: Rescale gradient to rescale_grad * grad. If NaN, Inf, or 0, the update is skipped.lr::float, required
: Learning ratebeta1::float, optional, default=0.899999976
: The decay rate for the 1st moment estimates.beta2::float, optional, default=0.999000013
: The decay rate for the 2nd moment estimates.epsilon::float, optional, default=9.99999994e-09
: A small constant for numerical stability.wd::float, optional, default=0
: Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.eta::float, required
: Learning rate schedule multiplierclip_gradient::float, optional, default=-1
: Clip gradient to the range of [-clipgradient, clipgradient] If clipgradient <= 0, gradient clipping is turned off. grad = max(min(grad, clipgradient), -clip_gradient).name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._add
— Method.
_add(lhs, rhs)
add is an alias of elemwiseadd.
Adds arguments element-wise.
The storage type of $elemwise_add$ output depends on storage types of inputs
- elemwiseadd(rowsparse, rowsparse) = rowsparse
- elemwise_add(csr, csr) = csr
- elemwise_add(default, csr) = default
- elemwise_add(csr, default) = default
- elemwise_add(default, rsp) = default
- elemwise_add(rsp, default) = default
- otherwise, $elemwise_add$ generates output with default storage
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._arange
— Method.
_arange(start, stop, step, repeat, infer_range, ctx, dtype)
Return evenly spaced values within a given interval. Similar to Numpy
Arguments
start::double, required
: Start of interval. The interval includes this value. The default start value is 0.stop::double or None, optional, default=None
: End of interval. The interval does not include this value, except in some cases where step is not an integer and floating point round-off affects the length of out.step::double, optional, default=1
: Spacing between values.repeat::int, optional, default='1'
: The repeating time of all elements. E.g repeat=3, the element a will be repeated three times –> a, a, a.infer_range::boolean, optional, default=0
: When set to True, infer the stop position from the start, step, repeat, and output tensor size.ctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Target data type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_Activation
— Method.
_backward_Activation()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_BatchNorm
— Method.
_backward_BatchNorm()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_BatchNorm_v1
— Method.
_backward_BatchNorm_v1()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_BilinearSampler
— Method.
_backward_BilinearSampler()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_CachedOp
— Method.
_backward_CachedOp()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_Concat
— Method.
_backward_Concat()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_Convolution
— Method.
_backward_Convolution()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_Convolution_v1
— Method.
_backward_Convolution_v1()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_Correlation
— Method.
_backward_Correlation()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_Crop
— Method.
_backward_Crop()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_Custom
— Method.
_backward_Custom()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_CustomFunction
— Method.
_backward_CustomFunction()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_Deconvolution
— Method.
_backward_Deconvolution()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_Dropout
— Method.
_backward_Dropout()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_Embedding
— Method.
_backward_Embedding()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_FullyConnected
— Method.
_backward_FullyConnected()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_GridGenerator
— Method.
_backward_GridGenerator()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_GroupNorm
— Method.
_backward_GroupNorm()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_IdentityAttachKLSparseReg
— Method.
_backward_IdentityAttachKLSparseReg()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_InstanceNorm
— Method.
_backward_InstanceNorm()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_L2Normalization
— Method.
_backward_L2Normalization()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_LRN
— Method.
_backward_LRN()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_LayerNorm
— Method.
_backward_LayerNorm()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_LeakyReLU
— Method.
_backward_LeakyReLU()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_MakeLoss
— Method.
_backward_MakeLoss()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_Pad
— Method.
_backward_Pad()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_Pooling
— Method.
_backward_Pooling()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_Pooling_v1
— Method.
_backward_Pooling_v1()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_RNN
— Method.
_backward_RNN()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_ROIAlign
— Method.
_backward_ROIAlign()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_ROIPooling
— Method.
_backward_ROIPooling()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_RROIAlign
— Method.
_backward_RROIAlign()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_SVMOutput
— Method.
_backward_SVMOutput()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_SequenceLast
— Method.
_backward_SequenceLast()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_SequenceMask
— Method.
_backward_SequenceMask()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_SequenceReverse
— Method.
_backward_SequenceReverse()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_SliceChannel
— Method.
_backward_SliceChannel()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_SoftmaxActivation
— Method.
_backward_SoftmaxActivation()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_SoftmaxOutput
— Method.
_backward_SoftmaxOutput()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_SparseEmbedding
— Method.
_backward_SparseEmbedding()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_SpatialTransformer
— Method.
_backward_SpatialTransformer()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_SwapAxis
— Method.
_backward_SwapAxis()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_UpSampling
— Method.
_backward_UpSampling()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__CrossDeviceCopy
— Method.
_backward__CrossDeviceCopy()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__NDArray
— Method.
_backward__NDArray()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__Native
— Method.
_backward__Native()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__contrib_DeformableConvolution
— Method.
_backward__contrib_DeformableConvolution()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__contrib_DeformablePSROIPooling
— Method.
_backward__contrib_DeformablePSROIPooling()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__contrib_ModulatedDeformableConvolution
— Method.
_backward__contrib_ModulatedDeformableConvolution()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__contrib_MultiBoxDetection
— Method.
_backward__contrib_MultiBoxDetection()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__contrib_MultiBoxPrior
— Method.
_backward__contrib_MultiBoxPrior()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__contrib_MultiBoxTarget
— Method.
_backward__contrib_MultiBoxTarget()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__contrib_MultiProposal
— Method.
_backward__contrib_MultiProposal()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__contrib_PSROIPooling
— Method.
_backward__contrib_PSROIPooling()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__contrib_Proposal
— Method.
_backward__contrib_Proposal()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__contrib_SyncBatchNorm
— Method.
_backward__contrib_SyncBatchNorm()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__contrib_count_sketch
— Method.
_backward__contrib_count_sketch()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__contrib_fft
— Method.
_backward__contrib_fft()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward__contrib_ifft
— Method.
_backward__contrib_ifft()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_abs
— Method.
_backward_abs(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_add
— Method.
_backward_add()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_amp_cast
— Method.
_backward_amp_cast()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_amp_multicast
— Method.
_backward_amp_multicast(grad, num_outputs, cast_narrow)
Arguments
grad::NDArray-or-SymbolicNode[]
: Gradientsnum_outputs::int, required
: Number of input/output pairs to be casted to the widest type.cast_narrow::boolean, optional, default=0
: Whether to cast to the narrowest typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_arccos
— Method.
_backward_arccos(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_arccosh
— Method.
_backward_arccosh(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_arcsin
— Method.
_backward_arcsin(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_arcsinh
— Method.
_backward_arcsinh(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_arctan
— Method.
_backward_arctan(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_arctanh
— Method.
_backward_arctanh(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_backward_FullyConnected
— Method.
_backward_backward_FullyConnected()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_add
— Method.
_backward_broadcast_add()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_div
— Method.
_backward_broadcast_div()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_exponential
— Method.
_backward_broadcast_exponential(scale, size, ctx)
Arguments
scale::float or None, optional, default=1
:size::Shape or None, optional, default=None
: Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.ctx::string, optional, default='cpu'
: Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_gumbel
— Method.
_backward_broadcast_gumbel(loc, scale, size, ctx)
Arguments
loc::float or None, required
:scale::float or None, required
:size::Shape or None, optional, default=None
: Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.ctx::string, optional, default='cpu'
: Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_hypot
— Method.
_backward_broadcast_hypot()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_logistic
— Method.
_backward_broadcast_logistic(loc, scale, size, ctx)
Arguments
loc::float or None, required
:scale::float or None, required
:size::Shape or None, optional, default=None
: Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.ctx::string, optional, default='cpu'
: Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_maximum
— Method.
_backward_broadcast_maximum()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_minimum
— Method.
_backward_broadcast_minimum()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_mod
— Method.
_backward_broadcast_mod()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_mul
— Method.
_backward_broadcast_mul()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_normal
— Method.
_backward_broadcast_normal(loc, scale, size, ctx, dtype)
Arguments
loc::float or None, required
:scale::float or None, required
:size::Shape or None, optional, default=None
: Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.ctx::string, optional, default='cpu'
: Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls.dtype::{'float16', 'float32', 'float64'},optional, default='float32'
: DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None).name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_pareto
— Method.
_backward_broadcast_pareto(a, size, ctx)
Arguments
a::float or None, optional, default=None
:size::Shape or None, optional, default=None
: Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.ctx::string, optional, default='cpu'
: Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_power
— Method.
_backward_broadcast_power()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_rayleigh
— Method.
_backward_broadcast_rayleigh(scale, size, ctx)
Arguments
scale::float or None, optional, default=1
:size::Shape or None, optional, default=None
: Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.ctx::string, optional, default='cpu'
: Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_sub
— Method.
_backward_broadcast_sub()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_broadcast_weibull
— Method.
_backward_broadcast_weibull(a, size, ctx)
Arguments
a::float or None, optional, default=None
:size::Shape or None, optional, default=None
: Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.ctx::string, optional, default='cpu'
: Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_cast
— Method.
_backward_cast()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_cbrt
— Method.
_backward_cbrt(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_clip
— Method.
_backward_clip()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_col2im
— Method.
_backward_col2im()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_cond
— Method.
_backward_cond()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_contrib_AdaptiveAvgPooling2D
— Method.
_backward_contrib_AdaptiveAvgPooling2D()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_contrib_BatchNormWithReLU
— Method.
_backward_contrib_BatchNormWithReLU()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_contrib_BilinearResize2D
— Method.
_backward_contrib_BilinearResize2D()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_contrib_bipartite_matching
— Method.
_backward_contrib_bipartite_matching(is_ascend, threshold, topk)
Arguments
is_ascend::boolean, optional, default=0
: Use ascend order for scores instead of descending. Please set threshold accordingly.threshold::float, required
: Ignore matching when score < thresh, if isascend=false, or ignore score > thresh, if isascend=true.topk::int, optional, default='-1'
: Limit the number of matches to topk, set -1 for no limitname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_contrib_boolean_mask
— Method.
_backward_contrib_boolean_mask(axis)
Arguments
axis::int, optional, default='0'
: An integer that represents the axis in NDArray to mask from.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_contrib_box_iou
— Method.
_backward_contrib_box_iou(format)
Arguments
format::{'center', 'corner'},optional, default='corner'
: The box encoding type.
"corner" means boxes are encoded as [xmin, ymin, xmax, ymax], "center" means boxes are encodes as [x, y, width, height].
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_contrib_box_nms
— Method.
_backward_contrib_box_nms(overlap_thresh, valid_thresh, topk, coord_start, score_index, id_index, background_id, force_suppress, in_format, out_format)
Arguments
overlap_thresh::float, optional, default=0.5
: Overlapping(IoU) threshold to suppress object with smaller score.valid_thresh::float, optional, default=0
: Filter input boxes to those whose scores greater than valid_thresh.topk::int, optional, default='-1'
: Apply nms to topk boxes with descending scores, -1 to no restriction.coord_start::int, optional, default='2'
: Start index of the consecutive 4 coordinates.score_index::int, optional, default='1'
: Index of the scores/confidence of boxes.id_index::int, optional, default='-1'
: Optional, index of the class categories, -1 to disable.background_id::int, optional, default='-1'
: Optional, id of the background class which will be ignored in nms.force_suppress::boolean, optional, default=0
: Optional, if set false and id_index is provided, nms will only apply to boxes belongs to the same categoryin_format::{'center', 'corner'},optional, default='corner'
: The input box encoding type.
"corner" means boxes are encoded as [xmin, ymin, xmax, ymax], "center" means boxes are encodes as [x, y, width, height].
out_format::{'center', 'corner'},optional, default='corner'
: The output box encoding type.
"corner" means boxes are encoded as [xmin, ymin, xmax, ymax], "center" means boxes are encodes as [x, y, width, height].
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_copy
— Method.
_backward_copy()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_cos
— Method.
_backward_cos(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_cosh
— Method.
_backward_cosh(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_ctc_loss
— Method.
_backward_ctc_loss()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_degrees
— Method.
_backward_degrees(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_diag
— Method.
_backward_diag()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_div
— Method.
_backward_div()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_div_scalar
— Method.
_backward_div_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_dot
— Method.
_backward_dot(transpose_a, transpose_b, forward_stype)
Arguments
transpose_a::boolean, optional, default=0
: If true then transpose the first input before dot.transpose_b::boolean, optional, default=0
: If true then transpose the second input before dot.forward_stype::{None, 'csr', 'default', 'row_sparse'},optional, default='None'
: The desired storage type of the forward output given by user, if thecombination of input storage types and this hint does not matchany implemented ones, the dot operator will perform fallback operationand still produce an output of the desired storage type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_erf
— Method.
_backward_erf(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_erfinv
— Method.
_backward_erfinv(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_expm1
— Method.
_backward_expm1(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_foreach
— Method.
_backward_foreach()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_gamma
— Method.
_backward_gamma(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_gammaln
— Method.
_backward_gammaln(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_gather_nd
— Method.
_backward_gather_nd(data, indices, shape)
Accumulates data according to indices and get the result. It's the backward of gather_nd
.
Given data
with shape (Y_0, ..., Y_{K-1}, X_M, ..., X_{N-1})
and indices with shape (M, Y_0, ..., Y_{K-1})
, the output will have shape (X_0, X_1, ..., X_{N-1})
, where M <= N
. If M == N
, data shape should simply be (Y_0, ..., Y_{K-1})
.
The elements in output is defined as follows::
output[indices[0, y0, ..., y], ..., indices[M-1, y0, ..., y], xM, ..., x] += data[y0, ..., y, xM, ..., x]
all other entries in output are 0 or the original value if AddTo is triggered.
Examples::
data = [2, 3, 0] indices = [[1, 1, 0], [0, 1, 0]] shape = (2, 2) backwardgathernd(data, indices, shape) = [[0, 0], [2, 3]] # Same as scatternd
The difference between scatternd and scatternd_acc is the latter will accumulate
the values that point to the same index.
data = [2, 3, 0] indices = [[1, 1, 0], [1, 1, 0]] shape = (2, 2) backwardgather_nd(data, indices, shape) = [[0, 0], [0, 5]]
Arguments
data::NDArray-or-SymbolicNode
: dataindices::NDArray-or-SymbolicNode
: indicesshape::Shape(tuple), required
: Shape of output.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_hard_sigmoid
— Method.
_backward_hard_sigmoid()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_hypot
— Method.
_backward_hypot()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_hypot_scalar
— Method.
_backward_hypot_scalar(lhs, rhs, scalar, is_int)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_im2col
— Method.
_backward_im2col()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_image_crop
— Method.
_backward_image_crop()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_image_normalize
— Method.
_backward_image_normalize()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_interleaved_matmul_encdec_qk
— Method.
_backward_interleaved_matmul_encdec_qk()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_interleaved_matmul_encdec_valatt
— Method.
_backward_interleaved_matmul_encdec_valatt()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_interleaved_matmul_selfatt_qk
— Method.
_backward_interleaved_matmul_selfatt_qk()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_interleaved_matmul_selfatt_valatt
— Method.
_backward_interleaved_matmul_selfatt_valatt()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_det
— Method.
_backward_linalg_det()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_extractdiag
— Method.
_backward_linalg_extractdiag()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_extracttrian
— Method.
_backward_linalg_extracttrian()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_gelqf
— Method.
_backward_linalg_gelqf()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_gemm
— Method.
_backward_linalg_gemm()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_gemm2
— Method.
_backward_linalg_gemm2()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_inverse
— Method.
_backward_linalg_inverse()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_makediag
— Method.
_backward_linalg_makediag()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_maketrian
— Method.
_backward_linalg_maketrian()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_potrf
— Method.
_backward_linalg_potrf()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_potri
— Method.
_backward_linalg_potri()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_slogdet
— Method.
_backward_linalg_slogdet()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_sumlogdiag
— Method.
_backward_linalg_sumlogdiag()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_syevd
— Method.
_backward_linalg_syevd()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_syrk
— Method.
_backward_linalg_syrk()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_trmm
— Method.
_backward_linalg_trmm()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linalg_trsm
— Method.
_backward_linalg_trsm()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_linear_reg_out
— Method.
_backward_linear_reg_out()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_log
— Method.
_backward_log(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_log10
— Method.
_backward_log10(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_log1p
— Method.
_backward_log1p(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_log2
— Method.
_backward_log2(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_log_softmax
— Method.
_backward_log_softmax(args)
Arguments
args::NDArray-or-SymbolicNode[]
: Positional input argumentsname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_logistic_reg_out
— Method.
_backward_logistic_reg_out()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_mae_reg_out
— Method.
_backward_mae_reg_out()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_max
— Method.
_backward_max()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_maximum
— Method.
_backward_maximum()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_maximum_scalar
— Method.
_backward_maximum_scalar(lhs, rhs, scalar, is_int)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_mean
— Method.
_backward_mean()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_min
— Method.
_backward_min()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_minimum
— Method.
_backward_minimum()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_minimum_scalar
— Method.
_backward_minimum_scalar(lhs, rhs, scalar, is_int)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_mod
— Method.
_backward_mod()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_mod_scalar
— Method.
_backward_mod_scalar(lhs, rhs, scalar, is_int)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_moments
— Method.
_backward_moments()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_mul
— Method.
_backward_mul()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_mul_scalar
— Method.
_backward_mul_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_nanprod
— Method.
_backward_nanprod()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_nansum
— Method.
_backward_nansum()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_norm
— Method.
_backward_norm()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_average
— Method.
_backward_np_average()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_broadcast_to
— Method.
_backward_np_broadcast_to()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_column_stack
— Method.
_backward_np_column_stack()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_concat
— Method.
_backward_np_concat()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_cumsum
— Method.
_backward_np_cumsum()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_diag
— Method.
_backward_np_diag()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_diagflat
— Method.
_backward_np_diagflat()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_diagonal
— Method.
_backward_np_diagonal()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_dot
— Method.
_backward_np_dot()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_dstack
— Method.
_backward_np_dstack()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_hstack
— Method.
_backward_np_hstack()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_matmul
— Method.
_backward_np_matmul()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_max
— Method.
_backward_np_max()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_mean
— Method.
_backward_np_mean()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_min
— Method.
_backward_np_min()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_prod
— Method.
_backward_np_prod()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_sum
— Method.
_backward_np_sum()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_trace
— Method.
_backward_np_trace()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_vstack
— Method.
_backward_np_vstack()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_where
— Method.
_backward_np_where()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_where_lscalar
— Method.
_backward_np_where_lscalar()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_np_where_rscalar
— Method.
_backward_np_where_rscalar()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_arctan2
— Method.
_backward_npi_arctan2()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_arctan2_scalar
— Method.
_backward_npi_arctan2_scalar(lhs, rhs, scalar, is_int)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_broadcast_add
— Method.
_backward_npi_broadcast_add()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_broadcast_div
— Method.
_backward_npi_broadcast_div()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_broadcast_mod
— Method.
_backward_npi_broadcast_mod()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_broadcast_mul
— Method.
_backward_npi_broadcast_mul()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_broadcast_power
— Method.
_backward_npi_broadcast_power()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_broadcast_sub
— Method.
_backward_npi_broadcast_sub()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_copysign
— Method.
_backward_npi_copysign()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_copysign_scalar
— Method.
_backward_npi_copysign_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_diff
— Method.
_backward_npi_diff()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_einsum
— Method.
_backward_npi_einsum()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_flip
— Method.
_backward_npi_flip()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_hypot
— Method.
_backward_npi_hypot()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_ldexp
— Method.
_backward_npi_ldexp()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_ldexp_scalar
— Method.
_backward_npi_ldexp_scalar(lhs, rhs, scalar, is_int)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_norm
— Method.
_backward_npi_norm()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_pad
— Method.
_backward_npi_pad()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_rarctan2_scalar
— Method.
_backward_npi_rarctan2_scalar(lhs, rhs, scalar, is_int)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_rcopysign_scalar
— Method.
_backward_npi_rcopysign_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_rldexp_scalar
— Method.
_backward_npi_rldexp_scalar(lhs, rhs, scalar, is_int)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_solve
— Method.
_backward_npi_solve()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_svd
— Method.
_backward_npi_svd()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_tensordot
— Method.
_backward_npi_tensordot()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_tensordot_int_axes
— Method.
_backward_npi_tensordot_int_axes()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_tensorinv
— Method.
_backward_npi_tensorinv()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_npi_tensorsolve
— Method.
_backward_npi_tensorsolve()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_pdf_dirichlet
— Method.
_backward_pdf_dirichlet()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_pdf_exponential
— Method.
_backward_pdf_exponential()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_pdf_gamma
— Method.
_backward_pdf_gamma()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_pdf_generalized_negative_binomial
— Method.
_backward_pdf_generalized_negative_binomial()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_pdf_negative_binomial
— Method.
_backward_pdf_negative_binomial()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_pdf_normal
— Method.
_backward_pdf_normal()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_pdf_poisson
— Method.
_backward_pdf_poisson()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_pdf_uniform
— Method.
_backward_pdf_uniform()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_pick
— Method.
_backward_pick()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_power
— Method.
_backward_power()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_power_scalar
— Method.
_backward_power_scalar(lhs, rhs, scalar, is_int)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_prod
— Method.
_backward_prod()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_radians
— Method.
_backward_radians(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_rcbrt
— Method.
_backward_rcbrt(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_rdiv_scalar
— Method.
_backward_rdiv_scalar(lhs, rhs, scalar, is_int)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_reciprocal
— Method.
_backward_reciprocal(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_relu
— Method.
_backward_relu(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_repeat
— Method.
_backward_repeat()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_reshape
— Method.
_backward_reshape()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_reverse
— Method.
_backward_reverse()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_rmod_scalar
— Method.
_backward_rmod_scalar(lhs, rhs, scalar, is_int)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_rpower_scalar
— Method.
_backward_rpower_scalar(lhs, rhs, scalar, is_int)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_rsqrt
— Method.
_backward_rsqrt(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_sample_multinomial
— Method.
_backward_sample_multinomial()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_sigmoid
— Method.
_backward_sigmoid(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_sign
— Method.
_backward_sign(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_sin
— Method.
_backward_sin(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_sinh
— Method.
_backward_sinh(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_slice
— Method.
_backward_slice()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_slice_axis
— Method.
_backward_slice_axis()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_slice_like
— Method.
_backward_slice_like()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_smooth_l1
— Method.
_backward_smooth_l1(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_softmax
— Method.
_backward_softmax(args)
Arguments
args::NDArray-or-SymbolicNode[]
: Positional input argumentsname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_softmax_cross_entropy
— Method.
_backward_softmax_cross_entropy()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_softmin
— Method.
_backward_softmin(args)
Arguments
args::NDArray-or-SymbolicNode[]
: Positional input argumentsname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_softsign
— Method.
_backward_softsign(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_sparse_retain
— Method.
_backward_sparse_retain()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_sqrt
— Method.
_backward_sqrt(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_square
— Method.
_backward_square(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_square_sum
— Method.
_backward_square_sum()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_squeeze
— Method.
_backward_squeeze()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_stack
— Method.
_backward_stack()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_sub
— Method.
_backward_sub()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_sum
— Method.
_backward_sum()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_take
— Method.
_backward_take()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_tan
— Method.
_backward_tan(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_tanh
— Method.
_backward_tanh(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_tile
— Method.
_backward_tile()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_topk
— Method.
_backward_topk()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_tril
— Method.
_backward_tril()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_where
— Method.
_backward_where()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._backward_while_loop
— Method.
_backward_while_loop()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._broadcast_backward
— Method.
_broadcast_backward()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._cond
— Method.
_cond(cond, then_branch, else_branch, data, num_args, num_outputs, cond_input_locs, then_input_locs, else_input_locs)
Note: cond takes variable number of positional inputs. So instead of calling as _cond([x, y, z], numargs=3), one should call via cond(x, y, z), and numargs will be determined automatically.
Run a if-then-else using user-defined condition and computation
From:src/operator/control_flow.cc:1212
Arguments
cond::SymbolicNode
: Input graph for the condition.then_branch::SymbolicNode
: Input graph for the then branch.else_branch::SymbolicNode
: Input graph for the else branch.data::NDArray-or-SymbolicNode[]
: The input arrays that include data arrays and states.num_args::int, required
: Number of input arguments, including cond, then and else as three symbol inputs.num_outputs::int, required
: The number of outputs of the subgraph.cond_input_locs::tuple of <long>, required
: The locations of cond's inputs in the given inputs.then_input_locs::tuple of <long>, required
: The locations of then's inputs in the given inputs.else_input_locs::tuple of <long>, required
: The locations of else's inputs in the given inputs.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_AdaptiveAvgPooling2D
— Method.
_contrib_AdaptiveAvgPooling2D(data, output_size)
Applies a 2D adaptive average pooling over a 4D input with the shape of (NCHW). The pooling kernel and stride sizes are automatically chosen for desired output sizes.
- If a single integer is provided for outputsize, the output size is (N x C x outputsize x output_size) for any input (NCHW).
- If a tuple of integers (height, width) are provided for output_size, the output size is (N x C x height x width) for any input (NCHW).
Defined in src/operator/contrib/adaptiveavgpooling.cc:L213
Arguments
data::NDArray-or-SymbolicNode
: Input dataoutput_size::Shape(tuple), optional, default=[]
: int (output size) or a tuple of int for output (height, width).name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_BatchNormWithReLU
— Method.
_contrib_BatchNormWithReLU(data, gamma, beta, moving_mean, moving_var, eps, momentum, fix_gamma, use_global_stats, output_mean_var, axis, cudnn_off, min_calib_range, max_calib_range)
Batch normalization with ReLU fusion.
An extented operator of Batch normalization which can fuse ReLU activation.
Defined in src/operator/contrib/batchnormrelu.cc:L249
Arguments
data::NDArray-or-SymbolicNode
: Input data to batch normalizationgamma::NDArray-or-SymbolicNode
: gamma arraybeta::NDArray-or-SymbolicNode
: beta arraymoving_mean::NDArray-or-SymbolicNode
: running mean of inputmoving_var::NDArray-or-SymbolicNode
: running variance of inputeps::double, optional, default=0.0010000000474974513
: Epsilon to prevent div 0. Must be no less than CUDNNBNMIN_EPSILON defined in cudnn.h when using cudnn (usually 1e-5)momentum::float, optional, default=0.899999976
: Momentum for moving averagefix_gamma::boolean, optional, default=1
: Fix gamma while traininguse_global_stats::boolean, optional, default=0
: Whether use global moving statistics instead of local batch-norm. This will force change batch-norm into a scale shift operator.output_mean_var::boolean, optional, default=0
: Output the mean and inverse stdaxis::int, optional, default='1'
: Specify which shape axis the channel is specifiedcudnn_off::boolean, optional, default=0
: Do not select CUDNN operator, if availablemin_calib_range::float or None, optional, default=None
: The minimum scalar value in the form of float32 obtained through calibration. If present, it will be used to by quantized batch norm op to calculate primitive scale.Note: this calib_range is to calib bn output.max_calib_range::float or None, optional, default=None
: The maximum scalar value in the form of float32 obtained through calibration. If present, it will be used to by quantized batch norm op to calculate primitive scale.Note: this calib_range is to calib bn output.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_BilinearResize2D
— Method.
_contrib_BilinearResize2D(data, like, height, width, scale_height, scale_width, mode, align_corners)
Perform 2D resizing (upsampling or downsampling) for 4D input using bilinear interpolation.
Expected input is a 4 dimensional NDArray (NCHW) and the output with the shape of (N x C x height x width). The key idea of bilinear interpolation is to perform linear interpolation first in one direction, and then again in the other direction. See the wikipedia of Bilinear interpolation <https://en.wikipedia.org/wiki/Bilinear_interpolation>
_ for more details.
Defined in src/operator/contrib/bilinear_resize.cc:L219
Arguments
data::NDArray-or-SymbolicNode
: Input datalike::NDArray-or-SymbolicNode
: Resize data to it's shapeheight::int, optional, default='1'
: output height (required, but ignored if scale_height is defined or mode is not "size")width::int, optional, default='1'
: output width (required, but ignored if scale_width is defined or mode is not "size")scale_height::float or None, optional, default=None
: sampling scale of the height (optional, used in modes "scale" and "odd_scale")scale_width::float or None, optional, default=None
: sampling scale of the width (optional, used in modes "scale" and "odd_scale")mode::{'like', 'odd_scale', 'size', 'to_even_down', 'to_even_up', 'to_odd_down', 'to_odd_up'},optional, default='size'
: resizing mode. "simple" - output height equals parameter "height" if "scaleheight" parameter is not defined or input height multiplied by "scaleheight" otherwise. Same for width;"oddscale" - if original height or width is odd, then result height is calculated like resulth = (originalh - 1) * scale + 1; for scale > 1 the result shape would be like if we did deconvolution with kernel = (1, 1) and stride = (heightscale, widthscale); and for scale < 1 shape would be like we did convolution with kernel = (1, 1) and stride = (int(1 / heightscale), int( 1/ widthscale);"like" - resize first input to the height and width of second input; "toevendown" - resize input to nearest lower even height and width (if original height is odd then result height = original height - 1);"toevenup" - resize input to nearest bigger even height and width (if original height is odd then result height = original height + 1);"toodddown" - resize input to nearest odd height and width (if original height is odd then result height = original height - 1);"toodd_up" - resize input to nearest odd height and width (if original height is odd then result height = original height + 1);align_corners::boolean, optional, default=1
: With align_corners = True, the interpolating doesn't proportionally align theoutput and input pixels, and thus the output values can depend on the input size.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_CTCLoss
— Method.
_contrib_CTCLoss(data, label, data_lengths, label_lengths, use_data_lengths, use_label_lengths, blank_label)
contribCTCLoss is an alias of CTCLoss.
Connectionist Temporal Classification Loss.
.. note:: The existing alias $contrib_CTCLoss$ is deprecated.
The shapes of the inputs and outputs:
- data:
(sequence_length, batch_size, alphabet_size)
- label:
(batch_size, label_sequence_length)
- out:
(batch_size)
The data
tensor consists of sequences of activation vectors (without applying softmax), with i-th channel in the last dimension corresponding to i-th label for i between 0 and alphabet*size-1 (i.e always 0-indexed). Alphabet size should include one additional value reserved for blank label. When blank*label
is"first"
, the0
-th channel is be reserved for activation of blank label, or otherwise if it is "last",(alphabet_size-1)
-th channel should be reserved for blank label.
$label$ is an index matrix of integers. When blank_label
is $"first"$, the value 0 is then reserved for blank label, and should not be passed in this matrix. Otherwise, when blank_label
is $"last"$, the value (alphabet_size-1)
is reserved for blank label.
If a sequence of labels is shorter than labelsequencelength, use the special padding value at the end of the sequence to conform it to the correct length. The padding value is 0
when blank_label
is $"first"$, and -1
otherwise.
For example, suppose the vocabulary is [a, b, c]
, and in one batch we have three sequences 'ba', 'cbb', and 'abac'. When blank_label
is $"first"$, we can index the labels as {'a': 1, 'b': 2, 'c': 3}
, and we reserve the 0-th channel for blank label in data tensor. The resulting label
tensor should be padded to be::
[[2, 1, 0, 0], [3, 2, 2, 0], [1, 2, 1, 3]]
When blank_label
is $"last"$, we can index the labels as {'a': 0, 'b': 1, 'c': 2}
, and we reserve the channel index 3 for blank label in data tensor. The resulting label
tensor should be padded to be::
[[1, 0, -1, -1], [2, 1, 1, -1], [0, 1, 0, 2]]
$out$ is a list of CTC loss values, one per example in the batch.
See Connectionist Temporal Classification: Labelling Unsegmented Sequence Data with Recurrent Neural Networks, A. Graves et al. for more information on the definition and the algorithm.
Defined in src/operator/nn/ctc_loss.cc:L100
Arguments
data::NDArray-or-SymbolicNode
: Input ndarraylabel::NDArray-or-SymbolicNode
: Ground-truth labels for the loss.data_lengths::NDArray-or-SymbolicNode
: Lengths of data for each of the samples. Only required when usedatalengths is true.label_lengths::NDArray-or-SymbolicNode
: Lengths of labels for each of the samples. Only required when uselabellengths is true.use_data_lengths::boolean, optional, default=0
: Whether the data lenghts are decided bydata_lengths
. If false, the lengths are equal to the max sequence length.use_label_lengths::boolean, optional, default=0
: Whether the label lenghts are decided bylabel_lengths
, or derived frompadding_mask
. If false, the lengths are derived from the first occurrence of the value ofpadding_mask
. The value ofpadding_mask
is $0$ when first CTC label is reserved for blank, and $-1$ when last label is reserved for blank. Seeblank_label
.blank_label::{'first', 'last'},optional, default='first'
: Set the label that is reserved for blank label.If "first", 0-th label is reserved, and label values for tokens in the vocabulary are between $1$ and $alphabet_size-1$, and the padding mask is $-1$. If "last", last label value $alphabet_size-1$ is reserved for blank label instead, and label values for tokens in the vocabulary are between $0$ and $alphabet_size-2$, and the padding mask is $0$.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_DeformableConvolution
— Method.
_contrib_DeformableConvolution(data, offset, weight, bias, kernel, stride, dilate, pad, num_filter, num_group, num_deformable_group, workspace, no_bias, layout)
Compute 2-D deformable convolution on 4-D input.
The deformable convolution operation is described in https://arxiv.org/abs/1703.06211
For 2-D deformable convolution, the shapes are
- data: (batch_size, channel, height, width)
- offset: (batchsize, numdeformable_group * kernel[0] * kernel[1] * 2, height, width)
- weight: (num_filter, channel, kernel[0], kernel[1])
- bias: (num_filter,)
- out: (batchsize, numfilter, outheight, outwidth).
Define::
f(x,k,p,s,d) = floor((x+2p-d(k-1)-1)/s)+1
then we have::
outheight=f(height, kernel[0], pad[0], stride[0], dilate[0]) outwidth=f(width, kernel[1], pad[1], stride[1], dilate[1])
If $no_bias$ is set to be true, then the $bias$ term is ignored.
The default data $layout$ is NCHW, namely (batch_size, channle, height, width).
If $num_group$ is larger than 1, denoted by g, then split the input $data$ evenly into g parts along the channel axis, and also evenly split $weight$ along the first dimension. Next compute the convolution on the i-th part of the data with the i-th weight part. The output is obtained by concating all the g results.
If $num_deformable_group$ is larger than 1, denoted by dg, then split the input $offset$ evenly into dg parts along the channel axis, and also evenly split $data$ into dg parts along the channel axis. Next compute the deformable convolution, apply the i-th part of the offset on the i-th part of the data.
Both $weight$ and $bias$ are learnable parameters.
Defined in src/operator/contrib/deformable_convolution.cc:L83
Arguments
data::NDArray-or-SymbolicNode
: Input data to the DeformableConvolutionOp.offset::NDArray-or-SymbolicNode
: Input offset to the DeformableConvolutionOp.weight::NDArray-or-SymbolicNode
: Weight matrix.bias::NDArray-or-SymbolicNode
: Bias parameter.kernel::Shape(tuple), required
: Convolution kernel size: (h, w) or (d, h, w)stride::Shape(tuple), optional, default=[]
: Convolution stride: (h, w) or (d, h, w). Defaults to 1 for each dimension.dilate::Shape(tuple), optional, default=[]
: Convolution dilate: (h, w) or (d, h, w). Defaults to 1 for each dimension.pad::Shape(tuple), optional, default=[]
: Zero pad for convolution: (h, w) or (d, h, w). Defaults to no padding.num_filter::int, required
: Convolution filter(channel) numbernum_group::int, optional, default='1'
: Number of group partitions.num_deformable_group::int, optional, default='1'
: Number of deformable group partitions.workspace::long (non-negative), optional, default=1024
: Maximum temperal workspace allowed for convolution (MB).no_bias::boolean, optional, default=0
: Whether to disable bias parameter.layout::{None, 'NCDHW', 'NCHW', 'NCW'},optional, default='None'
: Set layout for input, output and weight. Empty for default layout: NCW for 1d, NCHW for 2d and NCDHW for 3d.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_DeformablePSROIPooling
— Method.
_contrib_DeformablePSROIPooling(data, rois, trans, spatial_scale, output_dim, group_size, pooled_size, part_size, sample_per_part, trans_std, no_trans)
Performs deformable position-sensitive region-of-interest pooling on inputs. The DeformablePSROIPooling operation is described in https://arxiv.org/abs/1703.06211 .batch_size will change to the number of region bounding boxes after DeformablePSROIPooling
Arguments
data::SymbolicNode
: Input data to the pooling operator, a 4D Feature mapsrois::SymbolicNode
: Bounding box coordinates, a 2D array of [[batchindex, x1, y1, x2, y2]]. (x1, y1) and (x2, y2) are top left and down right corners of designated region of interest. batchindex indicates the index of corresponding image in the input datatrans::SymbolicNode
: transition parameterspatial_scale::float, required
: Ratio of input feature map height (or w) to raw image height (or w). Equals the reciprocal of total stride in convolutional layersoutput_dim::int, required
: fix output dimgroup_size::int, required
: fix group sizepooled_size::int, required
: fix pooled sizepart_size::int, optional, default='0'
: fix part sizesample_per_part::int, optional, default='1'
: fix samples per parttrans_std::float, optional, default=0
: fix transition stdno_trans::boolean, optional, default=0
: Whether to disable trans parameter.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_ModulatedDeformableConvolution
— Method.
_contrib_ModulatedDeformableConvolution(data, offset, mask, weight, bias, kernel, stride, dilate, pad, num_filter, num_group, num_deformable_group, workspace, no_bias, im2col_step, layout)
Compute 2-D modulated deformable convolution on 4-D input.
The modulated deformable convolution operation is described in https://arxiv.org/abs/1811.11168
For 2-D modulated deformable convolution, the shapes are
- data: (batch_size, channel, height, width)
- offset: (batchsize, numdeformable_group * kernel[0] * kernel[1] * 2, height, width)
- mask: (batchsize, numdeformable_group * kernel[0] * kernel[1], height, width)
- weight: (num_filter, channel, kernel[0], kernel[1])
- bias: (num_filter,)
- out: (batchsize, numfilter, outheight, outwidth).
Define::
f(x,k,p,s,d) = floor((x+2p-d(k-1)-1)/s)+1
then we have::
outheight=f(height, kernel[0], pad[0], stride[0], dilate[0]) outwidth=f(width, kernel[1], pad[1], stride[1], dilate[1])
If $no_bias$ is set to be true, then the $bias$ term is ignored.
The default data $layout$ is NCHW, namely (batch_size, channle, height, width).
If $num_group$ is larger than 1, denoted by g, then split the input $data$ evenly into g parts along the channel axis, and also evenly split $weight$ along the first dimension. Next compute the convolution on the i-th part of the data with the i-th weight part. The output is obtained by concating all the g results.
If $num_deformable_group$ is larger than 1, denoted by dg, then split the input $offset$ evenly into dg parts along the channel axis, and also evenly split $out$ evenly into dg parts along the channel axis. Next compute the deformable convolution, apply the i-th part of the offset part on the i-th out.
Both $weight$ and $bias$ are learnable parameters.
Defined in src/operator/contrib/modulateddeformableconvolution.cc:L83
Arguments
data::NDArray-or-SymbolicNode
: Input data to the ModulatedDeformableConvolutionOp.offset::NDArray-or-SymbolicNode
: Input offset to ModulatedDeformableConvolutionOp.mask::NDArray-or-SymbolicNode
: Input mask to the ModulatedDeformableConvolutionOp.weight::NDArray-or-SymbolicNode
: Weight matrix.bias::NDArray-or-SymbolicNode
: Bias parameter.kernel::Shape(tuple), required
: Convolution kernel size: (h, w) or (d, h, w)stride::Shape(tuple), optional, default=[]
: Convolution stride: (h, w) or (d, h, w). Defaults to 1 for each dimension.dilate::Shape(tuple), optional, default=[]
: Convolution dilate: (h, w) or (d, h, w). Defaults to 1 for each dimension.pad::Shape(tuple), optional, default=[]
: Zero pad for convolution: (h, w) or (d, h, w). Defaults to no padding.num_filter::int (non-negative), required
: Convolution filter(channel) numbernum_group::int (non-negative), optional, default=1
: Number of group partitions.num_deformable_group::int (non-negative), optional, default=1
: Number of deformable group partitions.workspace::long (non-negative), optional, default=1024
: Maximum temperal workspace allowed for convolution (MB).no_bias::boolean, optional, default=0
: Whether to disable bias parameter.im2col_step::int (non-negative), optional, default=64
: Maximum number of images per im2col computation; The total batch size should be divisable by this value or smaller than this value; if you face out of memory problem, you can try to use a smaller value here.layout::{None, 'NCDHW', 'NCHW', 'NCW'},optional, default='None'
: Set layout for input, output and weight. Empty for default layout: NCW for 1d, NCHW for 2d and NCDHW for 3d.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_MultiBoxDetection
— Method.
_contrib_MultiBoxDetection(cls_prob, loc_pred, anchor, clip, threshold, background_id, nms_threshold, force_suppress, variances, nms_topk)
Convert multibox detection predictions.
Arguments
cls_prob::NDArray-or-SymbolicNode
: Class probabilities.loc_pred::NDArray-or-SymbolicNode
: Location regression predictions.anchor::NDArray-or-SymbolicNode
: Multibox prior anchor boxesclip::boolean, optional, default=1
: Clip out-of-boundary boxes.threshold::float, optional, default=0.00999999978
: Threshold to be a positive prediction.background_id::int, optional, default='0'
: Background id.nms_threshold::float, optional, default=0.5
: Non-maximum suppression threshold.force_suppress::boolean, optional, default=0
: Suppress all detections regardless of class_id.variances::tuple of <float>, optional, default=[0.1,0.1,0.2,0.2]
: Variances to be decoded from box regression output.nms_topk::int, optional, default='-1'
: Keep maximum top k detections before nms, -1 for no limit.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_MultiBoxPrior
— Method.
_contrib_MultiBoxPrior(data, sizes, ratios, clip, steps, offsets)
Generate prior(anchor) boxes from data, sizes and ratios.
Arguments
data::NDArray-or-SymbolicNode
: Input data.sizes::tuple of <float>, optional, default=[1]
: List of sizes of generated MultiBoxPriores.ratios::tuple of <float>, optional, default=[1]
: List of aspect ratios of generated MultiBoxPriores.clip::boolean, optional, default=0
: Whether to clip out-of-boundary boxes.steps::tuple of <float>, optional, default=[-1,-1]
: Priorbox step across y and x, -1 for auto calculation.offsets::tuple of <float>, optional, default=[0.5,0.5]
: Priorbox center offsets, y and x respectivelyname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_MultiBoxTarget
— Method.
_contrib_MultiBoxTarget(anchor, label, cls_pred, overlap_threshold, ignore_label, negative_mining_ratio, negative_mining_thresh, minimum_negative_samples, variances)
Compute Multibox training targets
Arguments
anchor::NDArray-or-SymbolicNode
: Generated anchor boxes.label::NDArray-or-SymbolicNode
: Object detection labels.cls_pred::NDArray-or-SymbolicNode
: Class predictions.overlap_threshold::float, optional, default=0.5
: Anchor-GT overlap threshold to be regarded as a positive match.ignore_label::float, optional, default=-1
: Label for ignored anchors.negative_mining_ratio::float, optional, default=-1
: Max negative to positive samples ratio, use -1 to disable miningnegative_mining_thresh::float, optional, default=0.5
: Threshold used for negative mining.minimum_negative_samples::int, optional, default='0'
: Minimum number of negative samples.variances::tuple of <float>, optional, default=[0.1,0.1,0.2,0.2]
: Variances to be encoded in box regression target.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_MultiProposal
— Method.
_contrib_MultiProposal(cls_prob, bbox_pred, im_info, rpn_pre_nms_top_n, rpn_post_nms_top_n, threshold, rpn_min_size, scales, ratios, feature_stride, output_score, iou_loss)
Generate region proposals via RPN
Arguments
cls_prob::NDArray-or-SymbolicNode
: Score of how likely proposal is object.bbox_pred::NDArray-or-SymbolicNode
: BBox Predicted deltas from anchors for proposalsim_info::NDArray-or-SymbolicNode
: Image size and scale.rpn_pre_nms_top_n::int, optional, default='6000'
: Number of top scoring boxes to keep before applying NMS to RPN proposalsrpn_post_nms_top_n::int, optional, default='300'
: Number of top scoring boxes to keep after applying NMS to RPN proposalsthreshold::float, optional, default=0.699999988
: NMS value, below which to suppress.rpn_min_size::int, optional, default='16'
: Minimum height or width in proposalscales::tuple of <float>, optional, default=[4,8,16,32]
: Used to generate anchor windows by enumerating scalesratios::tuple of <float>, optional, default=[0.5,1,2]
: Used to generate anchor windows by enumerating ratiosfeature_stride::int, optional, default='16'
: The size of the receptive field each unit in the convolution layer of the rpn,for example the product of all stride's prior to this layer.output_score::boolean, optional, default=0
: Add score to outputsiou_loss::boolean, optional, default=0
: Usage of IoU Lossname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_PSROIPooling
— Method.
_contrib_PSROIPooling(data, rois, spatial_scale, output_dim, pooled_size, group_size)
Performs region-of-interest pooling on inputs. Resize bounding box coordinates by spatialscale and crop input feature maps accordingly. The cropped feature maps are pooled by max pooling to a fixed size output indicated by pooledsize. batch_size will change to the number of region bounding boxes after PSROIPooling
Arguments
data::SymbolicNode
: Input data to the pooling operator, a 4D Feature mapsrois::SymbolicNode
: Bounding box coordinates, a 2D array of [[batchindex, x1, y1, x2, y2]]. (x1, y1) and (x2, y2) are top left and down right corners of designated region of interest. batchindex indicates the index of corresponding image in the input dataspatial_scale::float, required
: Ratio of input feature map height (or w) to raw image height (or w). Equals the reciprocal of total stride in convolutional layersoutput_dim::int, required
: fix output dimpooled_size::int, required
: fix pooled sizegroup_size::int, optional, default='0'
: fix group sizename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_Proposal
— Method.
_contrib_Proposal(cls_prob, bbox_pred, im_info, rpn_pre_nms_top_n, rpn_post_nms_top_n, threshold, rpn_min_size, scales, ratios, feature_stride, output_score, iou_loss)
Generate region proposals via RPN
Arguments
cls_prob::NDArray-or-SymbolicNode
: Score of how likely proposal is object.bbox_pred::NDArray-or-SymbolicNode
: BBox Predicted deltas from anchors for proposalsim_info::NDArray-or-SymbolicNode
: Image size and scale.rpn_pre_nms_top_n::int, optional, default='6000'
: Number of top scoring boxes to keep before applying NMS to RPN proposalsrpn_post_nms_top_n::int, optional, default='300'
: Number of top scoring boxes to keep after applying NMS to RPN proposalsthreshold::float, optional, default=0.699999988
: NMS value, below which to suppress.rpn_min_size::int, optional, default='16'
: Minimum height or width in proposalscales::tuple of <float>, optional, default=[4,8,16,32]
: Used to generate anchor windows by enumerating scalesratios::tuple of <float>, optional, default=[0.5,1,2]
: Used to generate anchor windows by enumerating ratiosfeature_stride::int, optional, default='16'
: The size of the receptive field each unit in the convolution layer of the rpn,for example the product of all stride's prior to this layer.output_score::boolean, optional, default=0
: Add score to outputsiou_loss::boolean, optional, default=0
: Usage of IoU Lossname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_ROIAlign
— Method.
_contrib_ROIAlign(data, rois, pooled_size, spatial_scale, sample_ratio, position_sensitive, aligned)
This operator takes a 4D feature map as an input array and region proposals as rois
, then align the feature map over sub-regions of input and produces a fixed-sized output array. This operator is typically used in Faster R-CNN & Mask R-CNN networks. If roi batchid is less than 0, it will be ignored, and the corresponding output will be set to 0.
Different from ROI pooling, ROI Align removes the harsh quantization, properly aligning the extracted features with the input. RoIAlign computes the value of each sampling point by bilinear interpolation from the nearby grid points on the feature map. No quantization is performed on any coordinates involved in the RoI, its bins, or the sampling points. Bilinear interpolation is used to compute the exact values of the input features at four regularly sampled locations in each RoI bin. Then the feature map can be aggregated by avgpooling.
References
He, Kaiming, et al. "Mask R-CNN." ICCV, 2017
Defined in src/operator/contrib/roi_align.cc:L558
Arguments
data::NDArray-or-SymbolicNode
: Input data to the pooling operator, a 4D Feature mapsrois::NDArray-or-SymbolicNode
: Bounding box coordinates, a 2D array, if batchid is less than 0, it will be ignored.pooled_size::Shape(tuple), required
: ROI Align output roi feature map height and width: (h, w)spatial_scale::float, required
: Ratio of input feature map height (or w) to raw image height (or w). Equals the reciprocal of total stride in convolutional layerssample_ratio::int, optional, default='-1'
: Optional sampling ratio of ROI align, using adaptive size by default.position_sensitive::boolean, optional, default=0
: Whether to perform position-sensitive RoI pooling. PSRoIPooling is first proposaled by R-FCN and it can reduce the input channels by ph*pw times, where (ph, pw) is the pooled_sizealigned::boolean, optional, default=0
: Center-aligned ROIAlign introduced in Detectron2. To enable, set aligned to True.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_RROIAlign
— Method.
_contrib_RROIAlign(data, rois, pooled_size, spatial_scale, sampling_ratio)
Performs Rotated ROI Align on the input array.
This operator takes a 4D feature map as an input array and region proposals as rois
, then align the feature map over sub-regions of input and produces a fixed-sized output array.
Different from ROI Align, RROI Align uses rotated rois, which is suitable for text detection. RRoIAlign computes the value of each sampling point by bilinear interpolation from the nearby grid points on the rotated feature map. No quantization is performed on any coordinates involved in the RoI, its bins, or the sampling points. Bilinear interpolation is used to compute the exact values of the input features at four regularly sampled locations in each RoI bin. Then the feature map can be aggregated by avgpooling.
References
Ma, Jianqi, et al. "Arbitrary-Oriented Scene Text Detection via Rotation Proposals." IEEE Transactions on Multimedia, 2018.
Defined in src/operator/contrib/rroi_align.cc:L273
Arguments
data::NDArray-or-SymbolicNode
: Input data to the pooling operator, a 4D Feature mapsrois::NDArray-or-SymbolicNode
: Bounding box coordinates, a 2D arraypooled_size::Shape(tuple), required
: RROI align output shape (h,w)spatial_scale::float, required
: Ratio of input feature map height (or width) to raw image height (or width). Equals the reciprocal of total stride in convolutional layerssampling_ratio::int, optional, default='-1'
: Optional sampling ratio of RROI align, using adaptive size by default.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_SparseEmbedding
— Method.
_contrib_SparseEmbedding(data, weight, input_dim, output_dim, dtype, sparse_grad)
Maps integer indices to vector representations (embeddings).
note:: $contrib.SparseEmbedding$ is deprecated, use $Embedding$ instead.
This operator maps words to real-valued vectors in a high-dimensional space, called word embeddings. These embeddings can capture semantic and syntactic properties of the words. For example, it has been noted that in the learned embedding spaces, similar words tend to be close to each other and dissimilar words far apart.
For an input array of shape (d1, ..., dK), the shape of an output array is (d1, ..., dK, outputdim). All the input values should be integers in the range [0, inputdim).
If the inputdim is ip0 and outputdim is op0, then shape of the embedding weight matrix must be (ip0, op0).
The storage type of the gradient will be row_sparse
.
.. Note::
`SparseEmbedding` is designed for the use case where `input_dim` is very large (e.g. 100k).
The operator is available on both CPU and GPU.
When `deterministic` is set to `True`, the accumulation of gradients follows a
deterministic order if a feature appears multiple times in the input. However, the
accumulation is usually slower when the order is enforced on GPU.
When the operator is used on the GPU, the recommended value for `deterministic` is `True`.
Examples::
inputdim = 4 outputdim = 5
// Each row in weight matrix y represents a word. So, y = (w0,w1,w2,w3) y = [[ 0., 1., 2., 3., 4.], [ 5., 6., 7., 8., 9.], [ 10., 11., 12., 13., 14.], [ 15., 16., 17., 18., 19.]]
// Input array x represents n-grams(2-gram). So, x = [(w1,w3), (w0,w2)] x = [[ 1., 3.], [ 0., 2.]]
// Mapped input x to its vector representation y. SparseEmbedding(x, y, 4, 5) = [[[ 5., 6., 7., 8., 9.], [ 15., 16., 17., 18., 19.]],
[[ 0., 1., 2., 3., 4.],
[ 10., 11., 12., 13., 14.]]]
Defined in src/operator/tensor/indexing_op.cc:L674
Arguments
data::NDArray-or-SymbolicNode
: The input array to the embedding operator.weight::NDArray-or-SymbolicNode
: The embedding weight matrix.input_dim::int, required
: Vocabulary size of the input indices.output_dim::int, required
: Dimension of the embedding vectors.dtype::{'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Data type of weight.sparse_grad::boolean, optional, default=0
: Compute row sparse gradient in the backward calculation. If set to True, the grad's storage type is row_sparse.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_SyncBatchNorm
— Method.
_contrib_SyncBatchNorm(data, gamma, beta, moving_mean, moving_var, eps, momentum, fix_gamma, use_global_stats, output_mean_var, ndev, key)
Batch normalization.
Normalizes a data batch by mean and variance, and applies a scale $gamma$ as well as offset $beta$. Standard BN [1] implementation only normalize the data within each device. SyncBN normalizes the input within the whole mini-batch. We follow the sync-onece implmentation described in the paper [2].
Assume the input has more than one dimension and we normalize along axis 1. We first compute the mean and variance along this axis:
.. math::
data_mean[i] = mean(data[:,i,:,...]) \ data_var[i] = var(data[:,i,:,...])
Then compute the normalized output, which has the same shape as input, as following:
.. math::
out[:,i,:,...] = \frac{data[:,i,:,...] - data_mean[i]}{\sqrt{data_var[i]+\epsilon}} * gamma[i] + beta[i]
Both mean and var returns a scalar by treating the input as a vector.
Assume the input has size k on axis 1, then both $gamma$ and $beta$ have shape (k,). If $output_mean_var$ is set to be true, then outputs both $data_mean$ and $data_var$ as well, which are needed for the backward pass.
Besides the inputs and the outputs, this operator accepts two auxiliary states, $moving_mean$ and $moving_var$, which are k-length vectors. They are global statistics for the whole dataset, which are updated by::
movingmean = movingmean * momentum + datamean * (1 - momentum) movingvar = movingvar * momentum + datavar * (1 - momentum)
If $use_global_stats$ is set to be true, then $moving_mean$ and $moving_var$ are used instead of $data_mean$ and $data_var$ to compute the output. It is often used during inference.
Both $gamma$ and $beta$ are learnable parameters. But if $fix_gamma$ is true, then set $gamma$ to 1 and its gradient to 0.
Reference: .. [1] Ioffe, Sergey, and Christian Szegedy. "Batch normalization: Accelerating deep network training by reducing internal covariate shift." ICML 2015 .. [2] Hang Zhang, Kristin Dana, Jianping Shi, Zhongyue Zhang, Xiaogang Wang, Ambrish Tyagi, and Amit Agrawal. "Context Encoding for Semantic Segmentation." CVPR 2018
Defined in src/operator/contrib/syncbatchnorm.cc:L96
Arguments
data::NDArray-or-SymbolicNode
: Input data to batch normalizationgamma::NDArray-or-SymbolicNode
: gamma arraybeta::NDArray-or-SymbolicNode
: beta arraymoving_mean::NDArray-or-SymbolicNode
: running mean of inputmoving_var::NDArray-or-SymbolicNode
: running variance of inputeps::float, optional, default=0.00100000005
: Epsilon to prevent div 0momentum::float, optional, default=0.899999976
: Momentum for moving averagefix_gamma::boolean, optional, default=1
: Fix gamma while traininguse_global_stats::boolean, optional, default=0
: Whether use global moving statistics instead of local batch-norm. This will force change batch-norm into a scale shift operator.output_mean_var::boolean, optional, default=0
: Output All,normal mean and varndev::int, optional, default='1'
: The count of GPU deviceskey::string, required
: Hash key for synchronization, please set the same hash key for same layer, Block.prefix is typically used as in :class:gluon.nn.contrib.SyncBatchNorm
.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_allclose
— Method.
_contrib_allclose(a, b, rtol, atol, equal_nan)
This operators implements the numpy.allclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False)
.. math::
f(x) = |a−b|≤atol+rtol|b|
where :math:a, b
are the input tensors of equal types an shapes :math:atol, rtol
the values of absolute and relative tolerance (by default, rtol=1e-05, atol=1e-08)
Examples::
a = [1e10, 1e-7], b = [1.00001e10, 1e-8] y = allclose(a, b) y = False
a = [1e10, 1e-8], b = [1.00001e10, 1e-9] y = allclose(a, b) y = True
Defined in src/operator/contrib/allclose_op.cc:L55
Arguments
a::NDArray-or-SymbolicNode
: Input array ab::NDArray-or-SymbolicNode
: Input array brtol::float, optional, default=9.99999975e-06
: Relative tolerance.atol::float, optional, default=9.99999994e-09
: Absolute tolerance.equal_nan::boolean, optional, default=1
: Whether to compare NaN's as equal. If True, NaN's in A will be considered equal to NaN's in B in the output array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_arange_like
— Method.
_contrib_arange_like(data, start, step, repeat, ctx, axis)
Return an array with evenly spaced values. If axis is not given, the output will have the same shape as the input array. Otherwise, the output will be a 1-D array with size of the specified axis in input shape.
Examples::
x = [[0.14883883 0.7772398 0.94865847 0.7225052 ] [0.23729339 0.6112595 0.66538996 0.5132841 ] [0.30822644 0.9912457 0.15502319 0.7043658 ]]
out = mx.nd.contrib.arange_like(x, start=0)
[[ 0. 1. 2. 3.]
[ 4. 5. 6. 7.]
[ 8. 9. 10. 11.]]
<NDArray 3x4 @cpu(0)>
out = mx.nd.contrib.arange_like(x, start=0, axis=-1)
[0. 1. 2. 3.]
<NDArray 4 @cpu(0)>
Arguments
data::NDArray-or-SymbolicNode
: The inputstart::double, optional, default=0
: Start of interval. The interval includes this value. The default start value is 0.step::double, optional, default=1
: Spacing between values.repeat::int, optional, default='1'
: The repeating time of all elements. E.g repeat=3, the element a will be repeated three times –> a, a, a.ctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.axis::int or None, optional, default='None'
: Arange elements according to the size of a certain axis of input array. The negative numbers are interpreted counting from the backward. If not provided, will arange elements according to the input shape.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_backward_gradientmultiplier
— Method.
_contrib_backward_gradientmultiplier(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_backward_hawkesll
— Method.
_contrib_backward_hawkesll()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_backward_index_copy
— Method.
_contrib_backward_index_copy()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_backward_quadratic
— Method.
_contrib_backward_quadratic()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_bipartite_matching
— Method.
_contrib_bipartite_matching(data, is_ascend, threshold, topk)
Compute bipartite matching. The matching is performed on score matrix with shape [B, N, M]
- B: batch_size
- N: number of rows to match
- M: number of columns as reference to be matched against.
Returns: x : matched column indices. -1 indicating non-matched elements in rows. y : matched row indices.
Note::
Zero gradients are back-propagated in this op for now.
Example::
s = [[0.5, 0.6], [0.1, 0.2], [0.3, 0.4]]
x, y = bipartite_matching(x, threshold=1e-12, is_ascend=False)
x = [1, -1, 0]
y = [2, 0]
Defined in src/operator/contrib/bounding_box.cc:L182
Arguments
data::NDArray-or-SymbolicNode
: The inputis_ascend::boolean, optional, default=0
: Use ascend order for scores instead of descending. Please set threshold accordingly.threshold::float, required
: Ignore matching when score < thresh, if isascend=false, or ignore score > thresh, if isascend=true.topk::int, optional, default='-1'
: Limit the number of matches to topk, set -1 for no limitname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_boolean_mask
— Method.
_contrib_boolean_mask(data, index, axis)
Given an n-d NDArray data, and a 1-d NDArray index, the operator produces an un-predeterminable shaped n-d NDArray out, which stands for the rows in x where the corresonding element in index is non-zero.
data = mx.nd.array([[1, 2, 3],[4, 5, 6],[7, 8, 9]]) index = mx.nd.array([0, 1, 0]) out = mx.nd.contrib.boolean_mask(data, index) out
[[4. 5. 6.]]
Defined in src/operator/contrib/boolean_mask.cc:L195
Arguments
data::NDArray-or-SymbolicNode
: Dataindex::NDArray-or-SymbolicNode
: Maskaxis::int, optional, default='0'
: An integer that represents the axis in NDArray to mask from.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_box_decode
— Method.
_contrib_box_decode(data, anchors, std0, std1, std2, std3, clip, format)
Decode bounding boxes training target with normalized center offsets. Input bounding boxes are using corner type: x_{min}, y_{min}, x_{max}, y_{max}
or center type: `x, y, width, height.) array
Defined in src/operator/contrib/bounding_box.cc:L233
Arguments
data::NDArray-or-SymbolicNode
: (B, N, 4) predicted bbox offsetanchors::NDArray-or-SymbolicNode
: (1, N, 4) encoded in corner or centerstd0::float, optional, default=1
: value to be divided from the 1st encoded valuesstd1::float, optional, default=1
: value to be divided from the 2nd encoded valuesstd2::float, optional, default=1
: value to be divided from the 3rd encoded valuesstd3::float, optional, default=1
: value to be divided from the 4th encoded valuesclip::float, optional, default=-1
: If larger than 0, bounding box target will be clipped to this value.format::{'center', 'corner'},optional, default='center'
: The box encoding type.
"corner" means boxes are encoded as [xmin, ymin, xmax, ymax], "center" means boxes are encodes as [x, y, width, height].
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_box_encode
— Method.
_contrib_box_encode(samples, matches, anchors, refs, means, stds)
Encode bounding boxes training target with normalized center offsets. Input bounding boxes are using corner type: x_{min}, y_{min}, x_{max}, y_{max}
.) array
Defined in src/operator/contrib/bounding_box.cc:L210
Arguments
samples::NDArray-or-SymbolicNode
: (B, N) value +1 (positive), -1 (negative), 0 (ignore)matches::NDArray-or-SymbolicNode
: (B, N) value range [0, M)anchors::NDArray-or-SymbolicNode
: (B, N, 4) encoded in cornerrefs::NDArray-or-SymbolicNode
: (B, M, 4) encoded in cornermeans::NDArray-or-SymbolicNode
: (4,) Mean value to be subtracted from encoded valuesstds::NDArray-or-SymbolicNode
: (4,) Std value to be divided from encoded valuesname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_box_iou
— Method.
_contrib_box_iou(lhs, rhs, format)
Bounding box overlap of two arrays. The overlap is defined as Intersection-over-Union, aka, IOU.
- lhs: (a1, a2, ..., a_n, 4) array
- rhs: (b1, b2, ..., b_n, 4) array
- output: (a1, a2, ..., an, b1, b2, ..., bn) array
Note::
Zero gradients are back-propagated in this op for now.
Example::
x = [[0.5, 0.5, 1.0, 1.0], [0.0, 0.0, 0.5, 0.5]]
y = [[0.25, 0.25, 0.75, 0.75]]
box_iou(x, y, format='corner') = [[0.1428], [0.1428]]
Defined in src/operator/contrib/bounding_box.cc:L136
Arguments
lhs::NDArray-or-SymbolicNode
: The first inputrhs::NDArray-or-SymbolicNode
: The second inputformat::{'center', 'corner'},optional, default='corner'
: The box encoding type.
"corner" means boxes are encoded as [xmin, ymin, xmax, ymax], "center" means boxes are encodes as [x, y, width, height].
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_box_nms
— Method.
_contrib_box_nms(data, overlap_thresh, valid_thresh, topk, coord_start, score_index, id_index, background_id, force_suppress, in_format, out_format)
Apply non-maximum suppression to input.
The output will be sorted in descending order according to score
. Boxes with overlaps larger than overlap_thresh
, smaller scores and background boxes will be removed and filled with -1, the corresponding position will be recorded for backward propogation.
During back-propagation, the gradient will be copied to the original position according to the input index. For positions that have been suppressed, the in_grad will be assigned 0. In summary, gradients are sticked to its boxes, will either be moved or discarded according to its original index in input.
Input requirements::
- Input tensor have at least 2 dimensions, (n, k), any higher dims will be regarded
as batch, e.g. (a, b, c, d, n, k) == (abc*d, n, k)
- n is the number of boxes in each batch
- k is the width of each box item.
By default, a box is [id, score, xmin, ymin, xmax, ymax, ...], additional elements are allowed.
id_index
: optional, use -1 to ignore, useful ifforce_suppress=False
, which means we will skip highly overlapped boxes if one isapple
while the other iscar
.background_id
: optional, default=-1, class id for background boxes, useful whenid_index >= 0
which means boxes with background id will be filtered before nms.-
coord_start
: required, default=2, the starting index of the 4 coordinates. Two formats are supported:corner
: [xmin, ymin, xmax, ymax]center
: [x, y, width, height]score_index
: required, default=1, box score/confidence. When two boxes overlap IOU >overlap_thresh
, the one with smaller score will be suppressed.in_format
andout_format
: default='corner', specify in/out box formats.
Examples::
x = [[0, 0.5, 0.1, 0.1, 0.2, 0.2], [1, 0.4, 0.1, 0.1, 0.2, 0.2], [0, 0.3, 0.1, 0.1, 0.14, 0.14], [2, 0.6, 0.5, 0.5, 0.7, 0.8]] boxnms(x, overlapthresh=0.1, coordstart=2, scoreindex=1, idindex=0, forcesuppress=True, informat='corner', outtyp='corner') = [[2, 0.6, 0.5, 0.5, 0.7, 0.8], [0, 0.5, 0.1, 0.1, 0.2, 0.2], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1]] out_grad = [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1], [0.2, 0.2, 0.2, 0.2, 0.2, 0.2], [0.3, 0.3, 0.3, 0.3, 0.3, 0.3], [0.4, 0.4, 0.4, 0.4, 0.4, 0.4]]
exe.backward
in_grad = [[0.2, 0.2, 0.2, 0.2, 0.2, 0.2], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]
Defined in src/operator/contrib/bounding_box.cc:L94
Arguments
data::NDArray-or-SymbolicNode
: The inputoverlap_thresh::float, optional, default=0.5
: Overlapping(IoU) threshold to suppress object with smaller score.valid_thresh::float, optional, default=0
: Filter input boxes to those whose scores greater than valid_thresh.topk::int, optional, default='-1'
: Apply nms to topk boxes with descending scores, -1 to no restriction.coord_start::int, optional, default='2'
: Start index of the consecutive 4 coordinates.score_index::int, optional, default='1'
: Index of the scores/confidence of boxes.id_index::int, optional, default='-1'
: Optional, index of the class categories, -1 to disable.background_id::int, optional, default='-1'
: Optional, id of the background class which will be ignored in nms.force_suppress::boolean, optional, default=0
: Optional, if set false and id_index is provided, nms will only apply to boxes belongs to the same categoryin_format::{'center', 'corner'},optional, default='corner'
: The input box encoding type.
"corner" means boxes are encoded as [xmin, ymin, xmax, ymax], "center" means boxes are encodes as [x, y, width, height].
out_format::{'center', 'corner'},optional, default='corner'
: The output box encoding type.
"corner" means boxes are encoded as [xmin, ymin, xmax, ymax], "center" means boxes are encodes as [x, y, width, height].
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_box_non_maximum_suppression
— Method.
_contrib_box_non_maximum_suppression(data, overlap_thresh, valid_thresh, topk, coord_start, score_index, id_index, background_id, force_suppress, in_format, out_format)
contribboxnonmaximumsuppression is an alias of _contribbox_nms.
Apply non-maximum suppression to input.
The output will be sorted in descending order according to score
. Boxes with overlaps larger than overlap_thresh
, smaller scores and background boxes will be removed and filled with -1, the corresponding position will be recorded for backward propogation.
During back-propagation, the gradient will be copied to the original position according to the input index. For positions that have been suppressed, the in_grad will be assigned 0. In summary, gradients are sticked to its boxes, will either be moved or discarded according to its original index in input.
Input requirements::
- Input tensor have at least 2 dimensions, (n, k), any higher dims will be regarded
as batch, e.g. (a, b, c, d, n, k) == (abc*d, n, k)
- n is the number of boxes in each batch
- k is the width of each box item.
By default, a box is [id, score, xmin, ymin, xmax, ymax, ...], additional elements are allowed.
id_index
: optional, use -1 to ignore, useful ifforce_suppress=False
, which means we will skip highly overlapped boxes if one isapple
while the other iscar
.background_id
: optional, default=-1, class id for background boxes, useful whenid_index >= 0
which means boxes with background id will be filtered before nms.-
coord_start
: required, default=2, the starting index of the 4 coordinates. Two formats are supported:corner
: [xmin, ymin, xmax, ymax]center
: [x, y, width, height]score_index
: required, default=1, box score/confidence. When two boxes overlap IOU >overlap_thresh
, the one with smaller score will be suppressed.in_format
andout_format
: default='corner', specify in/out box formats.
Examples::
x = [[0, 0.5, 0.1, 0.1, 0.2, 0.2], [1, 0.4, 0.1, 0.1, 0.2, 0.2], [0, 0.3, 0.1, 0.1, 0.14, 0.14], [2, 0.6, 0.5, 0.5, 0.7, 0.8]] boxnms(x, overlapthresh=0.1, coordstart=2, scoreindex=1, idindex=0, forcesuppress=True, informat='corner', outtyp='corner') = [[2, 0.6, 0.5, 0.5, 0.7, 0.8], [0, 0.5, 0.1, 0.1, 0.2, 0.2], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1]] out_grad = [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1], [0.2, 0.2, 0.2, 0.2, 0.2, 0.2], [0.3, 0.3, 0.3, 0.3, 0.3, 0.3], [0.4, 0.4, 0.4, 0.4, 0.4, 0.4]]
exe.backward
in_grad = [[0.2, 0.2, 0.2, 0.2, 0.2, 0.2], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]
Defined in src/operator/contrib/bounding_box.cc:L94
Arguments
data::NDArray-or-SymbolicNode
: The inputoverlap_thresh::float, optional, default=0.5
: Overlapping(IoU) threshold to suppress object with smaller score.valid_thresh::float, optional, default=0
: Filter input boxes to those whose scores greater than valid_thresh.topk::int, optional, default='-1'
: Apply nms to topk boxes with descending scores, -1 to no restriction.coord_start::int, optional, default='2'
: Start index of the consecutive 4 coordinates.score_index::int, optional, default='1'
: Index of the scores/confidence of boxes.id_index::int, optional, default='-1'
: Optional, index of the class categories, -1 to disable.background_id::int, optional, default='-1'
: Optional, id of the background class which will be ignored in nms.force_suppress::boolean, optional, default=0
: Optional, if set false and id_index is provided, nms will only apply to boxes belongs to the same categoryin_format::{'center', 'corner'},optional, default='corner'
: The input box encoding type.
"corner" means boxes are encoded as [xmin, ymin, xmax, ymax], "center" means boxes are encodes as [x, y, width, height].
out_format::{'center', 'corner'},optional, default='corner'
: The output box encoding type.
"corner" means boxes are encoded as [xmin, ymin, xmax, ymax], "center" means boxes are encodes as [x, y, width, height].
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_calibrate_entropy
— Method.
_contrib_calibrate_entropy(hist, hist_edges, num_quantized_bins)
Provide calibrated min/max for input histogram.
.. Note:: This operator only supports forward propagation. DO NOT use it in training.
Defined in src/operator/quantization/calibrate.cc:L196
Arguments
hist::NDArray-or-SymbolicNode
: A ndarray/symbol of typefloat32
hist_edges::NDArray-or-SymbolicNode
: A ndarray/symbol of typefloat32
num_quantized_bins::int, optional, default='255'
: The number of quantized bins.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_count_sketch
— Method.
_contrib_count_sketch(data, h, s, out_dim, processing_batch_size)
Apply CountSketch to input: map a d-dimension data to k-dimension data"
.. note:: count_sketch
is only available on GPU.
Assume input data has shape (N, d), sign hash table s has shape (N, d), index hash table h has shape (N, d) and mapping dimension out_dim = k, each element in s is either +1 or -1, each element in h is random integer from 0 to k-1. Then the operator computs:
.. math:: out[h[i]] += data[i] * s[i]
Example::
outdim = 5 x = [[1.2, 2.5, 3.4],[3.2, 5.7, 6.6]] h = [[0, 3, 4]] s = [[1, -1, 1]] mx.contrib.ndarray.countsketch(data=x, h=h, s=s, out_dim = 5) = [[1.2, 0, 0, -2.5, 3.4], [3.2, 0, 0, -5.7, 6.6]]
Defined in src/operator/contrib/count_sketch.cc:L66
Arguments
data::NDArray-or-SymbolicNode
: Input data to the CountSketchOp.h::NDArray-or-SymbolicNode
: The index vectors::NDArray-or-SymbolicNode
: The sign vectorout_dim::int, required
: The output dimension.processing_batch_size::int, optional, default='32'
: How many sketch vectors to process at one time.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_ctc_loss
— Method.
_contrib_ctc_loss(data, label, data_lengths, label_lengths, use_data_lengths, use_label_lengths, blank_label)
contribctc_loss is an alias of CTCLoss.
Connectionist Temporal Classification Loss.
.. note:: The existing alias $contrib_CTCLoss$ is deprecated.
The shapes of the inputs and outputs:
- data:
(sequence_length, batch_size, alphabet_size)
- label:
(batch_size, label_sequence_length)
- out:
(batch_size)
The data
tensor consists of sequences of activation vectors (without applying softmax), with i-th channel in the last dimension corresponding to i-th label for i between 0 and alphabet*size-1 (i.e always 0-indexed). Alphabet size should include one additional value reserved for blank label. When blank*label
is"first"
, the0
-th channel is be reserved for activation of blank label, or otherwise if it is "last",(alphabet_size-1)
-th channel should be reserved for blank label.
$label$ is an index matrix of integers. When blank_label
is $"first"$, the value 0 is then reserved for blank label, and should not be passed in this matrix. Otherwise, when blank_label
is $"last"$, the value (alphabet_size-1)
is reserved for blank label.
If a sequence of labels is shorter than labelsequencelength, use the special padding value at the end of the sequence to conform it to the correct length. The padding value is 0
when blank_label
is $"first"$, and -1
otherwise.
For example, suppose the vocabulary is [a, b, c]
, and in one batch we have three sequences 'ba', 'cbb', and 'abac'. When blank_label
is $"first"$, we can index the labels as {'a': 1, 'b': 2, 'c': 3}
, and we reserve the 0-th channel for blank label in data tensor. The resulting label
tensor should be padded to be::
[[2, 1, 0, 0], [3, 2, 2, 0], [1, 2, 1, 3]]
When blank_label
is $"last"$, we can index the labels as {'a': 0, 'b': 1, 'c': 2}
, and we reserve the channel index 3 for blank label in data tensor. The resulting label
tensor should be padded to be::
[[1, 0, -1, -1], [2, 1, 1, -1], [0, 1, 0, 2]]
$out$ is a list of CTC loss values, one per example in the batch.
See Connectionist Temporal Classification: Labelling Unsegmented Sequence Data with Recurrent Neural Networks, A. Graves et al. for more information on the definition and the algorithm.
Defined in src/operator/nn/ctc_loss.cc:L100
Arguments
data::NDArray-or-SymbolicNode
: Input ndarraylabel::NDArray-or-SymbolicNode
: Ground-truth labels for the loss.data_lengths::NDArray-or-SymbolicNode
: Lengths of data for each of the samples. Only required when usedatalengths is true.label_lengths::NDArray-or-SymbolicNode
: Lengths of labels for each of the samples. Only required when uselabellengths is true.use_data_lengths::boolean, optional, default=0
: Whether the data lenghts are decided bydata_lengths
. If false, the lengths are equal to the max sequence length.use_label_lengths::boolean, optional, default=0
: Whether the label lenghts are decided bylabel_lengths
, or derived frompadding_mask
. If false, the lengths are derived from the first occurrence of the value ofpadding_mask
. The value ofpadding_mask
is $0$ when first CTC label is reserved for blank, and $-1$ when last label is reserved for blank. Seeblank_label
.blank_label::{'first', 'last'},optional, default='first'
: Set the label that is reserved for blank label.If "first", 0-th label is reserved, and label values for tokens in the vocabulary are between $1$ and $alphabet_size-1$, and the padding mask is $-1$. If "last", last label value $alphabet_size-1$ is reserved for blank label instead, and label values for tokens in the vocabulary are between $0$ and $alphabet_size-2$, and the padding mask is $0$.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_dequantize
— Method.
_contrib_dequantize(data, min_range, max_range, out_type)
Dequantize the input tensor into a float tensor. minrange and maxrange are scalar floats that specify the range for the output data.
When input data type is uint8
, the output is calculated using the following equation:
out[i] = in[i] * (max_range - min_range) / 255.0
,
When input data type is int8
, the output is calculate using the following equation by keep zero centered for the quantized value:
out[i] = in[i] * MaxAbs(min_range, max_range) / 127.0
,
.. Note:: This operator only supports forward propogation. DO NOT use it in training.
Defined in src/operator/quantization/dequantize.cc:L80
Arguments
data::NDArray-or-SymbolicNode
: A ndarray/symbol of typeuint8
min_range::NDArray-or-SymbolicNode
: The minimum scalar value possibly produced for the input in float32max_range::NDArray-or-SymbolicNode
: The maximum scalar value possibly produced for the input in float32out_type::{'float32'},optional, default='float32'
: Output data type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_dgl_adjacency
— Method.
_contrib_dgl_adjacency(data)
This operator converts a CSR matrix whose values are edge Ids to an adjacency matrix whose values are ones. The output CSR matrix always has the data value of float32.
Example:
.. code:: python
x = [[ 1, 0, 0 ], [ 0, 2, 0 ], [ 0, 0, 3 ]] dgl_adjacency(x) = [[ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ]]
Defined in src/operator/contrib/dgl_graph.cc:L1424
Arguments
data::NDArray-or-SymbolicNode
: Input ndarrayname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_dgl_csr_neighbor_non_uniform_sample
— Method.
_contrib_dgl_csr_neighbor_non_uniform_sample(csr_matrix, probability, seed_arrays, num_args, num_hops, num_neighbor, max_num_vertices)
Note: contribdglcsrneighbornonuniformsample takes variable number of positional inputs. So instead of calling as _contribdglcsrneighbornonuniformsample([x, y, z], numargs=3), one should call via contribdglcsrneighbornonuniformsample(x, y, z), and numargs will be determined automatically.
This operator samples sub-graph from a csr graph via an non-uniform probability. The operator is designed for DGL.
The operator outputs four sets of NDArrays to represent the sampled results (the number of NDArrays in each set is the same as the number of seed NDArrays minus two (csr matrix and probability)):
- a set of 1D NDArrays containing the sampled vertices, 2) a set of CSRNDArrays representing
the sampled edges, 3) a set of 1D NDArrays with the probability that vertices are sampled,
- a set of 1D NDArrays indicating the layer where a vertex is sampled.
The first set of 1D NDArrays have a length of maxnumvertices+1. The last element in an NDArray indicate the acutal number of vertices in a subgraph. The third and fourth set of NDArrays have a length of maxnumvertices, and the valid number of vertices is the same as the ones in the first set.
Example:
.. code:: python
shape = (5, 5) prob = mx.nd.array([0.9, 0.8, 0.2, 0.4, 0.1], dtype=np.float32) datanp = np.array([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], dtype=np.int64) indicesnp = np.array([1,2,3,4,0,2,3,4,0,1,3,4,0,1,2,4,0,1,2,3], dtype=np.int64) indptrnp = np.array([0,4,8,12,16,20], dtype=np.int64) a = mx.nd.sparse.csrmatrix((datanp, indicesnp, indptrnp), shape=shape) seed = mx.nd.array([0,1,2,3,4], dtype=np.int64) out = mx.nd.contrib.dglcsrneighbornonuniformsample(a, prob, seed, numargs=3, numhops=1, numneighbor=2, maxnum_vertices=5)
out[0] [0 1 2 3 4 5]
out[1].asnumpy() array([[ 0, 1, 2, 0, 0], [ 5, 0, 6, 0, 0], [ 9, 10, 0, 0, 0], [13, 14, 0, 0, 0], [ 0, 18, 19, 0, 0]])
out[2] [0.9 0.8 0.2 0.4 0.1]
out[3] [0 0 0 0 0]
Defined in src/operator/contrib/dgl_graph.cc:L911
Arguments
csr_matrix::NDArray-or-SymbolicNode
: csr matrixprobability::NDArray-or-SymbolicNode
: probability vectorseed_arrays::NDArray-or-SymbolicNode[]
: seed verticesnum_args::int, required
: Number of input NDArray.num_hops::long, optional, default=1
: Number of hops.num_neighbor::long, optional, default=2
: Number of neighbor.max_num_vertices::long, optional, default=100
: Max number of vertices.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_dgl_csr_neighbor_uniform_sample
— Method.
_contrib_dgl_csr_neighbor_uniform_sample(csr_matrix, seed_arrays, num_args, num_hops, num_neighbor, max_num_vertices)
Note: contribdglcsrneighboruniformsample takes variable number of positional inputs. So instead of calling as contribdglcsrneighboruniformsample([x, y, z], numargs=3), one should call via _contribdglcsrneighboruniformsample(x, y, z), and num_args will be determined automatically.
This operator samples sub-graphs from a csr graph via an uniform probability. The operator is designed for DGL.
The operator outputs three sets of NDArrays to represent the sampled results (the number of NDArrays in each set is the same as the number of seed NDArrays minus two (csr matrix and probability)):
- a set of 1D NDArrays containing the sampled vertices, 2) a set of CSRNDArrays representing
the sampled edges, 3) a set of 1D NDArrays indicating the layer where a vertex is sampled. The first set of 1D NDArrays have a length of maxnumvertices+1. The last element in an NDArray indicate the acutal number of vertices in a subgraph. The third set of NDArrays have a length of maxnumvertices, and the valid number of vertices is the same as the ones in the first set.
Example:
.. code:: python
shape = (5, 5) datanp = np.array([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], dtype=np.int64) indicesnp = np.array([1,2,3,4,0,2,3,4,0,1,3,4,0,1,2,4,0,1,2,3], dtype=np.int64) indptrnp = np.array([0,4,8,12,16,20], dtype=np.int64) a = mx.nd.sparse.csrmatrix((datanp, indicesnp, indptrnp), shape=shape) a.asnumpy() seed = mx.nd.array([0,1,2,3,4], dtype=np.int64) out = mx.nd.contrib.dglcsrneighboruniformsample(a, seed, numargs=2, numhops=1, numneighbor=2, maxnumvertices=5)
out[0] [0 1 2 3 4 5]
out[1].asnumpy() array([[ 0, 1, 0, 3, 0], [ 5, 0, 0, 7, 0], [ 9, 0, 0, 11, 0], [13, 0, 15, 0, 0], [17, 0, 19, 0, 0]])
out[2] [0 0 0 0 0]
Defined in src/operator/contrib/dgl_graph.cc:L801
Arguments
csr_matrix::NDArray-or-SymbolicNode
: csr matrixseed_arrays::NDArray-or-SymbolicNode[]
: seed verticesnum_args::int, required
: Number of input NDArray.num_hops::long, optional, default=1
: Number of hops.num_neighbor::long, optional, default=2
: Number of neighbor.max_num_vertices::long, optional, default=100
: Max number of vertices.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_dgl_graph_compact
— Method.
_contrib_dgl_graph_compact(graph_data, num_args, return_mapping, graph_sizes)
Note: contribdglgraphcompact takes variable number of positional inputs. So instead of calling as contribdglgraphcompact([x, y, z], numargs=3), one should call via _contribdglgraphcompact(x, y, z), and num_args will be determined automatically.
This operator compacts a CSR matrix generated by dglcsrneighboruniformsample and dglcsrneighbornonuniform_sample. The CSR matrices generated by these two operators may have many empty rows at the end and many empty columns. This operator removes these empty rows and empty columns.
Example:
.. code:: python
shape = (5, 5) datanp = np.array([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], dtype=np.int64) indicesnp = np.array([1,2,3,4,0,2,3,4,0,1,3,4,0,1,2,4,0,1,2,3], dtype=np.int64) indptrnp = np.array([0,4,8,12,16,20], dtype=np.int64) a = mx.nd.sparse.csrmatrix((datanp, indicesnp, indptrnp), shape=shape) seed = mx.nd.array([0,1,2,3,4], dtype=np.int64) out = mx.nd.contrib.dglcsrneighboruniformsample(a, seed, numargs=2, numhops=1, numneighbor=2, maxnumvertices=6) subgv = out[0] subg = out[1] compact = mx.nd.contrib.dglgraphcompact(subg, subgv, graphsizes=(subgv[-1].asnumpy()[0]), return_mapping=False)
compact.asnumpy() array([[0, 0, 0, 1, 0], [2, 0, 3, 0, 0], [0, 4, 0, 0, 5], [0, 6, 0, 0, 7], [8, 9, 0, 0, 0]])
Defined in src/operator/contrib/dgl_graph.cc:L1613
Arguments
graph_data::NDArray-or-SymbolicNode[]
: Input graphs and input vertex Ids.num_args::int, required
: Number of input arguments.return_mapping::boolean, required
: Return mapping of vid and eid between the subgraph and the parent graph.graph_sizes::tuple of <long>, required
: the number of vertices in each graph.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_dgl_subgraph
— Method.
_contrib_dgl_subgraph(graph, data, num_args, return_mapping)
Note: contribdglsubgraph takes variable number of positional inputs. So instead of calling as _contribdglsubgraph([x, y, z], numargs=3), one should call via contribdglsubgraph(x, y, z), and numargs will be determined automatically.
This operator constructs an induced subgraph for a given set of vertices from a graph. The operator accepts multiple sets of vertices as input. For each set of vertices, it returns a pair of CSR matrices if return_mapping is True: the first matrix contains edges with new edge Ids, the second matrix contains edges with the original edge Ids.
Example:
.. code:: python
x=[[1, 0, 0, 2],
[3, 0, 4, 0],
[0, 5, 0, 0],
[0, 6, 7, 0]]
v = [0, 1, 2]
dgl_subgraph(x, v, return_mapping=True) =
[[1, 0, 0],
[2, 0, 3],
[0, 4, 0]],
[[1, 0, 0],
[3, 0, 4],
[0, 5, 0]]
Defined in src/operator/contrib/dgl_graph.cc:L1171
Arguments
graph::NDArray-or-SymbolicNode
: Input graph where we sample vertices.data::NDArray-or-SymbolicNode[]
: The input arrays that include data arrays and states.num_args::int, required
: Number of input arguments, including all symbol inputs.return_mapping::boolean, required
: Return mapping of vid and eid between the subgraph and the parent graph.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_div_sqrt_dim
— Method.
_contrib_div_sqrt_dim(data)
Rescale the input by the square root of the channel dimension.
out = data / sqrt(data.shape[-1])
Defined in src/operator/contrib/transformer.cc:L832
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_edge_id
— Method.
_contrib_edge_id(data, u, v)
This operator implements the edge_id function for a graph stored in a CSR matrix (the value of the CSR stores the edge Id of the graph). output[i] = input[u[i], v[i]] if there is an edge between u[i] and v[i]], otherwise output[i] will be -1. Both u and v should be 1D vectors.
Example:
.. code:: python
x = [[ 1, 0, 0 ],
[ 0, 2, 0 ],
[ 0, 0, 3 ]]
u = [ 0, 0, 1, 1, 2, 2 ]
v = [ 0, 1, 1, 2, 0, 2 ]
edge_id(x, u, v) = [ 1, -1, 2, -1, -1, 3 ]
The storage type of $edge_id$ output depends on storage types of inputs
- edge_id(csr, default, default) = default
- default and rsp inputs are not supported
Defined in src/operator/contrib/dgl_graph.cc:L1352
Arguments
data::NDArray-or-SymbolicNode
: Input ndarrayu::NDArray-or-SymbolicNode
: u ndarrayv::NDArray-or-SymbolicNode
: v ndarrayname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_fft
— Method.
_contrib_fft(data, compute_size)
Apply 1D FFT to input"
.. note:: fft
is only available on GPU.
Currently accept 2 input data shapes: (N, d) or (N1, N2, N3, d), data can only be real numbers. The output data has shape: (N, 2d) or (N1, N2, N3, 2d). The format is: [real0, imag0, real1, imag1, ...].
Example::
data = np.random.normal(0,1,(3,4)) out = mx.contrib.ndarray.fft(data = mx.nd.array(data,ctx = mx.gpu(0)))
Defined in src/operator/contrib/fft.cc:L55
Arguments
data::NDArray-or-SymbolicNode
: Input data to the FFTOp.compute_size::int, optional, default='128'
: Maximum size of sub-batch to be forwarded at one timename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_getnnz
— Method.
_contrib_getnnz(data, axis)
Number of stored values for a sparse tensor, including explicit zeros.
This operator only supports CSR matrix on CPU.
Defined in src/operator/contrib/nnz.cc:L176
Arguments
data::NDArray-or-SymbolicNode
: Inputaxis::int or None, optional, default='None'
: Select between the number of values across the whole matrix, in each column, or in each row.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_gradientmultiplier
— Method.
_contrib_gradientmultiplier(data, scalar, is_int)
This operator implements the gradient multiplier function. In forward pass it acts as an identity transform. During backpropagation it multiplies the gradient from the subsequent level by a scalar factor lambda and passes it to the preceding layer.
Defined in src/operator/contrib/gradientmultiplierop.cc:L78
Arguments
data::NDArray-or-SymbolicNode
: The input array.scalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_group_adagrad_update
— Method.
_contrib_group_adagrad_update(weight, grad, history, lr, rescale_grad, clip_gradient, epsilon)
Update function for Group AdaGrad optimizer.
Referenced from Adaptive Subgradient Methods for Online Learning and Stochastic Optimization, and available at http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf but uses only a single learning rate for every row of the parameter array.
Updates are applied by::
grad = clip(grad * rescale_grad, clip_gradient)
history += mean(square(grad), axis=1, keepdims=True)
div = grad / sqrt(history + float_stable_eps)
weight -= div * lr
Weights are updated lazily if the gradient is sparse.
Note that non-zero values for the weight decay option are not supported.
Defined in src/operator/contrib/optimizer_op.cc:L70
Arguments
weight::NDArray-or-SymbolicNode
: Weightgrad::NDArray-or-SymbolicNode
: Gradienthistory::NDArray-or-SymbolicNode
: Historylr::float, required
: Learning raterescale_grad::float, optional, default=1
: Rescale gradient to grad = rescale_grad*grad.clip_gradient::float, optional, default=-1
: Clip gradient to the range of [-clipgradient, clipgradient] If clipgradient <= 0, gradient clipping is turned off. grad = max(min(grad, clipgradient), -clip_gradient).epsilon::float, optional, default=9.99999975e-06
: Epsilon for numerical stabilityname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_hawkesll
— Method.
_contrib_hawkesll(lda, alpha, beta, state, lags, marks, valid_length, max_time)
Computes the log likelihood of a univariate Hawkes process.
The log likelihood is calculated on point process observations represented as ragged matrices for lags (interarrival times w.r.t. the previous point), and marks (identifiers for the process ID). Note that each mark is considered independent, i.e., computes the joint likelihood of a set of Hawkes processes determined by the conditional intensity:
.. math::
\lambdak^(t) = \lambdak + \alphak \sum{{ti < t, yi = k}} \betak \exp(-\beta*k (t - t_i))
where :math:\lambda_k
specifies the background intensity $lda$, :math:\alpha_k
specifies the branching ratio or $alpha$, and :math:\beta_k
the delay density parameter $beta$.
$lags$ and $marks$ are two NDArrays of shape (N, T) and correspond to the representation of the point process observation, the first dimension corresponds to the batch index, and the second to the sequence. These are "left-aligned" ragged matrices (the first index of the second dimension is the beginning of every sequence. The length of each sequence is given by $valid_length$, of shape (N,) where $valid_length[i]$ corresponds to the number of valid points in $lags[i, :]$ and $marks[i, :]$.
$max_time$ is the length of the observation period of the point process. That is, specifying $max_time[i] = 5$ computes the likelihood of the i-th sample as observed on the time interval :math:(0, 5]
. Naturally, the sum of all valid $lags[i, :valid_length[i]]$ must be less than or equal to 5.
The input $state$ specifies the memory of the Hawkes process. Invoking the memoryless property of exponential decays, we compute the memory as
.. math::
s_k(t) = \sum_{t_i < t} \exp(-\beta_k (t - t_i)).
The $state$ to be provided is :math:s_k(0)
and carries the added intensity due to past events before the current batch. :math:s_k(T)
is returned from the function where :math:T
is $max_time[T]$.
Example::
define the Hawkes process parameters
lda = nd.array([1.5, 2.0, 3.0]).tile((N, 1)) alpha = nd.array([0.2, 0.3, 0.4]) # branching ratios should be < 1 beta = nd.array([1.0, 2.0, 3.0])
the "data", or observations
ia_times = nd.array([[6, 7, 8, 9], [1, 2, 3, 4], [3, 4, 5, 6], [8, 9, 10, 11]]) marks = nd.zeros((N, T)).astype(np.int32)
starting "state" of the process
states = nd.zeros((N, K))
validlength = nd.array([1, 2, 3, 4]) # number of valid points in each sequence maxtime = nd.ones((N,)) * 100.0 # length of the observation period
A = nd.contrib.hawkesll( lda, alpha, beta, states, iatimes, marks, validlength, max_time )
References:
- Bacry, E., Mastromatteo, I., & Muzy, J. F. (2015). Hawkes processes in finance. Market Microstructure and Liquidity , 1(01), 1550005.
Defined in src/operator/contrib/hawkes_ll.cc:L83
Arguments
lda::NDArray-or-SymbolicNode
: Shape (N, K) The intensity for each of the K processes, for each samplealpha::NDArray-or-SymbolicNode
: Shape (K,) The infectivity factor (branching ratio) for each processbeta::NDArray-or-SymbolicNode
: Shape (K,) The decay parameter for each processstate::NDArray-or-SymbolicNode
: Shape (N, K) the Hawkes state for each processlags::NDArray-or-SymbolicNode
: Shape (N, T) the interarrival timesmarks::NDArray-or-SymbolicNode
: Shape (N, T) the marks (process ids)valid_length::NDArray-or-SymbolicNode
: The number of valid points in the processmax_time::NDArray-or-SymbolicNode
: the length of the interval where the processes were sampledname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_ifft
— Method.
_contrib_ifft(data, compute_size)
Apply 1D ifft to input"
.. note:: ifft
is only available on GPU.
Currently accept 2 input data shapes: (N, d) or (N1, N2, N3, d). Data is in format: [real0, imag0, real1, imag1, ...]. Last dimension must be an even number. The output data has shape: (N, d/2) or (N1, N2, N3, d/2). It is only the real part of the result.
Example::
data = np.random.normal(0,1,(3,4)) out = mx.contrib.ndarray.ifft(data = mx.nd.array(data,ctx = mx.gpu(0)))
Defined in src/operator/contrib/ifft.cc:L57
Arguments
data::NDArray-or-SymbolicNode
: Input data to the IFFTOp.compute_size::int, optional, default='128'
: Maximum size of sub-batch to be forwarded at one timename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_index_array
— Method.
_contrib_index_array(data, axes)
Returns an array of indexes of the input array.
For an input array with shape :math:(d_1, d_2, ..., d_n)
, index_array
returns a :math:(d_1, d_2, ..., d_n, n)
array idx
, where :math:idx[i_1, i_2, ..., i_n, :] = [i_1, i_2, ..., i_n]
.
Additionally, when the parameter axes
is specified, idx
will be a :math:(d_1, d_2, ..., d_n, m)
array where m
is the length of axes
, and the following equality will hold: :math:idx[i_1, i_2, ..., i_n, j] = i_{axes[j]}
.
Examples::
x = mx.nd.ones((3, 2))
mx.nd.contrib.index_array(x) = [[[0 0]
[0 1]]
[[1 0]
[1 1]]
[[2 0]
[2 1]]]
x = mx.nd.ones((3, 2, 2))
mx.nd.contrib.index_array(x, axes=(1, 0)) = [[[[0 0]
[0 0]]
[[1 0]
[1 0]]]
[[[0 1]
[0 1]]
[[1 1]
[1 1]]]
[[[0 2]
[0 2]]
[[1 2]
[1 2]]]]
Defined in src/operator/contrib/index_array.cc:L118
Arguments
data::NDArray-or-SymbolicNode
: Input dataaxes::Shape or None, optional, default=None
: The axes to include in the index array. Supports negative values.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_index_copy
— Method.
_contrib_index_copy(old_tensor, index_vector, new_tensor)
Copies the elements of a new_tensor
into the old_tensor
.
This operator copies the elements by selecting the indices in the order given in index
. The output will be a new tensor containing the rest elements of old tensor and the copied elements of new tensor. For example, if index[i] == j
, then the i
th row of new_tensor
is copied to the j
th row of output.
The index
must be a vector and it must have the same size with the 0
th dimension of new_tensor
. Also, the 0
th dimension of old*tensor must >=
the 0
th dimension of new*tensor
, or an error will be raised.
Examples::
x = mx.nd.zeros((5,3))
t = mx.nd.array([[1,2,3],[4,5,6],[7,8,9]])
index = mx.nd.array([0,4,2])
mx.nd.contrib.index_copy(x, index, t)
[[1. 2. 3.]
[0. 0. 0.]
[7. 8. 9.]
[0. 0. 0.]
[4. 5. 6.]]
<NDArray 5x3 @cpu(0)>
Defined in src/operator/contrib/index_copy.cc:L183
Arguments
old_tensor::NDArray-or-SymbolicNode
: Old tensorindex_vector::NDArray-or-SymbolicNode
: Index vectornew_tensor::NDArray-or-SymbolicNode
: New tensor to be copiedname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_interleaved_matmul_encdec_qk
— Method.
_contrib_interleaved_matmul_encdec_qk(queries, keys_values, heads)
Compute the matrix multiplication between the projections of queries and keys in multihead attention use as encoder-decoder.
the inputs must be a tensor of projections of queries following the layout: (seqlength, batchsize, numheads * headdim)
and a tensor of interleaved projections of values and keys following the layout: (seqlength, batchsize, numheads * headdim * 2)
the equivalent code would be: qproj = mx.nd.transpose(queries, axes=(1, 2, 0, 3)) qproj = mx.nd.reshape(qproj, shape=(-1, 0, 0), reverse=True) qproj = mx.nd.contrib.divsqrtdim(qproj) tmp = mx.nd.reshape(keysvalues, shape=(0, 0, numheads, 2, -1)) kproj = mx.nd.transpose(tmp[:,:,:,0,:], axes=(1, 2, 0, 3)) kproj = mx.nd.reshap(kproj, shape=(-1, 0, 0), reverse=True) output = mx.nd.batchdot(qproj, kproj, transposeb=True)
Defined in src/operator/contrib/transformer.cc:L753
Arguments
queries::NDArray-or-SymbolicNode
: Querieskeys_values::NDArray-or-SymbolicNode
: Keys and values interleavedheads::int, required
: Set number of headsname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_interleaved_matmul_encdec_valatt
— Method.
_contrib_interleaved_matmul_encdec_valatt(keys_values, attention, heads)
Compute the matrix multiplication between the projections of values and the attention weights in multihead attention use as encoder-decoder.
the inputs must be a tensor of interleaved projections of keys and values following the layout: (seqlength, batchsize, numheads * headdim * 2)
and the attention weights following the layout: (batchsize, seqlength, seq_length)
the equivalent code would be:
tmp = mx.nd.reshape(querieskeysvalues, shape=(0, 0, numheads, 3, -1)) vproj = mx.nd.transpose(tmp[:,:,:,1,:], axes=(1, 2, 0, 3)) vproj = mx.nd.reshape(vproj, shape=(-1, 0, 0), reverse=True) output = mx.nd.batchdot(attention, vproj, transposeb=True) output = mx.nd.reshape(output, shape=(-1, numheads, 0, 0), reverse=True) output = mx.nd.transpose(output, axes=(0, 2, 1, 3)) output = mx.nd.reshape(output, shape=(0, 0, -1))
Defined in src/operator/contrib/transformer.cc:L799
Arguments
keys_values::NDArray-or-SymbolicNode
: Keys and values interleavedattention::NDArray-or-SymbolicNode
: Attention mapsheads::int, required
: Set number of headsname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_interleaved_matmul_selfatt_qk
— Method.
_contrib_interleaved_matmul_selfatt_qk(queries_keys_values, heads)
Compute the matrix multiplication between the projections of queries and keys in multihead attention use as self attention.
the input must be a single tensor of interleaved projections of queries, keys and values following the layout: (seqlength, batchsize, numheads * headdim * 3)
the equivalent code would be: tmp = mx.nd.reshape(querieskeysvalues, shape=(0, 0, numheads, 3, -1)) qproj = mx.nd.transpose(tmp[:,:,:,0,:], axes=(1, 2, 0, 3)) qproj = mx.nd.reshape(qproj, shape=(-1, 0, 0), reverse=True) qproj = mx.nd.contrib.divsqrtdim(qproj) kproj = mx.nd.transpose(tmp[:,:,:,1,:], axes=(1, 2, 0, 3)) kproj = mx.nd.reshap(kproj, shape=(-1, 0, 0), reverse=True) output = mx.nd.batchdot(qproj, kproj, transpose_b=True)
Defined in src/operator/contrib/transformer.cc:L665
Arguments
queries_keys_values::NDArray-or-SymbolicNode
: Interleaved queries, keys and valuesheads::int, required
: Set number of headsname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_interleaved_matmul_selfatt_valatt
— Method.
_contrib_interleaved_matmul_selfatt_valatt(queries_keys_values, attention, heads)
Compute the matrix multiplication between the projections of values and the attention weights in multihead attention use as self attention.
the inputs must be a tensor of interleaved projections of queries, keys and values following the layout: (seqlength, batchsize, numheads * headdim * 3)
and the attention weights following the layout: (batchsize, seqlength, seq_length)
the equivalent code would be: tmp = mx.nd.reshape(querieskeysvalues, shape=(0, 0, numheads, 3, -1)) vproj = mx.nd.transpose(tmp[:,:,:,2,:], axes=(1, 2, 0, 3)) vproj = mx.nd.reshape(vproj, shape=(-1, 0, 0), reverse=True) output = mx.nd.batchdot(attention, vproj, transposeb=True) output = mx.nd.reshape(output, shape=(-1, numheads, 0, 0), reverse=True) output = mx.nd.transpose(output, axes=(0, 2, 1, 3)) output = mx.nd.reshape(output, shape=(0, 0, -1))
Defined in src/operator/contrib/transformer.cc:L709
Arguments
queries_keys_values::NDArray-or-SymbolicNode
: Queries, keys and values interleavedattention::NDArray-or-SymbolicNode
: Attention mapsheads::int, required
: Set number of headsname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_intgemm_fully_connected
— Method.
_contrib_intgemm_fully_connected(data, weight, scaling, bias, num_hidden, no_bias, flatten, out_type)
Multiply matrices using 8-bit integers. data * weight.
Input tensor arguments are: data weight [scaling] [bias]
data: either float32 or prepared using intgemmpreparedata (in which case it is int8).
weight: must be prepared using intgemmprepareweight.
scaling: present if and only if outtype is float32. If so this is multiplied by the result before adding bias. Typically: scaling = (max passed to intgemmprepareweight)/127.0 if data is in float32 scaling = (maxpassed to intgemmpreparedata)/127.0 * (max passed to intgemmprepareweight)/127.0 if data is in int8
bias: present if and only if !no_bias. This is added to the output after scaling and has the same number of columns as the output.
out_type: type of the output.
Defined in src/operator/contrib/intgemm/intgemmfullyconnected_op.cc:L283
Arguments
data::NDArray-or-SymbolicNode
: First argument to multiplication. Tensor of float32 (quantized on the fly) or int8 from intgemmpreparedata. If you use a different quantizer, be sure to ban -128. The last dimension must be a multiple of 64.weight::NDArray-or-SymbolicNode
: Second argument to multiplication. Tensor of int8 from intgemmprepareweight. The last dimension must be a multiple of 64. The product of non-last dimensions must be a multiple of 8.scaling::NDArray-or-SymbolicNode
: Scaling factor to apply if output type is float32.bias::NDArray-or-SymbolicNode
: Bias term.num_hidden::int, required
: Number of hidden nodes of the output.no_bias::boolean, optional, default=0
: Whether to disable bias parameter.flatten::boolean, optional, default=1
: Whether to collapse all but the first axis of the input data tensor.out_type::{'float32', 'int32'},optional, default='float32'
: Output data type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_intgemm_maxabsolute
— Method.
_contrib_intgemm_maxabsolute(data)
Compute the maximum absolute value in a tensor of float32 fast on a CPU. The tensor's total size must be a multiple of 16 and aligned to a multiple of 64 bytes. mxnet.nd.contrib.intgemm_maxabsolute(arr) == arr.abs().max()
Defined in src/operator/contrib/intgemm/maxabsoluteop.cc:L101
Arguments
data::NDArray-or-SymbolicNode
: Tensor to compute maximum absolute value ofname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_intgemm_prepare_data
— Method.
_contrib_intgemm_prepare_data(data, maxabs)
This operator converts quantizes float32 to int8 while also banning -128.
It it suitable for preparing an data matrix for use by intgemm's C=data * weights operation.
The float32 values are scaled such that maxabs maps to 127. Typically maxabs = maxabsolute(A).
Defined in src/operator/contrib/intgemm/preparedataop.cc:L112
Arguments
data::NDArray-or-SymbolicNode
: Activation matrix to be prepared for multiplication.maxabs::NDArray-or-SymbolicNode
: Maximum absolute value to be used for scaling. (The values will be multiplied by 127.0 / maxabs.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_intgemm_prepare_weight
— Method.
_contrib_intgemm_prepare_weight(weight, maxabs, already_quantized)
This operator converts a weight matrix in column-major format to intgemm's internal fast representation of weight matrices. MXNet customarily stores weight matrices in column-major (transposed) format. This operator is not meant to be fast; it is meant to be run offline to quantize a model.
In other words, it prepares weight for the operation C = data * weight^T.
If the provided weight matrix is float32, it will be quantized first. The quantization function is (int8_t)(127.0 / max * weight) where multiplier is provided as argument 1 (the weight matrix is argument 0). Then the matrix will be rearranged into the CPU-dependent format.
If the provided weight matrix is already int8, the matrix will only be rearranged into the CPU-dependent format. This way one can quantize with intgemmpreparedata (which just quantizes), store to disk in a consistent format, then at load time convert to CPU-dependent format with intgemmprepareweight.
The internal representation depends on register length. So AVX512, AVX2, and SSSE3 have different formats. AVX512BW and AVX512VNNI have the same representation.
Defined in src/operator/contrib/intgemm/prepareweightop.cc:L153
Arguments
weight::NDArray-or-SymbolicNode
: Parameter matrix to be prepared for multiplication.maxabs::NDArray-or-SymbolicNode
: Maximum absolute value for scaling. The weights will be multipled by 127.0 / maxabs.already_quantized::boolean, optional, default=0
: Is the weight matrix already quantized?name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_intgemm_take_weight
— Method.
_contrib_intgemm_take_weight(weight, indices)
Index a weight matrix stored in intgemm's weight format. The indices select the outputs of matrix multiplication, not the inner dot product dimension.
Defined in src/operator/contrib/intgemm/takeweightop.cc:L128
Arguments
weight::NDArray-or-SymbolicNode
: Tensor already in intgemm weight format to select fromindices::NDArray-or-SymbolicNode
: indices to select on the 0th dimension of weightname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quadratic
— Method.
_contrib_quadratic(data, a, b, c)
This operators implements the quadratic function.
.. math:: f(x) = ax^2+bx+c
where :math:x
is an input tensor and all operations in the function are element-wise.
Example::
x = [[1, 2], [3, 4]] y = quadratic(data=x, a=1, b=2, c=3) y = [[6, 11], [18, 27]]
The storage type of $quadratic$ output depends on storage types of inputs
- quadratic(csr, a, b, 0) = csr
- quadratic(default, a, b, c) = default
Defined in src/operator/contrib/quadratic_op.cc:L50
Arguments
data::NDArray-or-SymbolicNode
: Input ndarraya::float, optional, default=0
: Coefficient of the quadratic term in the quadratic function.b::float, optional, default=0
: Coefficient of the linear term in the quadratic function.c::float, optional, default=0
: Constant term in the quadratic function.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantize
— Method.
_contrib_quantize(data, min_range, max_range, out_type)
Quantize a input tensor from float to out_type
, with user-specified min_range
and max_range
.
minrange and maxrange are scalar floats that specify the range for the input data.
When out_type is uint8
, the output is calculated using the following equation:
out[i] = (in[i] - min_range) * range(OUTPUT_TYPE) / (max_range - min_range) + 0.5
,
where range(T) = numeric_limits<T>::max() - numeric_limits<T>::min()
.
When out_type is int8
, the output is calculate using the following equation by keep zero centered for the quantized value:
out[i] = sign(in[i]) * min(abs(in[i] * scale + 0.5f, quantized_range)
,
where quantized_range = MinAbs(max(int8), min(int8))
and scale = quantized_range / MaxAbs(min_range, max_range).
.. Note:: This operator only supports forward propagation. DO NOT use it in training.
Defined in src/operator/quantization/quantize.cc:L73
Arguments
data::NDArray-or-SymbolicNode
: A ndarray/symbol of typefloat32
min_range::NDArray-or-SymbolicNode
: The minimum scalar value possibly produced for the inputmax_range::NDArray-or-SymbolicNode
: The maximum scalar value possibly produced for the inputout_type::{'int8', 'uint8'},optional, default='uint8'
: Output data type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantize_asym
— Method.
_contrib_quantize_asym(data, min_calib_range, max_calib_range)
Quantize a input tensor from float to uint8*t. Output scale
and shift
are scalar floats that specify the quantization parameters for the input data. The output is calculated using the following equation: out[i] = in[i] * scale + shift + 0.5
, where scale = uint8*range / (max*range - min*range)
andshift = numeric*limits<T>::max - max*range * scale
. .. Note:: This operator only supports forward propagation. DO NOT use it in training.
Defined in src/operator/quantization/quantize_asym.cc:L115
Arguments
data::NDArray-or-SymbolicNode
: A ndarray/symbol of typefloat32
min_calib_range::float or None, optional, default=None
: The minimum scalar value in the form of float32. If present, it will be used to quantize the fp32 data.max_calib_range::float or None, optional, default=None
: The maximum scalar value in the form of float32. If present, it will be used to quantize the fp32 data.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantize_v2
— Method.
_contrib_quantize_v2(data, out_type, min_calib_range, max_calib_range)
Quantize a input tensor from float to out_type
, with user-specified min_calib_range
and max_calib_range
or the input range collected at runtime.
Output min_range
and max_range
are scalar floats that specify the range for the input data.
When out_type is uint8
, the output is calculated using the following equation:
out[i] = (in[i] - min_range) * range(OUTPUT_TYPE) / (max_range - min_range) + 0.5
,
where range(T) = numeric_limits<T>::max() - numeric_limits<T>::min()
.
When out_type is int8
, the output is calculate using the following equation by keep zero centered for the quantized value:
out[i] = sign(in[i]) * min(abs(in[i] * scale + 0.5f, quantized_range)
,
where quantized_range = MinAbs(max(int8), min(int8))
and scale = quantized_range / MaxAbs(min_range, max_range).
When outtype is auto
, the output type is automatically determined by mincalibrange if presented. If mincalibrange < 0.0f, the output type will be int8, otherwise will be uint8. If mincalib_range isn't presented, the output type will be int8.
.. Note:: This operator only supports forward propagation. DO NOT use it in training.
Defined in src/operator/quantization/quantize_v2.cc:L90
Arguments
data::NDArray-or-SymbolicNode
: A ndarray/symbol of typefloat32
out_type::{'auto', 'int8', 'uint8'},optional, default='int8'
: Output data type.auto
can be specified to automatically determine output type according to mincalibrange.min_calib_range::float or None, optional, default=None
: The minimum scalar value in the form of float32. If present, it will be used to quantize the fp32 data into int8 or uint8.max_calib_range::float or None, optional, default=None
: The maximum scalar value in the form of float32. If present, it will be used to quantize the fp32 data into int8 or uint8.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantized_act
— Method.
_contrib_quantized_act(data, min_data, max_data, act_type)
Activation operator for input and output data type of int8. The input and output data comes with min and max thresholds for quantizing the float32 data into int8.
.. Note:: This operator only supports forward propogation. DO NOT use it in training. This operator only supports relu
Defined in src/operator/quantization/quantized_activation.cc:L90
Arguments
data::NDArray-or-SymbolicNode
: Input data.min_data::NDArray-or-SymbolicNode
: Minimum value of data.max_data::NDArray-or-SymbolicNode
: Maximum value of data.act_type::{'relu', 'sigmoid', 'softrelu', 'softsign', 'tanh'}, required
: Activation function to be applied.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantized_batch_norm
— Method.
_contrib_quantized_batch_norm(data, gamma, beta, moving_mean, moving_var, min_data, max_data, eps, momentum, fix_gamma, use_global_stats, output_mean_var, axis, cudnn_off, min_calib_range, max_calib_range)
BatchNorm operator for input and output data type of int8. The input and output data comes with min and max thresholds for quantizing the float32 data into int8.
.. Note:: This operator only supports forward propogation. DO NOT use it in training.
Defined in src/operator/quantization/quantizedbatchnorm.cc:L94
Arguments
data::NDArray-or-SymbolicNode
: Input data.gamma::NDArray-or-SymbolicNode
: gamma.beta::NDArray-or-SymbolicNode
: beta.moving_mean::NDArray-or-SymbolicNode
: moving_mean.moving_var::NDArray-or-SymbolicNode
: moving_var.min_data::NDArray-or-SymbolicNode
: Minimum value of data.max_data::NDArray-or-SymbolicNode
: Maximum value of data.eps::double, optional, default=0.0010000000474974513
: Epsilon to prevent div 0. Must be no less than CUDNNBNMIN_EPSILON defined in cudnn.h when using cudnn (usually 1e-5)momentum::float, optional, default=0.899999976
: Momentum for moving averagefix_gamma::boolean, optional, default=1
: Fix gamma while traininguse_global_stats::boolean, optional, default=0
: Whether use global moving statistics instead of local batch-norm. This will force change batch-norm into a scale shift operator.output_mean_var::boolean, optional, default=0
: Output the mean and inverse stdaxis::int, optional, default='1'
: Specify which shape axis the channel is specifiedcudnn_off::boolean, optional, default=0
: Do not select CUDNN operator, if availablemin_calib_range::float or None, optional, default=None
: The minimum scalar value in the form of float32 obtained through calibration. If present, it will be used to by quantized batch norm op to calculate primitive scale.Note: this calib_range is to calib bn output.max_calib_range::float or None, optional, default=None
: The maximum scalar value in the form of float32 obtained through calibration. If present, it will be used to by quantized batch norm op to calculate primitive scale.Note: this calib_range is to calib bn output.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantized_concat
— Method.
_contrib_quantized_concat(data, num_args, dim)
Note: contribquantizedconcat takes variable number of positional inputs. So instead of calling as _contribquantizedconcat([x, y, z], numargs=3), one should call via contribquantizedconcat(x, y, z), and numargs will be determined automatically.
Joins input arrays along a given axis.
The dimensions of the input arrays should be the same except the axis along which they will be concatenated. The dimension of the output array along the concatenated axis will be equal to the sum of the corresponding dimensions of the input arrays. All inputs with different min/max will be rescaled by using largest [min, max] pairs. If any input holds int8, then the output will be int8. Otherwise output will be uint8.
Defined in src/operator/quantization/quantized_concat.cc:L107
Arguments
data::NDArray-or-SymbolicNode[]
: List of arrays to concatenatenum_args::int, required
: Number of inputs to be concated.dim::int, optional, default='1'
: the dimension to be concated.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantized_conv
— Method.
_contrib_quantized_conv(data, weight, bias, min_data, max_data, min_weight, max_weight, min_bias, max_bias, kernel, stride, dilate, pad, num_filter, num_group, workspace, no_bias, cudnn_tune, cudnn_off, layout)
Convolution operator for input, weight and bias data type of int8, and accumulates in type int32 for the output. For each argument, two more arguments of type float32 must be provided representing the thresholds of quantizing argument from data type float32 to int8. The final outputs contain the convolution result in int32, and min and max thresholds representing the threholds for quantizing the float32 output into int32.
.. Note:: This operator only supports forward propogation. DO NOT use it in training.
Defined in src/operator/quantization/quantized_conv.cc:L187
Arguments
data::NDArray-or-SymbolicNode
: Input data.weight::NDArray-or-SymbolicNode
: weight.bias::NDArray-or-SymbolicNode
: bias.min_data::NDArray-or-SymbolicNode
: Minimum value of data.max_data::NDArray-or-SymbolicNode
: Maximum value of data.min_weight::NDArray-or-SymbolicNode
: Minimum value of weight.max_weight::NDArray-or-SymbolicNode
: Maximum value of weight.min_bias::NDArray-or-SymbolicNode
: Minimum value of bias.max_bias::NDArray-or-SymbolicNode
: Maximum value of bias.kernel::Shape(tuple), required
: Convolution kernel size: (w,), (h, w) or (d, h, w)stride::Shape(tuple), optional, default=[]
: Convolution stride: (w,), (h, w) or (d, h, w). Defaults to 1 for each dimension.dilate::Shape(tuple), optional, default=[]
: Convolution dilate: (w,), (h, w) or (d, h, w). Defaults to 1 for each dimension.pad::Shape(tuple), optional, default=[]
: Zero pad for convolution: (w,), (h, w) or (d, h, w). Defaults to no padding.num_filter::int (non-negative), required
: Convolution filter(channel) numbernum_group::int (non-negative), optional, default=1
: Number of group partitions.workspace::long (non-negative), optional, default=1024
: Maximum temporary workspace allowed (MB) in convolution.This parameter has two usages. When CUDNN is not used, it determines the effective batch size of the convolution kernel. When CUDNN is used, it controls the maximum temporary storage used for tuning the best CUDNN kernel whenlimited_workspace
strategy is used.no_bias::boolean, optional, default=0
: Whether to disable bias parameter.cudnn_tune::{None, 'fastest', 'limited_workspace', 'off'},optional, default='None'
: Whether to pick convolution algo by running performance test.cudnn_off::boolean, optional, default=0
: Turn off cudnn for this layer.layout::{None, 'NCDHW', 'NCHW', 'NCW', 'NDHWC', 'NHWC'},optional, default='None'
: Set layout for input, output and weight. Empty for default layout: NCW for 1d, NCHW for 2d and NCDHW for 3d.NHWC and NDHWC are only supported on GPU.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantized_elemwise_add
— Method.
_contrib_quantized_elemwise_add(lhs, rhs, lhs_min, lhs_max, rhs_min, rhs_max)
elemwise_add operator for input dataA and input dataB data type of int8, and accumulates in type int32 for the output. For each argument, two more arguments of type float32 must be provided representing the thresholds of quantizing argument from data type float32 to int8. The final outputs contain result in int32, and min and max thresholds representing the threholds for quantizing the float32 output into int32.
.. Note:: This operator only supports forward propogation. DO NOT use it in training.
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputlhs_min::NDArray-or-SymbolicNode
: 3rd inputlhs_max::NDArray-or-SymbolicNode
: 4th inputrhs_min::NDArray-or-SymbolicNode
: 5th inputrhs_max::NDArray-or-SymbolicNode
: 6th inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantized_elemwise_mul
— Method.
_contrib_quantized_elemwise_mul(lhs, rhs, lhs_min, lhs_max, rhs_min, rhs_max, min_calib_range, max_calib_range, enable_float_output)
Multiplies arguments int8 element-wise.
Defined in src/operator/quantization/quantizedelemwisemul.cc:L221
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputlhs_min::NDArray-or-SymbolicNode
: Minimum value of first input.lhs_max::NDArray-or-SymbolicNode
: Maximum value of first input.rhs_min::NDArray-or-SymbolicNode
: Minimum value of second input.rhs_max::NDArray-or-SymbolicNode
: Maximum value of second input.min_calib_range::float or None, optional, default=None
: The minimum scalar value in the form of float32 obtained through calibration. If present, it will be used to requantize the int8 output data.max_calib_range::float or None, optional, default=None
: The maximum scalar value in the form of float32 obtained through calibration. If present, it will be used to requantize the int8 output data.enable_float_output::boolean, optional, default=0
: Whether to enable float32 outputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantized_embedding
— Method.
_contrib_quantized_embedding(data, weight, min_weight, max_weight, input_dim, output_dim, dtype, sparse_grad)
Maps integer indices to int8 vector representations (embeddings).
Defined in src/operator/quantization/quantizedindexingop.cc:L133
Arguments
data::NDArray-or-SymbolicNode
: The input array to the embedding operator.weight::NDArray-or-SymbolicNode
: The embedding weight matrix.min_weight::NDArray-or-SymbolicNode
: Minimum value of data.max_weight::NDArray-or-SymbolicNode
: Maximum value of data.input_dim::int, required
: Vocabulary size of the input indices.output_dim::int, required
: Dimension of the embedding vectors.dtype::{'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Data type of weight.sparse_grad::boolean, optional, default=0
: Compute row sparse gradient in the backward calculation. If set to True, the grad's storage type is row_sparse.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantized_flatten
— Method.
_contrib_quantized_flatten(data, min_data, max_data)
Arguments
data::NDArray-or-SymbolicNode
: A ndarray/symbol of typefloat32
min_data::NDArray-or-SymbolicNode
: The minimum scalar value possibly produced for the datamax_data::NDArray-or-SymbolicNode
: The maximum scalar value possibly produced for the dataname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantized_fully_connected
— Method.
_contrib_quantized_fully_connected(data, weight, bias, min_data, max_data, min_weight, max_weight, min_bias, max_bias, num_hidden, no_bias, flatten)
Fully Connected operator for input, weight and bias data type of int8, and accumulates in type int32 for the output. For each argument, two more arguments of type float32 must be provided representing the thresholds of quantizing argument from data type float32 to int8. The final outputs contain the convolution result in int32, and min and max thresholds representing the threholds for quantizing the float32 output into int32.
.. Note:: This operator only supports forward propogation. DO NOT use it in training.
Defined in src/operator/quantization/quantizedfullyconnected.cc:L312
Arguments
data::NDArray-or-SymbolicNode
: Input data.weight::NDArray-or-SymbolicNode
: weight.bias::NDArray-or-SymbolicNode
: bias.min_data::NDArray-or-SymbolicNode
: Minimum value of data.max_data::NDArray-or-SymbolicNode
: Maximum value of data.min_weight::NDArray-or-SymbolicNode
: Minimum value of weight.max_weight::NDArray-or-SymbolicNode
: Maximum value of weight.min_bias::NDArray-or-SymbolicNode
: Minimum value of bias.max_bias::NDArray-or-SymbolicNode
: Maximum value of bias.num_hidden::int, required
: Number of hidden nodes of the output.no_bias::boolean, optional, default=0
: Whether to disable bias parameter.flatten::boolean, optional, default=1
: Whether to collapse all but the first axis of the input data tensor.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantized_pooling
— Method.
_contrib_quantized_pooling(data, min_data, max_data, kernel, pool_type, global_pool, cudnn_off, pooling_convention, stride, pad, p_value, count_include_pad, layout)
Pooling operator for input and output data type of int8. The input and output data comes with min and max thresholds for quantizing the float32 data into int8.
.. Note:: This operator only supports forward propogation. DO NOT use it in training. This operator only supports pool_type
of avg
or max
.
Defined in src/operator/quantization/quantized_pooling.cc:L186
Arguments
data::NDArray-or-SymbolicNode
: Input data.min_data::NDArray-or-SymbolicNode
: Minimum value of data.max_data::NDArray-or-SymbolicNode
: Maximum value of data.kernel::Shape(tuple), optional, default=[]
: Pooling kernel size: (y, x) or (d, y, x)pool_type::{'avg', 'lp', 'max', 'sum'},optional, default='max'
: Pooling type to be applied.global_pool::boolean, optional, default=0
: Ignore kernel size, do global pooling based on current input feature map.cudnn_off::boolean, optional, default=0
: Turn off cudnn pooling and use MXNet pooling operator.pooling_convention::{'full', 'same', 'valid'},optional, default='valid'
: Pooling convention to be applied.stride::Shape(tuple), optional, default=[]
: Stride: for pooling (y, x) or (d, y, x). Defaults to 1 for each dimension.pad::Shape(tuple), optional, default=[]
: Pad for pooling: (y, x) or (d, y, x). Defaults to no padding.p_value::int or None, optional, default='None'
: Value of p for Lp pooling, can be 1 or 2, required for Lp Pooling.count_include_pad::boolean or None, optional, default=None
: 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.layout::{None, 'NCDHW', 'NCHW', 'NCW', 'NDHWC', 'NHWC', 'NWC'},optional, default='None'
: Set layout for input and output. Empty for default layout: NCW for 1d, NCHW for 2d and NCDHW for 3d.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_quantized_rnn
— Method.
_contrib_quantized_rnn(data, parameters, state, state_cell, data_scale, data_shift, state_size, num_layers, bidirectional, mode, p, state_outputs, projection_size, lstm_state_clip_min, lstm_state_clip_max, lstm_state_clip_nan, use_sequence_length)
RNN operator for input data type of uint8. The weight of each gates is converted to int8, while bias is accumulated in type float32. The hidden state and cell state are in type float32. For the input data, two more arguments of type float32 must be provided representing the thresholds of quantizing argument from data type float32 to uint8. The final outputs contain the recurrent result in float32. It only supports quantization for Vanilla LSTM network. .. Note:: This operator only supports forward propagation. DO NOT use it in training.
Defined in src/operator/quantization/quantized_rnn.cc:L298
Arguments
data::NDArray-or-SymbolicNode
: Input data.parameters::NDArray-or-SymbolicNode
: weight.state::NDArray-or-SymbolicNode
: initial hidden state of the RNNstate_cell::NDArray-or-SymbolicNode
: initial cell state for LSTM networks (only for LSTM)data_scale::NDArray-or-SymbolicNode
: quantization scale of data.data_shift::NDArray-or-SymbolicNode
: quantization shift of data.state_size::int (non-negative), required
: size of the state for each layernum_layers::int (non-negative), required
: number of stacked layersbidirectional::boolean, optional, default=0
: whether to use bidirectional recurrent layersmode::{'gru', 'lstm', 'rnn_relu', 'rnn_tanh'}, required
: the type of RNN to computep::float, optional, default=0
: drop rate of the dropout on the outputs of each RNN layer, except the last layer.state_outputs::boolean, optional, default=0
: Whether to have the states as symbol outputs.projection_size::int or None, optional, default='None'
: size of project sizelstm_state_clip_min::double or None, optional, default=None
: Minimum clip value of LSTM states. This option must be used together with lstmstateclip_max.lstm_state_clip_max::double or None, optional, default=None
: Maximum clip value of LSTM states. This option must be used together with lstmstateclip_min.lstm_state_clip_nan::boolean, optional, default=0
: Whether to stop NaN from propagating in state by clipping it to min/max. If clipping range is not specified, this option is ignored.use_sequence_length::boolean, optional, default=0
: If set to true, this layer takes in an extra input parametersequence_length
to specify variable length sequencename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_requantize
— Method.
_contrib_requantize(data, min_range, max_range, out_type, min_calib_range, max_calib_range)
Given data that is quantized in int32 and the corresponding thresholds, requantize the data into int8 using min and max thresholds either calculated at runtime or from calibration. It's highly recommended to pre-calucate the min and max thresholds through calibration since it is able to save the runtime of the operator and improve the inference accuracy.
.. Note:: This operator only supports forward propogation. DO NOT use it in training.
Defined in src/operator/quantization/requantize.cc:L59
Arguments
data::NDArray-or-SymbolicNode
: A ndarray/symbol of typeint32
min_range::NDArray-or-SymbolicNode
: The original minimum scalar value in the form of float32 used for quantizing data into int32.max_range::NDArray-or-SymbolicNode
: The original maximum scalar value in the form of float32 used for quantizing data into int32.out_type::{'auto', 'int8', 'uint8'},optional, default='int8'
: Output data type.auto
can be specified to automatically determine output type according to mincalibrange.min_calib_range::float or None, optional, default=None
: The minimum scalar value in the form of float32 obtained through calibration. If present, it will be used to requantize the int32 data into int8.max_calib_range::float or None, optional, default=None
: The maximum scalar value in the form of float32 obtained through calibration. If present, it will be used to requantize the int32 data into int8.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_round_ste
— Method.
_contrib_round_ste(data)
Straight-through-estimator of round()
.
In forward pass, returns element-wise rounded value to the nearest integer of the input (same as round()
).
In backward pass, returns gradients of $1$ everywhere (instead of $0$ everywhere as in round()
): :math:\frac{d}{dx}{round\_ste(x)} = 1
vs. :math:\frac{d}{dx}{round(x)} = 0
. This is useful for quantized training.
Reference: Estimating or Propagating Gradients Through Stochastic Neurons for Conditional Computation.
Example:: x = round_ste([-1.5, 1.5, -1.9, 1.9, 2.7]) x.backward() x = [-2., 2., -2., 2., 3.] x.grad() = [1., 1., 1., 1., 1.]
The storage type of $round_ste$ output depends upon the input storage type:
- round_ste(default) = default
- roundste(rowsparse) = row_sparse
- round_ste(csr) = csr
Defined in src/operator/contrib/stes_op.cc:L54
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._contrib_sign_ste
— Method.
_contrib_sign_ste(data)
Straight-through-estimator of sign()
.
In forward pass, returns element-wise sign of the input (same as sign()
).
In backward pass, returns gradients of $1$ everywhere (instead of $0$ everywhere as in $sign()$): :math:\frac{d}{dx}{sign\_ste(x)} = 1
vs. :math:\frac{d}{dx}{sign(x)} = 0
. This is useful for quantized training.
Reference: Estimating or Propagating Gradients Through Stochastic Neurons for Conditional Computation.
Example:: x = sign_ste([-2, 0, 3]) x.backward() x = [-1., 0., 1.] x.grad() = [1., 1., 1.]
The storage type of $sign_ste$ output depends upon the input storage type:
- round_ste(default) = default
- roundste(rowsparse) = row_sparse
- round_ste(csr) = csr
Defined in src/operator/contrib/stes_op.cc:L79
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._copy
— Method.
_copy(data)
Returns a copy of the input.
From:src/operator/tensor/elemwiseunaryop_basic.cc:244
Arguments
data::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._copyto
— Method.
_copyto(data)
Arguments
data::NDArray
: input dataname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._crop_assign
— Method.
_crop_assign(lhs, rhs, begin, end, step)
cropassign is an alias of sliceassign.
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:src/operator/tensor/matrix_op.cc:514
Arguments
lhs::NDArray-or-SymbolicNode
: Source inputrhs::NDArray-or-SymbolicNode
: value to assignbegin::Shape(tuple), required
: starting indices for the slice operation, supports negative indices.end::Shape(tuple), required
: ending indices for the slice operation, supports negative indices.step::Shape(tuple), optional, default=[]
: step for the slice operation, supports negative values.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._crop_assign_scalar
— Method.
_crop_assign_scalar(data, scalar, begin, end, step)
cropassignscalar is an alias of _sliceassign_scalar.
(Assign the scalar to a cropped subset of the input.
Requirements
- output should be explicitly given and be the same as input
)
From:src/operator/tensor/matrix_op.cc:540
Arguments
data::NDArray-or-SymbolicNode
: Source inputscalar::double, optional, default=0
: The scalar value for assignment.begin::Shape(tuple), required
: starting indices for the slice operation, supports negative indices.end::Shape(tuple), required
: ending indices for the slice operation, supports negative indices.step::Shape(tuple), optional, default=[]
: step for the slice operation, supports negative values.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._cvcopyMakeBorder
— Method.
_cvcopyMakeBorder(src, top, bot, left, right, type, value, values)
Pad image border with OpenCV.
Arguments
src::NDArray
: source imagetop::int, required
: Top margin.bot::int, required
: Bottom margin.left::int, required
: Left margin.right::int, required
: Right margin.type::int, optional, default='0'
: Filling type (default=cv2.BORDER_CONSTANT).value::double, optional, default=0
: (Deprecated! Use $values$ instead.) Fill with single value.values::tuple of <double>, optional, default=[]
: Fill with value(RGB[A] or gray), up to 4 channels.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._cvimdecode
— Method.
_cvimdecode(buf, flag, to_rgb)
Decode image with OpenCV. Note: return image in RGB by default, instead of OpenCV's default BGR.
Arguments
buf::NDArray
: Buffer containing binary encoded imageflag::int, optional, default='1'
: Convert decoded image to grayscale (0) or color (1).to_rgb::boolean, optional, default=1
: Whether to convert decoded image to mxnet's default RGB format (instead of opencv's default BGR).name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._cvimread
— Method.
_cvimread(filename, flag, to_rgb)
Read and decode image with OpenCV. Note: return image in RGB by default, instead of OpenCV's default BGR.
Arguments
filename::string, required
: Name of the image file to be loaded.flag::int, optional, default='1'
: Convert decoded image to grayscale (0) or color (1).to_rgb::boolean, optional, default=1
: Whether to convert decoded image to mxnet's default RGB format (instead of opencv's default BGR).name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._cvimresize
— Method.
_cvimresize(src, w, h, interp)
Resize image with OpenCV.
Arguments
src::NDArray
: source imagew::int, required
: Width of resized image.h::int, required
: Height of resized image.interp::int, optional, default='1'
: Interpolation method (default=cv2.INTER_LINEAR).name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._div_scalar
— Method.
_div_scalar(data, scalar, is_int)
Divide an array with a scalar.
$_div_scalar$ only operates on data array of input if input is sparse.
For example, if input of shape (100, 100) has only 2 non zero elements, i.e. input.data = [5, 6], scalar = nan, it will result output.data = [nan, nan] instead of 10000 nans.
Defined in src/operator/tensor/elemwisebinaryscalaropbasic.cc:L174
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._equal
— Method.
_equal(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._equal_scalar
— Method.
_equal_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._eye
— Method.
_eye(N, M, k, ctx, dtype)
Return a 2-D array with ones on the diagonal and zeros elsewhere.
Arguments
N::long, required
: Number of rows in the output.M::long, optional, default=0
: Number of columns in the output. If 0, defaults to Nk::long, optional, default=0
: Index of the diagonal. 0 (the default) refers to the main diagonal.A positive value refers to an upper diagonal.A negative value to a lower diagonal.ctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Target data type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._foreach
— Method.
_foreach(fn, data, num_args, num_outputs, num_out_data, in_state_locs, in_data_locs, remain_locs)
Note: foreach takes variable number of positional inputs. So instead of calling as _foreach([x, y, z], numargs=3), one should call via foreach(x, y, z), and numargs will be determined automatically.
Run a for loop over an NDArray with user-defined computation
From:src/operator/control_flow.cc:1090
Arguments
fn::SymbolicNode
: Input graph.data::NDArray-or-SymbolicNode[]
: The input arrays that include data arrays and states.num_args::int, required
: Number of inputs.num_outputs::int, required
: The number of outputs of the subgraph.num_out_data::int, required
: The number of output data of the subgraph.in_state_locs::tuple of <long>, required
: The locations of loop states among the inputs.in_data_locs::tuple of <long>, required
: The locations of input data among the inputs.remain_locs::tuple of <long>, required
: The locations of remaining data among the inputs.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._full
— Method.
_full(shape, ctx, dtype, value)
fill target with a scalar value
Arguments
shape::Shape(tuple), optional, default=None
: The shape of the outputctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{'bfloat16', 'bool', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Target data type.value::double, required
: Value with which to fill newly created tensorname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._grad_add
— Method.
_grad_add(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._greater
— Method.
_greater(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._greater_equal
— Method.
_greater_equal(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._greater_equal_scalar
— Method.
_greater_equal_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._greater_scalar
— Method.
_greater_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._histogram
— Method.
_histogram(data, bins, bin_cnt, range)
This operators implements the histogram function.
Example:: x = [[0, 1], [2, 2], [3, 4]] histo, binedges = histogram(data=x, binbounds=[], bincnt=5, range=(0,5)) histo = [1, 1, 2, 1, 1] binedges = [0., 1., 2., 3., 4.] histo, binedges = histogram(data=x, binbounds=[0., 2.1, 3.]) histo = [4, 1]
Defined in src/operator/tensor/histogram.cc:L137
Arguments
data::NDArray-or-SymbolicNode
: Input ndarraybins::NDArray-or-SymbolicNode
: Input ndarraybin_cnt::int or None, optional, default='None'
: Number of bins for uniform caserange::, optional, default=None
: The lower and upper range of the bins. if not provided, range is simply (a.min(), a.max()). values outside the range are ignored. the first element of the range must be less than or equal to the second. range affects the automatic bin computation as well. while bin width is computed to be optimal based on the actual data within range, the bin count will fill the entire range including portions containing no data.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._hypot
— Method.
_hypot(lhs, rhs)
Given the "legs" of a right triangle, return its hypotenuse.
Defined in src/operator/tensor/elemwisebinaryop_extended.cc:L78
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._hypot_scalar
— Method.
_hypot_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._identity_with_attr_like_rhs
— Method.
_identity_with_attr_like_rhs(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: First input.rhs::NDArray-or-SymbolicNode
: Second input.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_adjust_lighting
— Method.
_image_adjust_lighting(data, alpha)
Adjust the lighting level of the input. Follow the AlexNet style.
Defined in src/operator/image/image_random.cc:L254
Arguments
data::NDArray-or-SymbolicNode
: The input.alpha::tuple of <float>, required
: The lighting alphas for the R, G, B channels.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_crop
— Method.
_image_crop(data, x, y, width, height)
Crop an image NDArray of shape (H x W x C) or (N x H x W x C) to the given size. Example: .. code-block:: python image = mx.nd.random.uniform(0, 255, (4, 2, 3)).astype(dtype=np.uint8) mx.nd.image.crop(image, 1, 1, 2, 2) [[[144 34 4] [ 82 157 38]]
[[156 111 230]
[177 25 15]]]
<NDArray 2x2x3 @cpu(0)>
image = mx.nd.random.uniform(0, 255, (2, 4, 2, 3)).astype(dtype=np.uint8)
mx.nd.image.crop(image, 1, 1, 2, 2)
[[[[ 35 198 50]
[242 94 168]]
[[223 119 129]
[249 14 154]]]
[[[137 215 106]
[ 79 174 133]]
[[116 142 109]
[ 35 239 50]]]]
<NDArray 2x2x2x3 @cpu(0)>
Defined in src/operator/image/crop.cc:L65
Arguments
data::NDArray-or-SymbolicNode
: The input.x::int, required
: Left boundary of the cropping area.y::int, required
: Top boundary of the cropping area.width::int, required
: Width of the cropping area.height::int, required
: Height of the cropping area.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_flip_left_right
— Method.
_image_flip_left_right(data)
Defined in src/operator/image/image_random.cc:L195
Arguments
data::NDArray-or-SymbolicNode
: The input.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_flip_top_bottom
— Method.
_image_flip_top_bottom(data)
Defined in src/operator/image/image_random.cc:L205
Arguments
data::NDArray-or-SymbolicNode
: The input.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_normalize
— Method.
_image_normalize(data, mean, std)
Normalize an tensor of shape (C x H x W) or (N x C x H x W) with mean and standard deviation.
Given mean `(m1, ..., mn)` and std `(s\ :sub:`1`\ , ..., s\ :sub:`n`)` for `n` channels,
this transform normalizes each channel of the input tensor with:
.. math::
output[i] = (input[i] - m\ :sub:`i`\ ) / s\ :sub:`i`
If mean or std is scalar, the same value will be applied to all channels.
Default value for mean is 0.0 and stand deviation is 1.0.
Example:
.. code-block:: python
image = mx.nd.random.uniform(0, 1, (3, 4, 2))
normalize(image, mean=(0, 1, 2), std=(3, 2, 1))
[[[ 0.18293785 0.19761486]
[ 0.23839645 0.28142193]
[ 0.20092112 0.28598186]
[ 0.18162774 0.28241724]]
[[-0.2881726 -0.18821815]
[-0.17705294 -0.30780914]
[-0.2812064 -0.3512327 ]
[-0.05411351 -0.4716435 ]]
[[-1.0363373 -1.7273437 ]
[-1.6165586 -1.5223348 ]
[-1.208275 -1.1878313 ]
[-1.4711051 -1.5200229 ]]]
<NDArray 3x4x2 @cpu(0)>
image = mx.nd.random.uniform(0, 1, (2, 3, 4, 2))
normalize(image, mean=(0, 1, 2), std=(3, 2, 1))
[[[[ 0.18934818 0.13092826]
[ 0.3085322 0.27869293]
[ 0.02367868 0.11246539]
[ 0.0290431 0.2160573 ]]
[[-0.4898908 -0.31587923]
[-0.08369008 -0.02142242]
[-0.11092162 -0.42982462]
[-0.06499392 -0.06495637]]
[[-1.0213816 -1.526392 ]
[-1.2008414 -1.1990893 ]
[-1.5385206 -1.4795225 ]
[-1.2194707 -1.3211205 ]]]
[[[ 0.03942481 0.24021089]
[ 0.21330701 0.1940066 ]
[ 0.04778443 0.17912441]
[ 0.31488964 0.25287187]]
[[-0.23907584 -0.4470462 ]
[-0.29266903 -0.2631998 ]
[-0.3677222 -0.40683383]
[-0.11288315 -0.13154092]]
[[-1.5438497 -1.7834496 ]
[-1.431566 -1.8647819 ]
[-1.9812102 -1.675859 ]
[-1.3823645 -1.8503251 ]]]]
<NDArray 2x3x4x2 @cpu(0)>
Defined in src/operator/image/image_random.cc:L167
Arguments
data::NDArray-or-SymbolicNode
: Input ndarraymean::tuple of <float>, optional, default=[0,0,0,0]
: Sequence of means for each channel. Default value is 0.std::tuple of <float>, optional, default=[1,1,1,1]
: Sequence of standard deviations for each channel. Default value is 1.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_random_brightness
— Method.
_image_random_brightness(data, min_factor, max_factor)
Defined in src/operator/image/image_random.cc:L215
Arguments
data::NDArray-or-SymbolicNode
: The input.min_factor::float, required
: Minimum factor.max_factor::float, required
: Maximum factor.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_random_color_jitter
— Method.
_image_random_color_jitter(data, brightness, contrast, saturation, hue)
Defined in src/operator/image/image_random.cc:L246
Arguments
data::NDArray-or-SymbolicNode
: The input.brightness::float, required
: How much to jitter brightness.contrast::float, required
: How much to jitter contrast.saturation::float, required
: How much to jitter saturation.hue::float, required
: How much to jitter hue.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_random_contrast
— Method.
_image_random_contrast(data, min_factor, max_factor)
Defined in src/operator/image/image_random.cc:L222
Arguments
data::NDArray-or-SymbolicNode
: The input.min_factor::float, required
: Minimum factor.max_factor::float, required
: Maximum factor.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_random_flip_left_right
— Method.
_image_random_flip_left_right(data)
Defined in src/operator/image/image_random.cc:L200
Arguments
data::NDArray-or-SymbolicNode
: The input.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_random_flip_top_bottom
— Method.
_image_random_flip_top_bottom(data)
Defined in src/operator/image/image_random.cc:L210
Arguments
data::NDArray-or-SymbolicNode
: The input.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_random_hue
— Method.
_image_random_hue(data, min_factor, max_factor)
Defined in src/operator/image/image_random.cc:L238
Arguments
data::NDArray-or-SymbolicNode
: The input.min_factor::float, required
: Minimum factor.max_factor::float, required
: Maximum factor.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_random_lighting
— Method.
_image_random_lighting(data, alpha_std)
Randomly add PCA noise. Follow the AlexNet style.
Defined in src/operator/image/image_random.cc:L262
Arguments
data::NDArray-or-SymbolicNode
: The input.alpha_std::float, optional, default=0.0500000007
: Level of the lighting noise.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_random_saturation
— Method.
_image_random_saturation(data, min_factor, max_factor)
Defined in src/operator/image/image_random.cc:L230
Arguments
data::NDArray-or-SymbolicNode
: The input.min_factor::float, required
: Minimum factor.max_factor::float, required
: Maximum factor.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_resize
— Method.
_image_resize(data, size, keep_ratio, interp)
Resize an image NDArray of shape (H x W x C) or (N x H x W x C) to the given size Example: .. code-block:: python image = mx.nd.random.uniform(0, 255, (4, 2, 3)).astype(dtype=np.uint8) mx.nd.image.resize(image, (3, 3)) [[[124 111 197] [158 80 155] [193 50 112]]
[[110 100 113]
[134 165 148]
[157 231 182]]
[[202 176 134]
[174 191 149]
[147 207 164]]]
<NDArray 3x3x3 @cpu(0)>
image = mx.nd.random.uniform(0, 255, (2, 4, 2, 3)).astype(dtype=np.uint8)
mx.nd.image.resize(image, (2, 2))
[[[[ 59 133 80]
[187 114 153]]
[[ 38 142 39]
[207 131 124]]]
[[[117 125 136]
[191 166 150]]
[[129 63 113]
[182 109 48]]]]
<NDArray 2x2x2x3 @cpu(0)>
Defined in src/operator/image/resize.cc:L70
Arguments
data::NDArray-or-SymbolicNode
: The input.size::Shape(tuple), optional, default=[]
: Size of new image. Could be (width, height) or (size)keep_ratio::boolean, optional, default=0
: Whether to resize the short edge or both edges tosize
, if size is give as an integer.interp::int, optional, default='1'
: Interpolation method for resizing. By default uses bilinear interpolationOptions are INTERNEAREST - a nearest-neighbor interpolationINTERLINEAR - a bilinear interpolationINTERAREA - resampling using pixel area relationINTERCUBIC - a bicubic interpolation over 4x4 pixel neighborhoodINTER_LANCZOS4 - a Lanczos interpolation over 8x8 pixel neighborhoodNote that the GPU version only support bilinear interpolation(1)name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._image_to_tensor
— Method.
_image_to_tensor(data)
Converts an image NDArray of shape (H x W x C) or (N x H x W x C) with values in the range [0, 255] to a tensor NDArray of shape (C x H x W) or (N x C x H x W) with values in the range [0, 1]
Example: .. code-block:: python image = mx.nd.random.uniform(0, 255, (4, 2, 3)).astype(dtype=np.uint8) to_tensor(image) [[[ 0.85490197 0.72156864] [ 0.09019608 0.74117649] [ 0.61960787 0.92941177] [ 0.96470588 0.1882353 ]] [[ 0.6156863 0.73725492] [ 0.46666667 0.98039216] [ 0.44705883 0.45490196] [ 0.01960784 0.8509804 ]] [[ 0.39607844 0.03137255] [ 0.72156864 0.52941179] [ 0.16470589 0.7647059 ] [ 0.05490196 0.70588237]]]
image = mx.nd.random.uniform(0, 255, (2, 4, 2, 3)).astype(dtype=np.uint8)
to_tensor(image)
[[[[0.11764706 0.5803922 ]
[0.9411765 0.10588235]
[0.2627451 0.73333335]
[0.5647059 0.32156864]]
[[0.7176471 0.14117648]
[0.75686276 0.4117647 ]
[0.18431373 0.45490196]
[0.13333334 0.6156863 ]]
[[0.6392157 0.5372549 ]
[0.52156866 0.47058824]
[0.77254903 0.21568628]
[0.01568628 0.14901961]]]
[[[0.6117647 0.38431373]
[0.6784314 0.6117647 ]
[0.69411767 0.96862745]
[0.67058825 0.35686275]]
[[0.21960784 0.9411765 ]
[0.44705883 0.43529412]
[0.09803922 0.6666667 ]
[0.16862746 0.1254902 ]]
[[0.6156863 0.9019608 ]
[0.35686275 0.9019608 ]
[0.05882353 0.6509804 ]
[0.20784314 0.7490196 ]]]]
<NDArray 2x3x4x2 @cpu(0)>
Defined in src/operator/image/image_random.cc:L92
Arguments
data::NDArray-or-SymbolicNode
: Input ndarrayname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._imdecode
— Method.
_imdecode(mean, index, x0, y0, x1, y1, c, size)
Decode an image, clip to (x0, y0, x1, y1), subtract mean, and write to buffer
Arguments
mean::NDArray-or-SymbolicNode
: image meanindex::int
: buffer position for outputx0::int
: x0y0::int
: y0x1::int
: x1y1::int
: y1c::int
: channelsize::int
: length of str_imgname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._lesser
— Method.
_lesser(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._lesser_equal
— Method.
_lesser_equal(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._lesser_equal_scalar
— Method.
_lesser_equal_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._lesser_scalar
— Method.
_lesser_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_det
— Method.
_linalg_det(A)
Compute the determinant of a matrix. Input is a tensor A of dimension n >= 2.
If n=2, A is a square matrix. We compute:
out = det(A)
If n>2, det is performed separately on the trailing two dimensions for all inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only. .. note:: There is no gradient backwarded when A is non-invertible (which is equivalent to det(A) = 0) because zero is rarely hit upon in float point computation and the Jacobi's formula on determinant gradient is not computationally efficient when A is non-invertible.
Examples::
Single matrix determinant A = [[1., 4.], [2., 3.]] det(A) = [-5.]
Batch matrix determinant A = [[[1., 4.], [2., 3.]], [[2., 3.], [1., 4.]]] det(A) = [-5., 5.]
Defined in src/operator/tensor/la_op.cc:L974
Arguments
A::NDArray-or-SymbolicNode
: Tensor of square matrixname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_extractdiag
— Method.
_linalg_extractdiag(A, offset)
Extracts the diagonal entries of a square matrix. Input is a tensor A of dimension n >= 2.
If n=2, then A represents a single square matrix which diagonal elements get extracted as a 1-dimensional tensor.
If n>2, then A represents a batch of square matrices on the trailing two dimensions. The extracted diagonals are returned as an n-1-dimensional tensor.
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single matrix diagonal extraction
A = [[1.0, 2.0],
[3.0, 4.0]]
extractdiag(A) = [1.0, 4.0]
extractdiag(A, 1) = [2.0]
Batch matrix diagonal extraction
A = [[[1.0, 2.0],
[3.0, 4.0]],
[[5.0, 6.0],
[7.0, 8.0]]]
extractdiag(A) = [[1.0, 4.0],
[5.0, 8.0]]
Defined in src/operator/tensor/la_op.cc:L494
Arguments
A::NDArray-or-SymbolicNode
: Tensor of square matricesoffset::int, optional, default='0'
: Offset of the diagonal versus the main diagonal. 0 corresponds to the main diagonal, a negative/positive value to diagonals below/above the main diagonal.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_extracttrian
— Method.
_linalg_extracttrian(A, offset, lower)
Extracts a triangular sub-matrix from a square matrix. Input is a tensor A of dimension n >= 2.
If n=2, then A represents a single square matrix from which a triangular sub-matrix is extracted as a 1-dimensional tensor.
If n>2, then A represents a batch of square matrices on the trailing two dimensions. The extracted triangular sub-matrices are returned as an n-1-dimensional tensor.
The offset and lower parameters determine the triangle to be extracted:
- When offset = 0 either the lower or upper triangle with respect to the main diagonal is extracted depending on the value of parameter lower.
- When offset = k > 0 the upper triangle with respect to the k-th diagonal above the main diagonal is extracted.
- When offset = k < 0 the lower triangle with respect to the k-th diagonal below the main diagonal is extracted.
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single triagonal extraction
A = [[1.0, 2.0],
[3.0, 4.0]]
extracttrian(A) = [1.0, 3.0, 4.0]
extracttrian(A, lower=False) = [1.0, 2.0, 4.0]
extracttrian(A, 1) = [2.0]
extracttrian(A, -1) = [3.0]
Batch triagonal extraction
A = [[[1.0, 2.0],
[3.0, 4.0]],
[[5.0, 6.0],
[7.0, 8.0]]]
extracttrian(A) = [[1.0, 3.0, 4.0],
[5.0, 7.0, 8.0]]
Defined in src/operator/tensor/la_op.cc:L604
Arguments
A::NDArray-or-SymbolicNode
: Tensor of square matricesoffset::int, optional, default='0'
: Offset of the diagonal versus the main diagonal. 0 corresponds to the main diagonal, a negative/positive value to diagonals below/above the main diagonal.lower::boolean, optional, default=1
: Refer to the lower triangular matrix if lower=true, refer to the upper otherwise. Only relevant when offset=0name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_gelqf
— Method.
_linalg_gelqf(A)
LQ factorization for general matrix. Input is a tensor A of dimension n >= 2.
If n=2, we compute the LQ factorization (LAPACK gelqf, followed by orglq). A must have shape (x, y) with x <= y, and must have full rank =x. The LQ factorization consists of L with shape (x, x) and Q with shape (x, y), so that:
A = L * Q
Here, L is lower triangular (upper triangle equal to zero) with nonzero diagonal, and Q is row-orthonormal, meaning that
Q * Q\ :sup:T
is equal to the identity matrix of shape (x, x).
If n>2, gelqf is performed separately on the trailing two dimensions for all inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single LQ factorization A = [[1., 2., 3.], [4., 5., 6.]] Q, L = gelqf(A) Q = [[-0.26726124, -0.53452248, -0.80178373], [0.87287156, 0.21821789, -0.43643578]] L = [[-3.74165739, 0.], [-8.55235974, 1.96396101]]
Batch LQ factorization A = [[[1., 2., 3.], [4., 5., 6.]], [[7., 8., 9.], [10., 11., 12.]]] Q, L = gelqf(A) Q = [[[-0.26726124, -0.53452248, -0.80178373], [0.87287156, 0.21821789, -0.43643578]], [[-0.50257071, -0.57436653, -0.64616234], [0.7620735, 0.05862104, -0.64483142]]] L = [[[-3.74165739, 0.], [-8.55235974, 1.96396101]], [[-13.92838828, 0.], [-19.09768702, 0.52758934]]]
Defined in src/operator/tensor/la_op.cc:L797
Arguments
A::NDArray-or-SymbolicNode
: Tensor of input matrices to be factorizedname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_gemm
— Method.
_linalg_gemm(A, B, C, transpose_a, transpose_b, alpha, beta, axis)
Performs general matrix multiplication and accumulation. Input are tensors A, B, C, each of dimension n >= 2 and having the same shape on the leading n-2 dimensions.
If n=2, the BLAS3 function gemm is performed:
out = alpha * op\ (A) * op\ (B) + beta * C
Here, alpha and beta are scalar parameters, and op() is either the identity or matrix transposition (depending on transpose_a, transpose_b).
If n>2, gemm is performed separately for a batch of matrices. The column indices of the matrices are given by the last dimensions of the tensors, the row indices by the axis specified with the axis parameter. By default, the trailing two dimensions will be used for matrix encoding.
For a non-default axis parameter, the operation performed is equivalent to a series of swapaxes/gemm/swapaxes calls. For example let A, B, C be 5 dimensional tensors. Then gemm(A, B, C, axis=1) is equivalent to the following without the overhead of the additional swapaxis operations::
A1 = swapaxes(A, dim1=1, dim2=3)
B1 = swapaxes(B, dim1=1, dim2=3)
C = swapaxes(C, dim1=1, dim2=3)
C = gemm(A1, B1, C)
C = swapaxis(C, dim1=1, dim2=3)
When the input data is of type float32 and the environment variables MXNETCUDAALLOWTENSORCORE and MXNETCUDATENSOROPMATHALLOWCONVERSION are set to 1, this operator will try to use pseudo-float16 precision (float32 math with float16 I/O) precision in order to use Tensor Cores on suitable NVIDIA GPUs. This can sometimes give significant speedups.
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single matrix multiply-add A = [[1.0, 1.0], [1.0, 1.0]] B = [[1.0, 1.0], [1.0, 1.0], [1.0, 1.0]] C = [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]] gemm(A, B, C, transpose_b=True, alpha=2.0, beta=10.0) = [[14.0, 14.0, 14.0], [14.0, 14.0, 14.0]]
Batch matrix multiply-add A = [[[1.0, 1.0]], [[0.1, 0.1]]] B = [[[1.0, 1.0]], [[0.1, 0.1]]] C = [[[10.0]], [[0.01]]] gemm(A, B, C, transpose_b=True, alpha=2.0 , beta=10.0) = [[[104.0]], [[0.14]]]
Defined in src/operator/tensor/la_op.cc:L88
Arguments
A::NDArray-or-SymbolicNode
: Tensor of input matricesB::NDArray-or-SymbolicNode
: Tensor of input matricesC::NDArray-or-SymbolicNode
: Tensor of input matricestranspose_a::boolean, optional, default=0
: Multiply with transposed of first input (A).transpose_b::boolean, optional, default=0
: Multiply with transposed of second input (B).alpha::double, optional, default=1
: Scalar factor multiplied with A*B.beta::double, optional, default=1
: Scalar factor multiplied with C.axis::int, optional, default='-2'
: Axis corresponding to the matrix rows.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_gemm2
— Method.
_linalg_gemm2(A, B, transpose_a, transpose_b, alpha, axis)
Performs general matrix multiplication. Input are tensors A, B, each of dimension n >= 2 and having the same shape on the leading n-2 dimensions.
If n=2, the BLAS3 function gemm is performed:
out = alpha * op\ (A) * op\ (B)
Here alpha is a scalar parameter and op() is either the identity or the matrix transposition (depending on transpose_a, transpose_b).
If n>2, gemm is performed separately for a batch of matrices. The column indices of the matrices are given by the last dimensions of the tensors, the row indices by the axis specified with the axis parameter. By default, the trailing two dimensions will be used for matrix encoding.
For a non-default axis parameter, the operation performed is equivalent to a series of swapaxes/gemm/swapaxes calls. For example let A, B be 5 dimensional tensors. Then gemm(A, B, axis=1) is equivalent to the following without the overhead of the additional swapaxis operations::
A1 = swapaxes(A, dim1=1, dim2=3)
B1 = swapaxes(B, dim1=1, dim2=3)
C = gemm2(A1, B1)
C = swapaxis(C, dim1=1, dim2=3)
When the input data is of type float32 and the environment variables MXNETCUDAALLOWTENSORCORE and MXNETCUDATENSOROPMATHALLOWCONVERSION are set to 1, this operator will try to use pseudo-float16 precision (float32 math with float16 I/O) precision in order to use Tensor Cores on suitable NVIDIA GPUs. This can sometimes give significant speedups.
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single matrix multiply A = [[1.0, 1.0], [1.0, 1.0]] B = [[1.0, 1.0], [1.0, 1.0], [1.0, 1.0]] gemm2(A, B, transpose_b=True, alpha=2.0) = [[4.0, 4.0, 4.0], [4.0, 4.0, 4.0]]
Batch matrix multiply A = [[[1.0, 1.0]], [[0.1, 0.1]]] B = [[[1.0, 1.0]], [[0.1, 0.1]]] gemm2(A, B, transpose_b=True, alpha=2.0) = [[[4.0]], [[0.04 ]]]
Defined in src/operator/tensor/la_op.cc:L162
Arguments
A::NDArray-or-SymbolicNode
: Tensor of input matricesB::NDArray-or-SymbolicNode
: Tensor of input matricestranspose_a::boolean, optional, default=0
: Multiply with transposed of first input (A).transpose_b::boolean, optional, default=0
: Multiply with transposed of second input (B).alpha::double, optional, default=1
: Scalar factor multiplied with A*B.axis::int, optional, default='-2'
: Axis corresponding to the matrix row indices.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_inverse
— Method.
_linalg_inverse(A)
Compute the inverse of a matrix. Input is a tensor A of dimension n >= 2.
If n=2, A is a square matrix. We compute:
out = A\ :sup:-1
If n>2, inverse is performed separately on the trailing two dimensions for all inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single matrix inverse A = [[1., 4.], [2., 3.]] inverse(A) = [[-0.6, 0.8], [0.4, -0.2]]
Batch matrix inverse A = [[[1., 4.], [2., 3.]], [[1., 3.], [2., 4.]]] inverse(A) = [[[-0.6, 0.8], [0.4, -0.2]], [[-2., 1.5], [1., -0.5]]]
Defined in src/operator/tensor/la_op.cc:L919
Arguments
A::NDArray-or-SymbolicNode
: Tensor of square matrixname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_makediag
— Method.
_linalg_makediag(A, offset)
Constructs a square matrix with the input as diagonal. Input is a tensor A of dimension n >= 1.
If n=1, then A represents the diagonal entries of a single square matrix. This matrix will be returned as a 2-dimensional tensor. If n>1, then A represents a batch of diagonals of square matrices. The batch of diagonal matrices will be returned as an n+1-dimensional tensor.
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single diagonal matrix construction
A = [1.0, 2.0]
makediag(A) = [[1.0, 0.0],
[0.0, 2.0]]
makediag(A, 1) = [[0.0, 1.0, 0.0],
[0.0, 0.0, 2.0],
[0.0, 0.0, 0.0]]
Batch diagonal matrix construction
A = [[1.0, 2.0],
[3.0, 4.0]]
makediag(A) = [[[1.0, 0.0],
[0.0, 2.0]],
[[3.0, 0.0],
[0.0, 4.0]]]
Defined in src/operator/tensor/la_op.cc:L546
Arguments
A::NDArray-or-SymbolicNode
: Tensor of diagonal entriesoffset::int, optional, default='0'
: Offset of the diagonal versus the main diagonal. 0 corresponds to the main diagonal, a negative/positive value to diagonals below/above the main diagonal.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_maketrian
— Method.
_linalg_maketrian(A, offset, lower)
Constructs a square matrix with the input representing a specific triangular sub-matrix. This is basically the inverse of linalg.extracttrian. Input is a tensor A of dimension n >= 1.
If n=1, then A represents the entries of a triangular matrix which is lower triangular if offset<0 or offset=0, lower=true. The resulting matrix is derived by first constructing the square matrix with the entries outside the triangle set to zero and then adding offset-times an additional diagonal with zero entries to the square matrix.
If n>1, then A represents a batch of triangular sub-matrices. The batch of corresponding square matrices is returned as an n+1-dimensional tensor.
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single matrix construction
A = [1.0, 2.0, 3.0]
maketrian(A) = [[1.0, 0.0],
[2.0, 3.0]]
maketrian(A, lower=false) = [[1.0, 2.0],
[0.0, 3.0]]
maketrian(A, offset=1) = [[0.0, 1.0, 2.0],
[0.0, 0.0, 3.0],
[0.0, 0.0, 0.0]]
maketrian(A, offset=-1) = [[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
[2.0, 3.0, 0.0]]
Batch matrix construction
A = [[1.0, 2.0, 3.0],
[4.0, 5.0, 6.0]]
maketrian(A) = [[[1.0, 0.0],
[2.0, 3.0]],
[[4.0, 0.0],
[5.0, 6.0]]]
maketrian(A, offset=1) = [[[0.0, 1.0, 2.0],
[0.0, 0.0, 3.0],
[0.0, 0.0, 0.0]],
[[0.0, 4.0, 5.0],
[0.0, 0.0, 6.0],
[0.0, 0.0, 0.0]]]
Defined in src/operator/tensor/la_op.cc:L672
Arguments
A::NDArray-or-SymbolicNode
: Tensor of triangular matrices stored as vectorsoffset::int, optional, default='0'
: Offset of the diagonal versus the main diagonal. 0 corresponds to the main diagonal, a negative/positive value to diagonals below/above the main diagonal.lower::boolean, optional, default=1
: Refer to the lower triangular matrix if lower=true, refer to the upper otherwise. Only relevant when offset=0name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_potrf
— Method.
_linalg_potrf(A)
Performs Cholesky factorization of a symmetric positive-definite matrix. Input is a tensor A of dimension n >= 2.
If n=2, the Cholesky factor B of the symmetric, positive definite matrix A is computed. B is triangular (entries of upper or lower triangle are all zero), has positive diagonal entries, and:
A = B * B\ :sup:T
if lower = true A = B\ :sup:T
* B if lower = false
If n>2, potrf is performed separately on the trailing two dimensions for all inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single matrix factorization A = [[4.0, 1.0], [1.0, 4.25]] potrf(A) = [[2.0, 0], [0.5, 2.0]]
Batch matrix factorization A = [[[4.0, 1.0], [1.0, 4.25]], [[16.0, 4.0], [4.0, 17.0]]] potrf(A) = [[[2.0, 0], [0.5, 2.0]], [[4.0, 0], [1.0, 4.0]]]
Defined in src/operator/tensor/la_op.cc:L213
Arguments
A::NDArray-or-SymbolicNode
: Tensor of input matrices to be decomposedname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_potri
— Method.
_linalg_potri(A)
Performs matrix inversion from a Cholesky factorization. Input is a tensor A of dimension n >= 2.
If n=2, A is a triangular matrix (entries of upper or lower triangle are all zero) with positive diagonal. We compute:
out = A\ :sup:-T
* A\ :sup:-1
if lower = true out = A\ :sup:-1
* A\ :sup:-T
if lower = false
In other words, if A is the Cholesky factor of a symmetric positive definite matrix B (obtained by potrf), then
out = B\ :sup:-1
If n>2, potri is performed separately on the trailing two dimensions for all inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only.
.. note:: Use this operator only if you are certain you need the inverse of B, and cannot use the Cholesky factor A (potrf), together with backsubstitution (trsm). The latter is numerically much safer, and also cheaper.
Examples::
Single matrix inverse A = [[2.0, 0], [0.5, 2.0]] potri(A) = [[0.26563, -0.0625], [-0.0625, 0.25]]
Batch matrix inverse A = [[[2.0, 0], [0.5, 2.0]], [[4.0, 0], [1.0, 4.0]]] potri(A) = [[[0.26563, -0.0625], [-0.0625, 0.25]], [[0.06641, -0.01562], [-0.01562, 0,0625]]]
Defined in src/operator/tensor/la_op.cc:L274
Arguments
A::NDArray-or-SymbolicNode
: Tensor of lower triangular matricesname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_slogdet
— Method.
_linalg_slogdet(A)
Compute the sign and log of the determinant of a matrix. Input is a tensor A of dimension n >= 2.
If n=2, A is a square matrix. We compute:
sign = sign(det(A)) logabsdet = log(abs(det(A)))
If n>2, slogdet is performed separately on the trailing two dimensions for all inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only. .. note:: The gradient is not properly defined on sign, so the gradient of it is not backwarded. .. note:: No gradient is backwarded when A is non-invertible. Please see the docs of operator det for detail.
Examples::
Single matrix signed log determinant A = [[2., 3.], [1., 4.]] sign, logabsdet = slogdet(A) sign = [1.] logabsdet = [1.609438]
Batch matrix signed log determinant A = [[[2., 3.], [1., 4.]], [[1., 2.], [2., 4.]], [[1., 2.], [4., 3.]]] sign, logabsdet = slogdet(A) sign = [1., 0., -1.] logabsdet = [1.609438, -inf, 1.609438]
Defined in src/operator/tensor/la_op.cc:L1033
Arguments
A::NDArray-or-SymbolicNode
: Tensor of square matrixname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_sumlogdiag
— Method.
_linalg_sumlogdiag(A)
Computes the sum of the logarithms of the diagonal elements of a square matrix. Input is a tensor A of dimension n >= 2.
If n=2, A must be square with positive diagonal entries. We sum the natural logarithms of the diagonal elements, the result has shape (1,).
If n>2, sumlogdiag is performed separately on the trailing two dimensions for all inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single matrix reduction A = [[1.0, 1.0], [1.0, 7.0]] sumlogdiag(A) = [1.9459]
Batch matrix reduction A = [[[1.0, 1.0], [1.0, 7.0]], [[3.0, 0], [0, 17.0]]] sumlogdiag(A) = [1.9459, 3.9318]
Defined in src/operator/tensor/la_op.cc:L444
Arguments
A::NDArray-or-SymbolicNode
: Tensor of square matricesname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_syevd
— Method.
_linalg_syevd(A)
Eigendecomposition for symmetric matrix. Input is a tensor A of dimension n >= 2.
If n=2, A must be symmetric, of shape (x, x). We compute the eigendecomposition, resulting in the orthonormal matrix U of eigenvectors, shape (x, x), and the vector L of eigenvalues, shape (x,), so that:
U * A = diag(L) * U
Here:
U * U\ :sup:T
= U\ :sup:T
* U = I
where I is the identity matrix. Also, L(0) <= L(1) <= L(2) <= ... (ascending order).
If n>2, syevd is performed separately on the trailing two dimensions of A (batch mode). In this case, U has n dimensions like A, and L has n-1 dimensions.
.. note:: The operator supports float32 and float64 data types only.
.. note:: Derivatives for this operator are defined only if A is such that all its eigenvalues are distinct, and the eigengaps are not too small. If you need gradients, do not apply this operator to matrices with multiple eigenvalues.
Examples::
Single symmetric eigendecomposition A = [[1., 2.], [2., 4.]] U, L = syevd(A) U = [[0.89442719, -0.4472136], [0.4472136, 0.89442719]] L = [0., 5.]
Batch symmetric eigendecomposition A = [[[1., 2.], [2., 4.]], [[1., 2.], [2., 5.]]] U, L = syevd(A) U = [[[0.89442719, -0.4472136], [0.4472136, 0.89442719]], [[0.92387953, -0.38268343], [0.38268343, 0.92387953]]] L = [[0., 5.], [0.17157288, 5.82842712]]
Defined in src/operator/tensor/la_op.cc:L867
Arguments
A::NDArray-or-SymbolicNode
: Tensor of input matrices to be factorizedname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_syrk
— Method.
_linalg_syrk(A, transpose, alpha)
Multiplication of matrix with its transpose. Input is a tensor A of dimension n >= 2.
If n=2, the operator performs the BLAS3 function syrk:
out = alpha * A * A\ :sup:T
if transpose=False, or
out = alpha * A\ :sup:T
\ * A
if transpose=True.
If n>2, syrk is performed separately on the trailing two dimensions for all inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single matrix multiply A = [[1., 2., 3.], [4., 5., 6.]] syrk(A, alpha=1., transpose=False) = [[14., 32.], [32., 77.]] syrk(A, alpha=1., transpose=True) = [[17., 22., 27.], [22., 29., 36.], [27., 36., 45.]]
Batch matrix multiply A = [[[1., 1.]], [[0.1, 0.1]]] syrk(A, alpha=2., transpose=False) = [[[4.]], [[0.04]]]
Defined in src/operator/tensor/la_op.cc:L729
Arguments
A::NDArray-or-SymbolicNode
: Tensor of input matricestranspose::boolean, optional, default=0
: Use transpose of input matrix.alpha::double, optional, default=1
: Scalar factor to be applied to the result.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_trmm
— Method.
_linalg_trmm(A, B, transpose, rightside, lower, alpha)
Performs multiplication with a lower triangular matrix. Input are tensors A, B, each of dimension n >= 2 and having the same shape on the leading n-2 dimensions.
If n=2, A must be triangular. The operator performs the BLAS3 function trmm:
out = alpha * op\ (A) * B
if rightside=False, or
out = alpha * B * op\ (A)
if rightside=True. Here, alpha is a scalar parameter, and op() is either the identity or the matrix transposition (depending on transpose).
If n>2, trmm is performed separately on the trailing two dimensions for all inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single triangular matrix multiply A = [[1.0, 0], [1.0, 1.0]] B = [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]] trmm(A, B, alpha=2.0) = [[2.0, 2.0, 2.0], [4.0, 4.0, 4.0]]
Batch triangular matrix multiply A = [[[1.0, 0], [1.0, 1.0]], [[1.0, 0], [1.0, 1.0]]] B = [[[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]], [[0.5, 0.5, 0.5], [0.5, 0.5, 0.5]]] trmm(A, B, alpha=2.0) = [[[2.0, 2.0, 2.0], [4.0, 4.0, 4.0]], [[1.0, 1.0, 1.0], [2.0, 2.0, 2.0]]]
Defined in src/operator/tensor/la_op.cc:L332
Arguments
A::NDArray-or-SymbolicNode
: Tensor of lower triangular matricesB::NDArray-or-SymbolicNode
: Tensor of matricestranspose::boolean, optional, default=0
: Use transposed of the triangular matrixrightside::boolean, optional, default=0
: Multiply triangular matrix from the right to non-triangular one.lower::boolean, optional, default=1
: True if the triangular matrix is lower triangular, false if it is upper triangular.alpha::double, optional, default=1
: Scalar factor to be applied to the result.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._linalg_trsm
— Method.
_linalg_trsm(A, B, transpose, rightside, lower, alpha)
Solves matrix equation involving a lower triangular matrix. Input are tensors A, B, each of dimension n >= 2 and having the same shape on the leading n-2 dimensions.
If n=2, A must be triangular. The operator performs the BLAS3 function trsm, solving for out in:
op\ (A) * out = alpha * B
if rightside=False, or
out * op\ (A) = alpha * B
if rightside=True. Here, alpha is a scalar parameter, and op() is either the identity or the matrix transposition (depending on transpose).
If n>2, trsm is performed separately on the trailing two dimensions for all inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single matrix solve A = [[1.0, 0], [1.0, 1.0]] B = [[2.0, 2.0, 2.0], [4.0, 4.0, 4.0]] trsm(A, B, alpha=0.5) = [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]]
Batch matrix solve A = [[[1.0, 0], [1.0, 1.0]], [[1.0, 0], [1.0, 1.0]]] B = [[[2.0, 2.0, 2.0], [4.0, 4.0, 4.0]], [[4.0, 4.0, 4.0], [8.0, 8.0, 8.0]]] trsm(A, B, alpha=0.5) = [[[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]], [[2.0, 2.0, 2.0], [2.0, 2.0, 2.0]]]
Defined in src/operator/tensor/la_op.cc:L395
Arguments
A::NDArray-or-SymbolicNode
: Tensor of lower triangular matricesB::NDArray-or-SymbolicNode
: Tensor of matricestranspose::boolean, optional, default=0
: Use transposed of the triangular matrixrightside::boolean, optional, default=0
: Multiply triangular matrix from the right to non-triangular one.lower::boolean, optional, default=1
: True if the triangular matrix is lower triangular, false if it is upper triangular.alpha::double, optional, default=1
: Scalar factor to be applied to the result.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._logical_and
— Method.
_logical_and(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._logical_and_scalar
— Method.
_logical_and_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._logical_or
— Method.
_logical_or(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._logical_or_scalar
— Method.
_logical_or_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._logical_xor
— Method.
_logical_xor(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._logical_xor_scalar
— Method.
_logical_xor_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._maximum_scalar
— Method.
_maximum_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._minimum_scalar
— Method.
_minimum_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._minus
— Method.
_minus(lhs, rhs)
minus is an alias of elemwisesub.
Subtracts arguments element-wise.
The storage type of $elemwise_sub$ output depends on storage types of inputs
- elemwisesub(rowsparse, rowsparse) = rowsparse
- elemwise_sub(csr, csr) = csr
- elemwise_sub(default, csr) = default
- elemwise_sub(csr, default) = default
- elemwise_sub(default, rsp) = default
- elemwise_sub(rsp, default) = default
- otherwise, $elemwise_sub$ generates output with default storage
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._minus_scalar
— Method.
_minus_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._mod
— Method.
_mod(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._mod_scalar
— Method.
_mod_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._mp_adamw_update
— Method.
_mp_adamw_update(weight, grad, mean, var, weight32, rescale_grad, lr, beta1, beta2, epsilon, wd, eta, clip_gradient)
Update function for multi-precision AdamW optimizer.
AdamW is seen as a modification of Adam by decoupling the weight decay from the optimization steps taken w.r.t. the loss function.
Adam update consists of the following steps, where g represents gradient and m, v are 1st and 2nd order moment estimates (mean and variance).
.. math::
gt = \nabla J(W)\ mt = \beta1 m{t-1} + (1 - \beta1) gt\ vt = \beta2 v + (1 - \beta2) gt^2\ Wt = W - \etat (\alpha \frac{ mt }{ \sqrt{ vt } + \epsilon } + wd W)
It updates the weights using::
m = beta1m + (1-beta1)grad v = beta2v + (1-beta2)(grad**2) w -= eta * (learning_rate * m / (sqrt(v) + epsilon) + w * wd)
Note that gradient is rescaled to grad = rescalegrad * grad. If rescalegrad is NaN, Inf, or 0, the update is skipped.
Defined in src/operator/contrib/adamw.cc:L57
Arguments
weight::NDArray-or-SymbolicNode
: Weightgrad::NDArray-or-SymbolicNode
: Gradientmean::NDArray-or-SymbolicNode
: Moving meanvar::NDArray-or-SymbolicNode
: Moving varianceweight32::NDArray-or-SymbolicNode
: Weight32rescale_grad::NDArray-or-SymbolicNode
: Rescale gradient to rescale_grad * grad. If NaN, Inf, or 0, the update is skipped.lr::float, required
: Learning ratebeta1::float, optional, default=0.899999976
: The decay rate for the 1st moment estimates.beta2::float, optional, default=0.999000013
: The decay rate for the 2nd moment estimates.epsilon::float, optional, default=9.99999994e-09
: A small constant for numerical stability.wd::float, optional, default=0
: Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.eta::float, required
: Learning rate schedule multiplierclip_gradient::float, optional, default=-1
: Clip gradient to the range of [-clipgradient, clipgradient] If clipgradient <= 0, gradient clipping is turned off. grad = max(min(grad, clipgradient), -clip_gradient).name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._mul
— Method.
_mul(lhs, rhs)
mul is an alias of elemwisemul.
Multiplies arguments element-wise.
The storage type of $elemwise_mul$ output depends on storage types of inputs
- elemwise_mul(default, default) = default
- elemwisemul(rowsparse, rowsparse) = rowsparse
- elemwisemul(default, rowsparse) = row_sparse
- elemwisemul(rowsparse, default) = row_sparse
- elemwise_mul(csr, csr) = csr
- otherwise, $elemwise_mul$ generates output with default storage
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._mul_scalar
— Method.
_mul_scalar(data, scalar, is_int)
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 src/operator/tensor/elemwisebinaryscalaropbasic.cc:L152
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._multi_adamw_update
— Method.
_multi_adamw_update(data, lrs, beta1, beta2, epsilon, wds, etas, clip_gradient, num_weights)
Update function for AdamW optimizer.
AdamW is seen as a modification of Adam by decoupling the weight decay from the optimization steps taken w.r.t. the loss function.
Adam update consists of the following steps, where g represents gradient and m, v are 1st and 2nd order moment estimates (mean and variance).
.. math::
gt = \nabla J(W)\ mt = \beta1 m{t-1} + (1 - \beta1) gt\ vt = \beta2 v + (1 - \beta2) gt^2\ Wt = W - \etat (\alpha \frac{ mt }{ \sqrt{ vt } + \epsilon } + wd W)
It updates the weights using::
m = beta1m + (1-beta1)grad v = beta2v + (1-beta2)(grad**2) w -= eta * (learning_rate * m / (sqrt(v) + epsilon) + w * wd)
Note that gradient is rescaled to grad = rescalegrad * grad. If rescalegrad is NaN, Inf, or 0, the update is skipped.
Defined in src/operator/contrib/adamw.cc:L166
Arguments
data::NDArray-or-SymbolicNode[]
: datalrs::tuple of <float>, required
: Learning ratesbeta1::float, optional, default=0.899999976
: The decay rate for the 1st moment estimates.beta2::float, optional, default=0.999000013
: The decay rate for the 2nd moment estimates.epsilon::float, optional, default=9.99999994e-09
: A small constant for numerical stability.wds::tuple of <float>, required
: Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.etas::tuple of <float>, required
: Learning rates schedule multiplierclip_gradient::float, optional, default=-1
: Clip gradient to the range of [-clipgradient, clipgradient] If clipgradient <= 0, gradient clipping is turned off. grad = max(min(grad, clipgradient), -clip_gradient).num_weights::int, optional, default='1'
: Number of updated weights.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._multi_lamb_update
— Method.
_multi_lamb_update(data, learning_rates, beta1, beta2, epsilon, wds, rescale_grad, lower_bound, upper_bound, clip_gradient, bias_correction, step_count, num_tensors)
Compute the LAMB coefficients of multiple weights and grads"
Defined in src/operator/contrib/multi_lamb.cc:L175
Arguments
data::NDArray-or-SymbolicNode[]
: datalearning_rates::tuple of <float>, required
: List of learning ratesbeta1::float, optional, default=0.899999976
: Exponential decay rate for the first moment estimates.beta2::float, optional, default=0.999000013
: Exponential decay rate for the second moment estimates.epsilon::float, optional, default=9.99999997e-07
: Small value to avoid division by 0.wds::tuple of <float>, required
: List of Weight decays.Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.rescale_grad::float, optional, default=1
: Gradient rescaling factorlower_bound::float, optional, default=-1
: Lower limit of norm of weight. If lower_bound <= 0, Lower limit is not setupper_bound::float, optional, default=-1
: Upper limit of norm of weight. If upper_bound <= 0, Upper limit is not setclip_gradient::float, optional, default=-1
: Clip gradient to the range of [-clipgradient, clipgradient] If clipgradient <= 0, gradient clipping is turned off. grad = max(min(grad, clipgradient), -clip_gradient).bias_correction::boolean, optional, default=1
: Whether to use bias correction.step_count::Shape(tuple), required
: Step count for each tensornum_tensors::int, optional, default='1'
: Number of tensorsname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._multi_mp_adamw_update
— Method.
_multi_mp_adamw_update(data, lrs, beta1, beta2, epsilon, wds, etas, clip_gradient, num_weights)
Update function for multi-precision AdamW optimizer.
AdamW is seen as a modification of Adam by decoupling the weight decay from the optimization steps taken w.r.t. the loss function.
Adam update consists of the following steps, where g represents gradient and m, v are 1st and 2nd order moment estimates (mean and variance).
.. math::
gt = \nabla J(W)\ mt = \beta1 m{t-1} + (1 - \beta1) gt\ vt = \beta2 v + (1 - \beta2) gt^2\ Wt = W - \etat (\alpha \frac{ mt }{ \sqrt{ vt } + \epsilon } + wd W)
It updates the weights using::
m = beta1m + (1-beta1)grad v = beta2v + (1-beta2)(grad**2) w -= eta * (learning_rate * m / (sqrt(v) + epsilon) + w * wd)
Note that gradient is rescaled to grad = rescalegrad * grad. If rescalegrad is NaN, Inf, or 0, the update is skipped.
Defined in src/operator/contrib/adamw.cc:L222
Arguments
data::NDArray-or-SymbolicNode[]
: datalrs::tuple of <float>, required
: Learning ratesbeta1::float, optional, default=0.899999976
: The decay rate for the 1st moment estimates.beta2::float, optional, default=0.999000013
: The decay rate for the 2nd moment estimates.epsilon::float, optional, default=9.99999994e-09
: A small constant for numerical stability.wds::tuple of <float>, required
: Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.etas::tuple of <float>, required
: Learning rates schedule multiplierclip_gradient::float, optional, default=-1
: Clip gradient to the range of [-clipgradient, clipgradient] If clipgradient <= 0, gradient clipping is turned off. grad = max(min(grad, clipgradient), -clip_gradient).num_weights::int, optional, default='1'
: Number of updated weights.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._multi_mp_lamb_update
— Method.
_multi_mp_lamb_update(data, learning_rates, beta1, beta2, epsilon, wds, rescale_grad, lower_bound, upper_bound, clip_gradient, bias_correction, step_count, num_tensors)
Compute the LAMB coefficients of multiple weights and grads with Mix Precision"
Defined in src/operator/contrib/multi_lamb.cc:L213
Arguments
data::NDArray-or-SymbolicNode[]
: datalearning_rates::tuple of <float>, required
: List of learning ratesbeta1::float, optional, default=0.899999976
: Exponential decay rate for the first moment estimates.beta2::float, optional, default=0.999000013
: Exponential decay rate for the second moment estimates.epsilon::float, optional, default=9.99999997e-07
: Small value to avoid division by 0.wds::tuple of <float>, required
: List of Weight decays.Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.rescale_grad::float, optional, default=1
: Gradient rescaling factorlower_bound::float, optional, default=-1
: Lower limit of norm of weight. If lower_bound <= 0, Lower limit is not setupper_bound::float, optional, default=-1
: Upper limit of norm of weight. If upper_bound <= 0, Upper limit is not setclip_gradient::float, optional, default=-1
: Clip gradient to the range of [-clipgradient, clipgradient] If clipgradient <= 0, gradient clipping is turned off. grad = max(min(grad, clipgradient), -clip_gradient).bias_correction::boolean, optional, default=1
: Whether to use bias correction.step_count::Shape(tuple), required
: Step count for each tensornum_tensors::int, optional, default='1'
: Number of tensorsname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._not_equal
— Method.
_not_equal(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: first inputrhs::NDArray-or-SymbolicNode
: second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._not_equal_scalar
— Method.
_not_equal_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_all
— Method.
_np_all(data, axis, keepdims)
Arguments
data::NDArray-or-SymbolicNode
: Input ndarrayaxis::Shape or None, optional, default=None
: Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axes are left in the result as dimension with size one.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_amax
— Method.
_np_amax(a, axis, keepdims, initial)
npamax is an alias of npmax.
Defined in src/operator/numpy/npbroadcastreduceopvalue.cc:L169
Arguments
a::NDArray-or-SymbolicNode
: The inputaxis::Shape or None, optional, default=None
: Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axes are left in the result as dimension with size one.initial::double or None, optional, default=None
: Starting value for the sum.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_amin
— Method.
_np_amin(a, axis, keepdims, initial)
npamin is an alias of npmin.
Defined in src/operator/numpy/npbroadcastreduceopvalue.cc:L198
Arguments
a::NDArray-or-SymbolicNode
: The inputaxis::Shape or None, optional, default=None
: Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axes are left in the result as dimension with size one.initial::double or None, optional, default=None
: Starting value for the sum.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_any
— Method.
_np_any(data, axis, keepdims)
Arguments
data::NDArray-or-SymbolicNode
: Input ndarrayaxis::Shape or None, optional, default=None
: Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axes are left in the result as dimension with size one.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_atleast_1d
— Method.
_np_atleast_1d(arys, num_args)
Note: npatleast1d takes variable number of positional inputs. So instead of calling as _npatleast1d([x, y, z], numargs=3), one should call via npatleast1d(x, y, z), and numargs will be determined automatically.
Arguments
arys::NDArray-or-SymbolicNode[]
: List of input arraysnum_args::int, required
: Number of input arrays.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_atleast_2d
— Method.
_np_atleast_2d(arys, num_args)
Note: npatleast2d takes variable number of positional inputs. So instead of calling as _npatleast2d([x, y, z], numargs=3), one should call via npatleast2d(x, y, z), and numargs will be determined automatically.
Arguments
arys::NDArray-or-SymbolicNode[]
: List of input arraysnum_args::int, required
: Number of input arrays.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_atleast_3d
— Method.
_np_atleast_3d(arys, num_args)
Note: npatleast3d takes variable number of positional inputs. So instead of calling as _npatleast3d([x, y, z], numargs=3), one should call via npatleast3d(x, y, z), and numargs will be determined automatically.
Arguments
arys::NDArray-or-SymbolicNode[]
: List of input arraysnum_args::int, required
: Number of input arrays.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_copy
— Method.
_np_copy(a)
Return an array copy of the given object.
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L47
Arguments
a::NDArray-or-SymbolicNode
: The inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_cumsum
— Method.
_np_cumsum(a, axis, dtype)
Return the cumulative sum of the elements along a given axis.
Defined in src/operator/numpy/np_cumsum.cc:L70
Arguments
a::NDArray-or-SymbolicNode
: Input ndarrayaxis::int or None, optional, default='None'
: Axis along which the cumulative sum is computed. The default (None) is to compute the cumsum over the flattened array.dtype::{None, 'float16', 'float32', 'float64', 'int32', 'int64', 'int8'},optional, default='None'
: Type of the returned array and of the accumulator in which the elements are summed. If dtype is not specified, it defaults to the dtype of a, unless a has an integer dtype with a precision less than that of the default platform integer. In that case, the default platform integer is used.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_diag
— Method.
_np_diag(data, k)
Arguments
data::NDArray-or-SymbolicNode
: Input ndarrayk::int, optional, default='0'
: Diagonal in question. The default is 0. Use k>0 for diagonals above the main diagonal, and k<0 for diagonals below the main diagonal.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_diagflat
— Method.
_np_diagflat(data, k)
Arguments
data::NDArray-or-SymbolicNode
: Input ndarrayk::int, optional, default='0'
: Diagonal in question. The default is 0. Use k>0 for diagonals above the main diagonal, and k<0 for diagonals below the main diagonal.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_diagonal
— Method.
_np_diagonal(data, offset, axis1, axis2)
Arguments
data::NDArray-or-SymbolicNode
: Input ndarrayoffset::int, optional, default='0'
: Diagonal in question. The default is 0. Use k>0 for diagonals above the main diagonal, and k<0 for diagonals below the main diagonal. If input has shape (S0 S1) k must be between -S0 and S1axis1::int, optional, default='0'
: The first axis of the sub-arrays of interest. Ignored when the input is a 1-D array.axis2::int, optional, default='1'
: The second axis of the sub-arrays of interest. Ignored when the input is a 1-D array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_dot
— Method.
_np_dot(a, b)
Dot product of two arrays. Specifically,
- If both a and b are 1-D arrays, it is inner product of vectors.
- If both a and b are 2-D arrays, it is matrix multiplication.
- If either a or b is 0-D (scalar), it is equivalent to multiply and using numpy.multiply(a, b) or a * b is preferred.
- If a is an N-D array and b is a 1-D array, it is a sum product over the last axis of a and b.
-
If a is an N-D array and b is an M-D array (where M>=2), it is a sum product over the last axis of a and the second-to-last axis of b:
Example ::
dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m])
Defined in src/operator/numpy/np_dot.cc:L121
Arguments
a::NDArray-or-SymbolicNode
: First inputb::NDArray-or-SymbolicNode
: Second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_max
— Method.
_np_max(a, axis, keepdims, initial)
Defined in src/operator/numpy/npbroadcastreduceopvalue.cc:L169
Arguments
a::NDArray-or-SymbolicNode
: The inputaxis::Shape or None, optional, default=None
: Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axes are left in the result as dimension with size one.initial::double or None, optional, default=None
: Starting value for the sum.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_min
— Method.
_np_min(a, axis, keepdims, initial)
Defined in src/operator/numpy/npbroadcastreduceopvalue.cc:L198
Arguments
a::NDArray-or-SymbolicNode
: The inputaxis::Shape or None, optional, default=None
: Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axes are left in the result as dimension with size one.initial::double or None, optional, default=None
: Starting value for the sum.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_moveaxis
— Method.
_np_moveaxis(a, source, destination)
Move axes of an array to new positions. Other axes remain in their original order.
Defined in src/operator/numpy/npmatrixop.cc:L1263
Arguments
a::NDArray-or-SymbolicNode
: Source inputsource::Shape(tuple), required
: Original positions of the axes to move. These must be unique.destination::Shape(tuple), required
: Destination positions for each of the original axes. These must also be unique.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_prod
— Method.
_np_prod(axis, dtype, keepdims, initial, a)
Arguments
axis::Shape or None, optional, default=None
: Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.dtype::{None, 'bool', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8'},optional, default='None'
: The type of the returned array and of the accumulator in which the elements are summed. The dtype of a is used by default unless a has an integer dtype of less precision than the default platform integer. In that case, if a is signed then the platform integer is used while if a is unsigned then an unsigned integer of the same precision as the platform integer is used.keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axes are left in the result as dimension with size one.initial::double or None, optional, default=None
: Starting value for the sum.a::NDArray-or-SymbolicNode
: The inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_product
— Method.
_np_product(axis, dtype, keepdims, initial, a)
npproduct is an alias of npprod.
Arguments
axis::Shape or None, optional, default=None
: Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.dtype::{None, 'bool', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8'},optional, default='None'
: The type of the returned array and of the accumulator in which the elements are summed. The dtype of a is used by default unless a has an integer dtype of less precision than the default platform integer. In that case, if a is signed then the platform integer is used while if a is unsigned then an unsigned integer of the same precision as the platform integer is used.keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axes are left in the result as dimension with size one.initial::double or None, optional, default=None
: Starting value for the sum.a::NDArray-or-SymbolicNode
: The inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_repeat
— Method.
_np_repeat(data, repeats, axis)
nprepeat is an alias of repeat.
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 src/operator/tensor/matrix_op.cc:L743
Arguments
data::NDArray-or-SymbolicNode
: Input data arrayrepeats::int, required
: The number of repetitions for each element.axis::int or None, optional, default='None'
: 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.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_reshape
— Method.
_np_reshape(a, newshape, order)
Defined in src/operator/numpy/npmatrixop.cc:L356
Arguments
a::NDArray-or-SymbolicNode
: Array to be reshaped.newshape::Shape(tuple), required
: The new shape should be compatible with the original shape. If an integer, then the result will be a 1-D array of that length. One shape dimension can be -1. In this case, the value is inferred from the length of the array and remaining dimensions.order::string, optional, default='C'
: Read the elements of a using this index order, and place the elements into the reshaped array using this index order. 'C' means to read/write the elements using C-like index order, with the last axis index changing fastest, back to the first axis index changing slowest. Note that currently only C-like order is supportedname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_roll
— Method.
_np_roll(data, shift, axis)
Arguments
data::NDArray-or-SymbolicNode
: Input ndarrayshift::Shape or None, optional, default=None
: The number of places by which elements are shifted. If a tuple,then axis must be a tuple of the same size, and each of the given axes is shiftedby the corresponding number. If an int while axis is a tuple of ints, then the same value is used for all given axes.axis::Shape or None, optional, default=None
: Axis or axes along which elements are shifted. By default, the array is flattenedbefore shifting, after which the original shape is restored.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_sometrue
— Method.
_np_sometrue(data, axis, keepdims)
npsometrue is an alias of npany.
Arguments
data::NDArray-or-SymbolicNode
: Input ndarrayaxis::Shape or None, optional, default=None
: Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axes are left in the result as dimension with size one.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_squeeze
— Method.
_np_squeeze(a, axis)
Arguments
a::NDArray-or-SymbolicNode
: data to squeezeaxis::Shape or None, optional, default=None
: Selects a subset of the single-dimensional entries in the shape. If an axis is selected with shape entry greater than one, an error is raised.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_sum
— Method.
_np_sum(a, axis, dtype, keepdims, initial)
Defined in src/operator/numpy/npbroadcastreduceopvalue.cc:L129
Arguments
a::NDArray-or-SymbolicNode
: The inputaxis::Shape or None, optional, default=None
: Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.dtype::{None, 'bool', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8'},optional, default='None'
: The type of the returned array and of the accumulator in which the elements are summed. The dtype of a is used by default unless a has an integer dtype of less precision than the default platform integer. In that case, if a is signed then the platform integer is used while if a is unsigned then an unsigned integer of the same precision as the platform integer is used.keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axes are left in the result as dimension with size one.initial::double or None, optional, default=None
: Starting value for the sum.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_trace
— Method.
_np_trace(data, offset, axis1, axis2)
Computes the sum of the diagonal elements of a matrix. Input is a tensor A of dimension n >= 2.
If n=2, we sum the diagonal elements. The result has shape ().
If n>2, trace is performed separately on the matrix defined by axis1 and axis2 for all inputs (batch mode).
Examples::
// Single matrix reduction A = [[1.0, 1.0], [1.0, 7.0]] trace(A) = 8.0
// Batch matrix reduction A = [[[1.0, 1.0], [1.0, 7.0]], [[3.0, 0], [0, 17.0]]] trace(A) = [1.0, 18.0]
Defined in src/operator/numpy/nptraceop.cc:L74
Arguments
data::NDArray-or-SymbolicNode
: Input ndarrayoffset::int, optional, default='0'
: Offset of the diagonal from the main diagonal. Can be both positive and negative. Defaults to 0.axis1::int, optional, default='0'
: Axes to be used as the first axis of the 2-D sub-arrays from which the diagonals should be taken. Defaults to 0.axis2::int, optional, default='1'
: Axes to be used as the second axis of the 2-D sub-arrays from which the diagonals should be taken. Defaults to 1.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._np_transpose
— Method.
_np_transpose(a, axes)
Arguments
a::NDArray-or-SymbolicNode
: Source inputaxes::Shape(tuple), optional, default=None
: By default, reverse the dimensions, otherwise permute the axes according to the values given.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_Custom
— Method.
_npi_Custom(data, op_type)
npiCustom is an alias of Custom.
Apply a custom operator implemented in a frontend language (like Python).
Custom operators should override required methods like forward
and backward
. The custom operator must be registered before it can be used. Please check the tutorial here: https://mxnet.incubator.apache.org/api/faq/new_op
Defined in src/operator/custom/custom.cc:L546
Arguments
data::NDArray-or-SymbolicNode[]
: Input data for the custom operator.op_type::string
: Name of the custom operator. This is the name that is passed tomx.operator.register
to register the operator.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_abs
— Method.
_npi_abs(x)
npiabs is an alias of npiabsolute.
Returns element-wise absolute value of the input. Example:: absolute([-2, 0, 3]) = [2, 0, 3]
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L139
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_absolute
— Method.
_npi_absolute(x)
Returns element-wise absolute value of the input. Example:: absolute([-2, 0, 3]) = [2, 0, 3]
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L139
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_add
— Method.
_npi_add(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_add_scalar
— Method.
_npi_add_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_arange
— Method.
_npi_arange(start, stop, step, repeat, infer_range, ctx, dtype)
Arguments
start::double, required
: Start of interval. The interval includes this value. The default start value is 0.stop::double or None, optional, default=None
: End of interval. The interval does not include this value, except in some cases where step is not an integer and floating point round-off affects the length of out.step::double, optional, default=1
: Spacing between values.repeat::int, optional, default='1'
: The repeating time of all elements. E.g repeat=3, the element a will be repeated three times –> a, a, a.infer_range::boolean, optional, default=0
: When set to True, infer the stop position from the start, step, repeat, and output tensor size.ctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Target data type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_arccos
— Method.
_npi_arccos(x)
Returns element-wise inverse cosine of the input array. The input should be in range [-1, 1]
. The output is in the closed interval :math:[0, \pi]
.. math:: arccos([-1, -.707, 0, .707, 1]) = [\pi, 3\pi/4, \pi/2, \pi/4, 0] The storage type of $arccos$ output is always dense
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L355
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_arccosh
— Method.
_npi_arccosh(x)
Returns the element-wise inverse hyperbolic cosine of the input array, computed element-wise.
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L417
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_arcsin
— Method.
_npi_arcsin(x)
Returns element-wise inverse sine of the input array. .. math:: arcsin([-1, -.707, 0, .707, 1]) = [-\pi/2, -\pi/4, 0, \pi/4, \pi/2]
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L344
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_arcsinh
— Method.
_npi_arcsinh(x)
Returns the element-wise inverse hyperbolic sine of the input array, computed element-wise.
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L410
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_arctan
— Method.
_npi_arctan(x)
Returns element-wise inverse tangent of the input array. .. math:: arctan([-1, 0, 1]) = [-\pi/4, 0, \pi/4]
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L363
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_arctan2
— Method.
_npi_arctan2(x1, x2)
Arguments
x1::NDArray-or-SymbolicNode
: The input arrayx2::NDArray-or-SymbolicNode
: The input arrayname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_arctan2_scalar
— Method.
_npi_arctan2_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_arctanh
— Method.
_npi_arctanh(x)
Returns the element-wise inverse hyperbolic tangent of the input array, computed element-wise.
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L424
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_argmax
— Method.
_npi_argmax(data, axis, keepdims)
Arguments
data::NDArray-or-SymbolicNode
: The inputaxis::int or None, optional, default='None'
: The axis along which to perform the reduction. Negative values means indexing from right to left. $Requires axis to be set as int, because global reduction is not supported yet.$keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axis is left in the result as dimension with size one.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_argmin
— Method.
_npi_argmin(data, axis, keepdims)
Arguments
data::NDArray-or-SymbolicNode
: The inputaxis::int or None, optional, default='None'
: The axis along which to perform the reduction. Negative values means indexing from right to left. $Requires axis to be set as int, because global reduction is not supported yet.$keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axis is left in the result as dimension with size one.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_argsort
— Method.
_npi_argsort(data, axis, is_ascend, dtype)
npiargsort is an alias of argsort.
Returns the indices that would sort an input array along the given axis.
This function performs sorting along the given axis and returns an array of indices having same shape as an input array that index data in sorted order.
Examples::
x = [[ 0.3, 0.2, 0.4], [ 0.1, 0.3, 0.2]]
// sort along axis -1 argsort(x) = [[ 1., 0., 2.], [ 0., 2., 1.]]
// sort along axis 0 argsort(x, axis=0) = [[ 1., 0., 1.] [ 0., 1., 0.]]
// flatten and then sort argsort(x, axis=None) = [ 3., 1., 5., 0., 4., 2.]
Defined in src/operator/tensor/ordering_op.cc:L184
Arguments
data::NDArray-or-SymbolicNode
: The input arrayaxis::int or None, optional, default='-1'
: Axis along which to sort the input tensor. If not given, the flattened array is used. Default is -1.is_ascend::boolean, optional, default=1
: Whether to sort in ascending or descending order.dtype::{'float16', 'float32', 'float64', 'int32', 'int64', 'uint8'},optional, default='float32'
: DType of the output indices. It is only valid when ret_typ is "indices" or "both". An error will be raised if the selected data type cannot precisely represent the indices.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_around
— Method.
_npi_around(x, decimals)
Arguments
x::NDArray-or-SymbolicNode
: Input ndarraydecimals::int, optional, default='0'
: Number of decimal places to round to.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_average
— Method.
_npi_average(a, weights, axis, returned, weighted)
Arguments
a::NDArray-or-SymbolicNode
: The inputweights::NDArray-or-SymbolicNode
: The weights to calculate averageaxis::Shape or None, optional, default=None
: Axis or axes along which a average is performed. The default, axis=None, will average all of the elements of the input array. If axis is negative it counts from the last to the first axis.returned::boolean, optional, default=0
: If True, the tuple (average, sumofweights) is returned,otherwise only the average is returned.If weights=None, sumofweights is equivalent tothe number of elements over which the average is taken.weighted::boolean, optional, default=1
: Auxiliary flag to deal with none weights.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_backward_ediff1d
— Method.
_npi_backward_ediff1d()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_backward_nan_to_num
— Method.
_npi_backward_nan_to_num()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_backward_polyval
— Method.
_npi_backward_polyval()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_bernoulli
— Method.
_npi_bernoulli(input1, prob, logit, size, ctx, dtype, is_logit)
Arguments
input1::NDArray-or-SymbolicNode
: Source inputprob::float or None, required
:logit::float or None, required
:size::Shape or None, optional, default=None
: Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.ctx::string, optional, default='cpu'
: Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls.dtype::{'bool', 'float16', 'float32', 'float64', 'int32', 'uint8'},optional, default='float32'
: DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None).is_logit::boolean, required
:name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_bincount
— Method.
_npi_bincount(data, weights, minlength, has_weights)
Arguments
data::NDArray-or-SymbolicNode
: Dataweights::NDArray-or-SymbolicNode
: Weightsminlength::int, optional, default='0'
: A minimum number of bins for the output arrayIf minlength is specified, there will be at least thisnumber of bins in the output arrayhas_weights::boolean, optional, default=0
: Determine whether Bincount has weights.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_bitwise_and
— Method.
_npi_bitwise_and(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_bitwise_and_scalar
— Method.
_npi_bitwise_and_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_bitwise_not
— Method.
_npi_bitwise_not(x)
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_bitwise_or
— Method.
_npi_bitwise_or(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_bitwise_or_scalar
— Method.
_npi_bitwise_or_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_bitwise_xor
— Method.
_npi_bitwise_xor(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_bitwise_xor_scalar
— Method.
_npi_bitwise_xor_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_blackman
— Method.
_npi_blackman(M, ctx, dtype)
Return the Blackman window.The Blackman window is a taper formed by using a weighted cosine.
Arguments
M::, optional, default=None
: Number of points in the output window. If zero or less, an empty array is returned.ctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Data-type of the returned array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_boolean_mask
— Method.
_npi_boolean_mask(data, index, axis)
npibooleanmask is an alias of _contribboolean_mask.
Given an n-d NDArray data, and a 1-d NDArray index, the operator produces an un-predeterminable shaped n-d NDArray out, which stands for the rows in x where the corresonding element in index is non-zero.
data = mx.nd.array([[1, 2, 3],[4, 5, 6],[7, 8, 9]]) index = mx.nd.array([0, 1, 0]) out = mx.nd.contrib.boolean_mask(data, index) out
[[4. 5. 6.]]
Defined in src/operator/contrib/boolean_mask.cc:L195
Arguments
data::NDArray-or-SymbolicNode
: Dataindex::NDArray-or-SymbolicNode
: Maskaxis::int, optional, default='0'
: An integer that represents the axis in NDArray to mask from.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_boolean_mask_assign_scalar
— Method.
_npi_boolean_mask_assign_scalar(data, mask, value, start_axis)
Scalar version of boolean assign
Defined in src/operator/numpy/npbooleanmask_assign.cc:L284
Arguments
data::NDArray-or-SymbolicNode
: inputmask::NDArray-or-SymbolicNode
: maskvalue::float
: value to be assigned to masked positionsstart_axis::int
: starting axis of boolean maskname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_boolean_mask_assign_tensor
— Method.
_npi_boolean_mask_assign_tensor(data, mask, value, start_axis)
Tensor version of boolean assign
Defined in src/operator/numpy/npbooleanmask_assign.cc:L309
Arguments
data::NDArray-or-SymbolicNode
: inputmask::NDArray-or-SymbolicNode
: maskvalue::NDArray-or-SymbolicNode
: assignmentstart_axis::int
: starting axis of boolean maskname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_broadcast_to
— Method.
_npi_broadcast_to(array, shape)
Arguments
array::NDArray-or-SymbolicNode
: The inputshape::Shape(tuple), optional, default=[]
: The shape of the desired array. We can set the dim to zero if it's same as the original. E.gA = broadcast_to(B, shape=(10, 0, 0))
has the same meaning asA = broadcast_axis(B, axis=0, size=10)
.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_cast
— Method.
_npi_cast(data, dtype)
npicast is an alias of Cast.
Casts all elements of the input to a new type.
.. note:: $Cast$ is deprecated. Use $cast$ instead.
Example::
cast([0.9, 1.3], dtype='int32') = [0, 1] cast([1e20, 11.1], dtype='float16') = [inf, 11.09375] cast([300, 11.1, 10.9, -1, -3], dtype='uint8') = [44, 11, 10, 255, 253]
Defined in src/operator/tensor/elemwiseunaryop_basic.cc:L664
Arguments
data::NDArray-or-SymbolicNode
: The input.dtype::{'bfloat16', 'bool', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'}, required
: Output data type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_cbrt
— Method.
_npi_cbrt(x)
Return the cube-root of an array, element-wise. Example:: cbrt([1, 8, -125]) = [1, 2, -5]
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L232
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_ceil
— Method.
_npi_ceil(x)
Return the ceiling of the input, element-wise. The ceil of the scalar x is the smallest integer i, such that i >= x. Example:: ceil([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) = [-1., -1., -0., 1., 2., 2., 2.]
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L165
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_choice
— Method.
_npi_choice(input1, input2, a, size, ctx, replace, weighted)
random choice
Arguments
input1::NDArray-or-SymbolicNode
: Source inputinput2::NDArray-or-SymbolicNode
: Source inputa::, required
:size::, required
:ctx::string, optional, default='cpu'
:replace::boolean, optional, default=1
:weighted::boolean, optional, default=0
:name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_cholesky
— Method.
_npi_cholesky(A)
Defined in src/operator/numpy/linalg/np_potrf.cc:L46
Arguments
A::NDArray-or-SymbolicNode
: Tensor of input matrices to be decomposedname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_clip
— Method.
_npi_clip(data, a_min, a_max)
npiclip is an alias of clip.
Clips (limits) the values in an array. Given an interval, values outside the interval are clipped to the interval edges. Clipping $x$ between a_min
and a_max
would be:: .. math:: clip(x, amin, amax) = \max(\min(x, amax), amin)) Example:: x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] clip(x,1,8) = [ 1., 1., 2., 3., 4., 5., 6., 7., 8., 8.] The storage type of $clip$ output depends on storage types of inputs and the amin, amax
parameter values:
- clip(default) = default
- clip(rowsparse, amin <= 0, amax >= 0) = rowsparse
- clip(csr, amin <= 0, amax >= 0) = csr
- clip(rowsparse, amin < 0, a_max < 0) = default
- clip(rowsparse, amin > 0, a_max > 0) = default
- clip(csr, amin < 0, amax < 0) = csr
- clip(csr, amin > 0, amax > 0) = csr
Defined in src/operator/tensor/matrix_op.cc:L676
Arguments
data::NDArray-or-SymbolicNode
: Input array.a_min::float, required
: Minimum valuea_max::float, required
: Maximum valuename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_column_stack
— Method.
_npi_column_stack(data, num_args)
Note: npicolumnstack takes variable number of positional inputs. So instead of calling as _npicolumnstack([x, y, z], numargs=3), one should call via npicolumnstack(x, y, z), and numargs will be determined automatically.
Defined in src/operator/numpy/npmatrixop.cc:L865
Arguments
data::NDArray-or-SymbolicNode[]
: List of arrays to column_stacknum_args::int, required
: Number of inputs to be column stackedname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_concatenate
— Method.
_npi_concatenate(data, num_args, dim)
Note: npiconcatenate takes variable number of positional inputs. So instead of calling as npiconcatenate([x, y, z], numargs=3), one should call via _npiconcatenate(x, y, z), and num_args will be determined automatically.
Join a sequence of arrays along an existing axis.
Defined in src/operator/numpy/npmatrixop.cc:L677
Arguments
data::NDArray-or-SymbolicNode[]
: List of arrays to concatenatenum_args::int, required
: Number of inputs to be concated.dim::int, optional, default='1'
: the dimension to be concated.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_copysign
— Method.
_npi_copysign(lhs, rhs)
Defined in src/operator/numpy/npelemwisebroadcastopextended.cc:L47
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_copysign_scalar
— Method.
_npi_copysign_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_copyto
— Method.
_npi_copyto(data)
npicopyto is an alias of _copyto.
Arguments
data::NDArray
: input dataname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_cos
— Method.
_npi_cos(x)
Computes the element-wise cosine of the input array. .. math:: cos([0, \pi/4, \pi/2]) = [1, 0.707, 0]
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L328
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_cosh
— Method.
_npi_cosh(x)
Returns the hyperbolic cosine of the input array, computed element-wise. .. math:: cosh(x) = 0.5\times(exp(x) + exp(-x))
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L395
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_cvimdecode
— Method.
_npi_cvimdecode(buf, flag, to_rgb)
npicvimdecode is an alias of _cvimdecode.
Decode image with OpenCV. Note: return image in RGB by default, instead of OpenCV's default BGR.
Arguments
buf::NDArray
: Buffer containing binary encoded imageflag::int, optional, default='1'
: Convert decoded image to grayscale (0) or color (1).to_rgb::boolean, optional, default=1
: Whether to convert decoded image to mxnet's default RGB format (instead of opencv's default BGR).name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_cvimread
— Method.
_npi_cvimread(filename, flag, to_rgb)
npicvimread is an alias of _cvimread.
Read and decode image with OpenCV. Note: return image in RGB by default, instead of OpenCV's default BGR.
Arguments
filename::string, required
: Name of the image file to be loaded.flag::int, optional, default='1'
: Convert decoded image to grayscale (0) or color (1).to_rgb::boolean, optional, default=1
: Whether to convert decoded image to mxnet's default RGB format (instead of opencv's default BGR).name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_cvimresize
— Method.
_npi_cvimresize(src, w, h, interp)
npicvimresize is an alias of _cvimresize.
Resize image with OpenCV.
Arguments
src::NDArray
: source imagew::int, required
: Width of resized image.h::int, required
: Height of resized image.interp::int, optional, default='1'
: Interpolation method (default=cv2.INTER_LINEAR).name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_degrees
— Method.
_npi_degrees(x)
Converts each element of the input array from radians to degrees. .. math:: degrees([0, \pi/2, \pi, 3\pi/2, 2\pi]) = [0, 90, 180, 270, 360]
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L371
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_delete
— Method.
_npi_delete(arr, obj, start, stop, step, int_ind, axis)
Delete values along the given axis before the given indices.
Defined in src/operator/numpy/npdeleteop.cc:L71
Arguments
arr::NDArray-or-SymbolicNode
: Input ndarrayobj::NDArray-or-SymbolicNode
: Input ndarraystart::int or None, optional, default='None'
: If 'obj' is slice, 'start' is one of it's arguments.stop::int or None, optional, default='None'
: If 'obj' is slice, 'stop' is one of it's arguments.step::int or None, optional, default='None'
: If 'obj' is slice, 'step' is one of it's arguments.int_ind::int or None, optional, default='None'
: If 'obj' is int, 'int_ind' is the index before which'values' is insertedaxis::int or None, optional, default='None'
: Axis along which to insertvalues
.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_det
— Method.
_npi_det(A)
npidet is an alias of linalgdet.
Compute the determinant of a matrix. Input is a tensor A of dimension n >= 2.
If n=2, A is a square matrix. We compute:
out = det(A)
If n>2, det is performed separately on the trailing two dimensions for all inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only. .. note:: There is no gradient backwarded when A is non-invertible (which is equivalent to det(A) = 0) because zero is rarely hit upon in float point computation and the Jacobi's formula on determinant gradient is not computationally efficient when A is non-invertible.
Examples::
Single matrix determinant A = [[1., 4.], [2., 3.]] det(A) = [-5.]
Batch matrix determinant A = [[[1., 4.], [2., 3.]], [[2., 3.], [1., 4.]]] det(A) = [-5., 5.]
Defined in src/operator/tensor/la_op.cc:L974
Arguments
A::NDArray-or-SymbolicNode
: Tensor of square matrixname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_diag_indices_from
— Method.
_npi_diag_indices_from(data)
Arguments
data::NDArray-or-SymbolicNode
: Input ndarrayname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_diff
— Method.
_npi_diff(a, n, axis)
Arguments
a::NDArray-or-SymbolicNode
: Input ndarrayn::int, optional, default='1'
: The number of times values are differenced. If zero, the input is returned as-is.axis::int, optional, default='-1'
: Axis along which the cumulative sum is computed. The default (None) is to compute the diff over the flattened array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_dsplit
— Method.
_npi_dsplit(data, indices, axis, squeeze_axis, sections)
Arguments
data::NDArray-or-SymbolicNode
: The inputindices::Shape(tuple), required
: Indices of splits. The elements should denote the boundaries of at which split is performed along theaxis
.axis::int, optional, default='1'
: Axis along which to split.squeeze_axis::boolean, optional, default=0
: If true, Removes the axis with length 1 from the shapes of the output arrays. Note that settingsqueeze_axis
to $true$ removes axis with length 1 only along theaxis
which it is split. Alsosqueeze_axis
can be set to $true$ only if $input.shape[axis] == num_outputs$.sections::int, optional, default='0'
: Number of sections if equally splitted. Default to 0 which means split by indices.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_dstack
— Method.
_npi_dstack(data, num_args, dim)
Note: npidstack takes variable number of positional inputs. So instead of calling as npidstack([x, y, z], numargs=3), one should call via _npidstack(x, y, z), and num_args will be determined automatically.
Stack tensors in sequence depthwise (in third dimension)
Defined in src/operator/numpy/npmatrixop.cc:L1080
Arguments
data::NDArray-or-SymbolicNode[]
: List of arrays to concatenatenum_args::int, required
: Number of inputs to be concated.dim::int, optional, default='1'
: the dimension to be concated.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_ediff1d
— Method.
_npi_ediff1d(input1, input2, input3, to_begin_arr_given, to_end_arr_given, to_begin_scalar, to_end_scalar)
Arguments
input1::NDArray-or-SymbolicNode
: Source inputinput2::NDArray-or-SymbolicNode
: Source inputinput3::NDArray-or-SymbolicNode
: Source inputto_begin_arr_given::boolean, optional, default=0
: To determine whether theto_begin
parameter is an array.to_end_arr_given::boolean, optional, default=0
: To determine whether theto_end
parameter is an array.to_begin_scalar::double or None, optional, default=None
: If theto_begin
is a scalar, the value of this parameter.to_end_scalar::double or None, optional, default=None
: If theto_end
is a scalar, the value of this parameter.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_eig
— Method.
_npi_eig(A)
Arguments
A::NDArray-or-SymbolicNode
: Tensor of square matrixname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_eigh
— Method.
_npi_eigh(A, UPLO)
Arguments
A::NDArray-or-SymbolicNode
: Tensor of real matricesUPLO::, optional, default=L
: Specifies whether the calculation is done with the lower or upper triangular part.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_eigvals
— Method.
_npi_eigvals(A)
Arguments
A::NDArray-or-SymbolicNode
: Tensor of square matrixname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_eigvalsh
— Method.
_npi_eigvalsh(A, UPLO)
Arguments
A::NDArray-or-SymbolicNode
: Tensor of square matrixUPLO::, optional, default=L
: Specifies whether the calculation is done with the lower or upper triangular part.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_einsum
— Method.
_npi_einsum(data, num_args, subscripts, optimize)
Note: npieinsum takes variable number of positional inputs. So instead of calling as npieinsum([x, y, z], numargs=3), one should call via _npieinsum(x, y, z), and num_args will be determined automatically.
Defined in src/operator/numpy/npeinsumop.cc:L314
Arguments
data::NDArray-or-SymbolicNode[]
: List of eimsum operandsnum_args::int, required
: Number of input arrays.subscripts::string, optional, default=''
: Specifies the subscripts for summation as comma separated list of subscript labels. An implicit (classical Einstein summation) calculation is performed unless the explicit indicator '->' is included as well as subscript labels of the precise output form.optimize::int, optional, default='0'
:name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_equal
— Method.
_npi_equal(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_equal_scalar
— Method.
_npi_equal_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: First input to the functionscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_exp
— Method.
_npi_exp(x)
Calculate the exponential of all elements in the input array. Example:: exp([0, 1, 2]) = [1., 2.71828175, 7.38905621]
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L240
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_expand_dims
— Method.
_npi_expand_dims(data, axis)
npiexpanddims is an alias of expanddims.
Inserts a new axis of size 1 into the array shape For example, given $x$ with shape $(2,3,4)$, then $expand_dims(x, axis=1)$ will return a new array with shape $(2,1,3,4)$.
Defined in src/operator/tensor/matrix_op.cc:L394
Arguments
data::NDArray-or-SymbolicNode
: Source inputaxis::int, required
: Position where new axis is to be inserted. Suppose that the inputNDArray
's dimension isndim
, the range of the inserted axis is[-ndim, ndim]
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_expm1
— Method.
_npi_expm1(x)
Calculate $exp(x) - 1$ for all elements in the array.
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L287
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_exponential
— Method.
_npi_exponential(input1, scale, size, ctx)
Numpy behavior exponential
Arguments
input1::NDArray-or-SymbolicNode
: Source inputscale::float or None, optional, default=1
:size::Shape or None, optional, default=None
: Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.ctx::string, optional, default='cpu'
: Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_eye
— Method.
_npi_eye(N, M, k, ctx, dtype)
Return a 2-D array with ones on the diagonal and zeros elsewhere.
Arguments
N::long, required
: Number of rows in the output.M::, optional, default=None
: Number of columns in the output. If None, defaults to N.k::long, optional, default=0
: Index of the diagonal. 0 (the default) refers to the main diagonal,a positive value refers to an upper diagonal.and a negative value to a lower diagonal.ctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Data-type of the returned array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_fix
— Method.
_npi_fix(x)
Round to nearest integer towards zero. Round an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats. Example:: fix([-2.1, -1.9, 1.9, 2.1]) = [-2., -1., 1., 2.]
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L208
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_flip
— Method.
_npi_flip(data, axis)
Arguments
data::NDArray-or-SymbolicNode
: Input data arrayaxis::Shape(tuple), required
: The axis which to flip elements.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_floor
— Method.
_npi_floor(x)
Return the floor of the input, element-wise. The floor of the scalar x is the largest integer i, such that i <= x. Example:: floor([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) = [-2., -2., -1., 0., 1., 1., 2.]
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L174
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_full
— Method.
_npi_full(shape, ctx, dtype, value)
npifull is an alias of _full.
fill target with a scalar value
Arguments
shape::Shape(tuple), optional, default=None
: The shape of the outputctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{'bfloat16', 'bool', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Target data type.value::double, required
: Value with which to fill newly created tensorname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_full_like
— Method.
_npi_full_like(a, fill_value, ctx, dtype)
Arguments
a::NDArray-or-SymbolicNode
: The shape and data-type of a define these same attributes of the returned array.fill_value::double, required
: Value with which to fill newly created tensorctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{None, 'bfloat16', 'bool', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='None'
: Target data type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_gamma
— Method.
_npi_gamma(input1, input2, shape, scale, size, ctx, dtype)
Numpy behavior gamma
Arguments
input1::NDArray-or-SymbolicNode
: Source inputinput2::NDArray-or-SymbolicNode
: Source inputshape::float or None, required
:scale::float or None, required
:size::Shape or None, optional, default=None
: Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.ctx::string, optional, default='cpu'
: Context of output, in format xpu|xpu|xpu_pinned. Only used for imperative calls.dtype::{'float16', 'float32', 'float64'},optional, default='float32'
: DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None).name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_gather_nd
— Method.
_npi_gather_nd(data, indices)
npigathernd is an alias of gathernd.
Gather elements or slices from data
and store to a tensor whose shape is defined by indices
.
Given data
with shape (X_0, X_1, ..., X_{N-1})
and indices with shape (M, Y_0, ..., Y_{K-1})
, the output will have shape (Y_0, ..., Y_{K-1}, X_M, ..., X_{N-1})
, where M <= N
. If M == N
, output shape will simply be (Y_0, ..., Y_{K-1})
.
The elements in output is defined as follows::
output[y0, ..., y, xM, ..., x] = data[indices[0, y0, ..., y], ..., indices[M-1, y0, ..., y], xM, ..., x]
Examples::
data = [[0, 1], [2, 3]] indices = [[1, 1, 0], [0, 1, 0]] gather_nd(data, indices) = [2, 3, 0]
data = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] indices = [[0, 1], [1, 0]] gather_nd(data, indices) = [[3, 4], [5, 6]]
Arguments
data::NDArray-or-SymbolicNode
: dataindices::NDArray-or-SymbolicNode
: indicesname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_greater
— Method.
_npi_greater(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_greater_equal
— Method.
_npi_greater_equal(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_greater_equal_scalar
— Method.
_npi_greater_equal_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: First input to the functionscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_greater_scalar
— Method.
_npi_greater_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: First input to the functionscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_gumbel
— Method.
_npi_gumbel(input1, input2, loc, scale, size, ctx)
Arguments
input1::NDArray-or-SymbolicNode
: Source inputinput2::NDArray-or-SymbolicNode
: Source inputloc::float or None, required
:scale::float or None, required
:size::Shape or None, optional, default=None
: Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.ctx::string, optional, default='cpu'
: Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_hamming
— Method.
_npi_hamming(M, ctx, dtype)
Return the Hamming window.The Hamming window is a taper formed by using a weighted cosine.
Arguments
M::, optional, default=None
: Number of points in the output window. If zero or less, an empty array is returned.ctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Data-type of the returned array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_hanning
— Method.
_npi_hanning(M, ctx, dtype)
Return the Hanning window.The Hanning window is a taper formed by using a weighted cosine.
Arguments
M::, optional, default=None
: Number of points in the output window. If zero or less, an empty array is returned.ctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Data-type of the returned array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_histogram
— Method.
_npi_histogram(data, bins, bin_cnt, range)
npihistogram is an alias of _histogram.
This operators implements the histogram function.
Example:: x = [[0, 1], [2, 2], [3, 4]] histo, binedges = histogram(data=x, binbounds=[], bincnt=5, range=(0,5)) histo = [1, 1, 2, 1, 1] binedges = [0., 1., 2., 3., 4.] histo, binedges = histogram(data=x, binbounds=[0., 2.1, 3.]) histo = [4, 1]
Defined in src/operator/tensor/histogram.cc:L137
Arguments
data::NDArray-or-SymbolicNode
: Input ndarraybins::NDArray-or-SymbolicNode
: Input ndarraybin_cnt::int or None, optional, default='None'
: Number of bins for uniform caserange::, optional, default=None
: The lower and upper range of the bins. if not provided, range is simply (a.min(), a.max()). values outside the range are ignored. the first element of the range must be less than or equal to the second. range affects the automatic bin computation as well. while bin width is computed to be optimal based on the actual data within range, the bin count will fill the entire range including portions containing no data.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_hsplit
— Method.
_npi_hsplit(data, indices, axis, squeeze_axis, sections)
Arguments
data::NDArray-or-SymbolicNode
: The inputindices::Shape(tuple), required
: Indices of splits. The elements should denote the boundaries of at which split is performed along theaxis
.axis::int, optional, default='1'
: Axis along which to split.squeeze_axis::boolean, optional, default=0
: If true, Removes the axis with length 1 from the shapes of the output arrays. Note that settingsqueeze_axis
to $true$ removes axis with length 1 only along theaxis
which it is split. Alsosqueeze_axis
can be set to $true$ only if $input.shape[axis] == num_outputs$.sections::int, optional, default='0'
: Number of sections if equally splitted. Default to 0 which means split by indices.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_hsplit_backward
— Method.
_npi_hsplit_backward()
Arguments
name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_hstack
— Method.
_npi_hstack(data, num_args, dim)
Note: npihstack takes variable number of positional inputs. So instead of calling as npihstack([x, y, z], numargs=3), one should call via _npihstack(x, y, z), and num_args will be determined automatically.
Stack tensors horizontally (in second dimension)
Defined in src/operator/numpy/npmatrixop.cc:L1042
Arguments
data::NDArray-or-SymbolicNode[]
: List of arrays to concatenatenum_args::int, required
: Number of inputs to be concated.dim::int, optional, default='1'
: the dimension to be concated.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_hypot
— Method.
_npi_hypot(x1, x2)
Arguments
x1::NDArray-or-SymbolicNode
: The input arrayx2::NDArray-or-SymbolicNode
: The input arrayname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_hypot_scalar
— Method.
_npi_hypot_scalar(data, scalar, is_int)
npihypotscalar is an alias of _hypotscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_identity
— Method.
_npi_identity(shape, ctx, dtype)
Return a new identity array of given shape, type, and context.
Arguments
shape::Shape(tuple), optional, default=[]
: The shape of the outputctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{'bfloat16', 'bool', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Target data type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_indices
— Method.
_npi_indices(dimensions, dtype, ctx)
Return an array representing the indices of a grid.
Arguments
dimensions::Shape(tuple), required
: The shape of the grid.dtype::{'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='int32'
: Target data type.ctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_insert_scalar
— Method.
_npi_insert_scalar(arr, values, val, start, stop, step, int_ind, axis)
Insert values along the given axis before the given indices.
Defined in src/operator/numpy/npinsertop_scalar.cc:L105
Arguments
arr::NDArray-or-SymbolicNode
: Input ndarrayvalues::NDArray-or-SymbolicNode
: Input ndarrayval::double or None, optional, default=None
: A scaler to be inserted into 'array'start::int or None, optional, default='None'
: If 'obj' is slice, 'start' is one of it's arguments.stop::int or None, optional, default='None'
: If 'obj' is slice, 'stop' is one of it's arguments.step::int or None, optional, default='None'
: If 'obj' is slice, 'step' is one of it's arguments.int_ind::int or None, optional, default='None'
: If 'obj' is int, 'int_ind' is the index before which'values' is insertedaxis::int or None, optional, default='None'
: Axis along which to insert 'values'.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_insert_slice
— Method.
_npi_insert_slice(arr, values, val, start, stop, step, int_ind, axis)
Insert values along the given axis before the given indices.
Defined in src/operator/numpy/npinsertop_slice.cc:L131
Arguments
arr::NDArray-or-SymbolicNode
: Input ndarrayvalues::NDArray-or-SymbolicNode
: Input ndarrayval::double or None, optional, default=None
: A scaler to be inserted into 'array'start::int or None, optional, default='None'
: If 'obj' is slice, 'start' is one of it's arguments.stop::int or None, optional, default='None'
: If 'obj' is slice, 'stop' is one of it's arguments.step::int or None, optional, default='None'
: If 'obj' is slice, 'step' is one of it's arguments.int_ind::int or None, optional, default='None'
: If 'obj' is int, 'int_ind' is the index before which'values' is insertedaxis::int or None, optional, default='None'
: Axis along which to insert 'values'.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_insert_tensor
— Method.
_npi_insert_tensor(arr, values, obj, val, start, stop, step, int_ind, axis)
Insert values along the given axis before the given indices. Indices is tensor and ndim > 0.
Defined in src/operator/numpy/npinsertop_tensor.cc:L121
Arguments
arr::NDArray-or-SymbolicNode
: Input ndarrayvalues::NDArray-or-SymbolicNode
: Input ndarrayobj::NDArray-or-SymbolicNode
: Input ndarrayval::double or None, optional, default=None
: A scaler to be inserted into 'array'start::int or None, optional, default='None'
: If 'obj' is slice, 'start' is one of it's arguments.stop::int or None, optional, default='None'
: If 'obj' is slice, 'stop' is one of it's arguments.step::int or None, optional, default='None'
: If 'obj' is slice, 'step' is one of it's arguments.int_ind::int or None, optional, default='None'
: If 'obj' is int, 'int_ind' is the index before which'values' is insertedaxis::int or None, optional, default='None'
: Axis along which to insert 'values'.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_inv
— Method.
_npi_inv(A)
npiinv is an alias of linalginverse.
Compute the inverse of a matrix. Input is a tensor A of dimension n >= 2.
If n=2, A is a square matrix. We compute:
out = A\ :sup:-1
If n>2, inverse is performed separately on the trailing two dimensions for all inputs (batch mode).
.. note:: The operator supports float32 and float64 data types only.
Examples::
Single matrix inverse A = [[1., 4.], [2., 3.]] inverse(A) = [[-0.6, 0.8], [0.4, -0.2]]
Batch matrix inverse A = [[[1., 4.], [2., 3.]], [[1., 3.], [2., 4.]]] inverse(A) = [[[-0.6, 0.8], [0.4, -0.2]], [[-2., 1.5], [1., -0.5]]]
Defined in src/operator/tensor/la_op.cc:L919
Arguments
A::NDArray-or-SymbolicNode
: Tensor of square matrixname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_isfinite
— Method.
_npi_isfinite(x)
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_isinf
— Method.
_npi_isinf(x)
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_isnan
— Method.
_npi_isnan(x)
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_isneginf
— Method.
_npi_isneginf(x)
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_isposinf
— Method.
_npi_isposinf(x)
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_lcm
— Method.
_npi_lcm(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_lcm_scalar
— Method.
_npi_lcm_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_ldexp
— Method.
_npi_ldexp(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_ldexp_scalar
— Method.
_npi_ldexp_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_less
— Method.
_npi_less(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_less_equal
— Method.
_npi_less_equal(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_less_equal_scalar
— Method.
_npi_less_equal_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: First input to the functionscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_less_scalar
— Method.
_npi_less_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: First input to the functionscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_linspace
— Method.
_npi_linspace(start, stop, step, repeat, infer_range, ctx, dtype)
npilinspace is an alias of _linspace.
Return evenly spaced numbers over a specified interval. Similar to Numpy
Arguments
start::double, required
: Start of interval. The interval includes this value. The default start value is 0.stop::double or None, optional, default=None
: End of interval. The interval does not include this value, except in some cases where step is not an integer and floating point round-off affects the length of out.step::double, optional, default=1
: Spacing between values.repeat::int, optional, default='1'
: The repeating time of all elements. E.g repeat=3, the element a will be repeated three times –> a, a, a.infer_range::boolean, optional, default=0
: When set to True, infer the stop position from the start, step, repeat, and output tensor size.ctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Target data type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_log
— Method.
_npi_log(x)
Returns element-wise Natural logarithmic value of the input. The natural logarithm is logarithm in base e, so that $log(exp(x)) = x$
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L247
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_log10
— Method.
_npi_log10(x)
Returns element-wise Base-10 logarithmic value of the input. $10**log10(x) = x$
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L268
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_log1p
— Method.
_npi_log1p(x)
Return the natural logarithm of one plus the input array, element-wise. Calculates $log(1 + x)$.
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L282
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_log2
— Method.
_npi_log2(x)
Returns element-wise Base-2 logarithmic value of the input. $2**log2(x) = x$
Defined in src/operator/numpy/npelemwiseunaryopbasic.cc:L275
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_logical_not
— Method.
_npi_logical_not(x)
Arguments
x::NDArray-or-SymbolicNode
: The input array.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_logistic
— Method.
_npi_logistic(input1, input2, loc, scale, size, ctx)
Arguments
input1::NDArray-or-SymbolicNode
: Source inputinput2::NDArray-or-SymbolicNode
: Source inputloc::float or None, required
:scale::float or None, required
:size::Shape or None, optional, default=None
: Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.ctx::string, optional, default='cpu'
: Context of output, in format cpu|gpu|cpu_pinned. Only used for imperative calls.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_logspace
— Method.
_npi_logspace(start, stop, num, endpoint, base, ctx, dtype)
Return numbers spaced evenly on a log scale.
Arguments
start::double, required
: The starting value of the sequence.stop::double, required
: The ending value of the sequencenum::int, required
: Number of samples to generate. Must be non-negative.endpoint::boolean, optional, default=1
: If True, stop is the last sample. Otherwise, it is not included.base::double, optional, default=10
: The base of the log space. The step size between the elements in ln(samples) / ln(base) (or log_base(samples)) is uniform.ctx::string, optional, default=''
: Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls.dtype::{'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'
: Target data type.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_matmul
— Method.
_npi_matmul(a, b)
Defined in src/operator/numpy/npmatmulop.cc:L140
Arguments
a::NDArray-or-SymbolicNode
: First inputb::NDArray-or-SymbolicNode
: Second inputname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_maximum
— Method.
_npi_maximum(lhs, rhs)
npimaximum is an alias of broadcast_maximum.
Returns element-wise maximum of the input arrays with broadcasting.
This function compares two input arrays and returns a new array having the element-wise maxima.
Example::
x = [[ 1., 1., 1.], [ 1., 1., 1.]]
y = [[ 0.], [ 1.]]
broadcast_maximum(x, y) = [[ 1., 1., 1.], [ 1., 1., 1.]]
Defined in src/operator/tensor/elemwisebinarybroadcastopextended.cc:L80
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_maximum_scalar
— Method.
_npi_maximum_scalar(data, scalar, is_int)
npimaximumscalar is an alias of _maximumscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_mean
— Method.
_npi_mean(a, axis, dtype, keepdims, initial)
Arguments
a::NDArray-or-SymbolicNode
: The inputaxis::Shape or None, optional, default=None
: Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.dtype::{None, 'bool', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8'},optional, default='None'
: The type of the returned array and of the accumulator in which the elements are summed. The dtype of a is used by default unless a has an integer dtype of less precision than the default platform integer. In that case, if a is signed then the platform integer is used while if a is unsigned then an unsigned integer of the same precision as the platform integer is used.keepdims::boolean, optional, default=0
: If this is set toTrue
, the reduced axes are left in the result as dimension with size one.initial::double or None, optional, default=None
: Starting value for the sum.name::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_minimum
— Method.
_npi_minimum(lhs, rhs)
npiminimum is an alias of broadcast_minimum.
Returns element-wise minimum of the input arrays with broadcasting.
This function compares two input arrays and returns a new array having the element-wise minima.
Example::
x = [[ 1., 1., 1.], [ 1., 1., 1.]]
y = [[ 0.], [ 1.]]
broadcast_maximum(x, y) = [[ 0., 0., 0.], [ 1., 1., 1.]]
Defined in src/operator/tensor/elemwisebinarybroadcastopextended.cc:L116
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_minimum_scalar
— Method.
_npi_minimum_scalar(data, scalar, is_int)
npiminimumscalar is an alias of _minimumscalar.
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_mod
— Method.
_npi_mod(lhs, rhs)
Arguments
lhs::NDArray-or-SymbolicNode
: First input to the functionrhs::NDArray-or-SymbolicNode
: Second input to the functionname::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_mod_scalar
— Method.
_npi_mod_scalar(data, scalar, is_int)
Arguments
data::NDArray-or-SymbolicNode
: source inputscalar::double, optional, default=1
: Scalar input valueis_int::boolean, optional, default=1
: Indicate whether scalar input is int typename::Symbol
: The name of theSymbolicNode
. (e.g.:my_symbol
), optional.attrs::Dict{Symbol,String}
: The attributes associated with thisSymbolicNode
.
#
MXNet.mx._npi_multinomial
— Method.
_npi_multinomial(a, n, pvals, size)
Draw samples from a multinomial distribution. " "The multinomial distribution is a multivariate generalisation of the binomial distribution. " "Take an experiment with one of p possible outcomes. " "An example of such an experiment is throwing a dice, where the outcome can be 1 through 6. " "Each sample drawn from the distribution represents n such experiments. " "Its values, Xi = [X0, X1, ..., Xp], represent the number of times the outcome was i.
Arguments
a::NDArray-or-SymbolicNode
: Source inputn::int, req