Liking cljdoc? Tell your friends :D

Sparse Symbol API

    .. currentmodule:: mxnet.symbol.sparse

Overview

This document lists the routines of the sparse symbolic expression package:

.. autosummary::
    :nosignatures:

    mxnet.symbol.sparse

The Sparse Symbol API, defined in the symbol.sparse package, provides sparse neural network graphs and auto-differentiation.

The storage type of a variable is speficied by the stype attribute of the variable. The storage type of a symbolic expression is inferred based on the storage types of the variables and the operators.

>>> a = mx.sym.Variable('a', stype='csr')
>>> b = mx.sym.Variable('b')
>>> c = mx.sym.dot(a, b, transpose_a=True)
>>> type(c)
<class 'mxnet.symbol.Symbol'>
>>> e = c.bind(mx.cpu(), {'a': mx.nd.array([[1,0,0]]).tostype('csr'), 'b':mx.nd.ones((1,2))})
>>> y = e.forward()
# the result storage type of dot(csr.T, dense) is inferred to be `row_sparse`
>>> y
[<RowSparseNDArray 3x2 @cpu(0)>]
>>> y[0].asnumpy()
array([ 1.,  1.],
      [ 0.,  0.],
      [ 0.,  0.]], dtype=float32)

.. note:: most operators provided in ``mxnet.symbol.sparse`` are similar to those in
   ``mxnet.symbol`` although there are few differences:

   - Only a subset of operators in ``mxnet.symbol`` have efficient sparse implementations in ``mxnet.symbol.sparse``.
   - If an operator do not occur in the ``mxnet.symbol.sparse`` namespace, that means the operator does not have an efficient sparse implementation yet. If sparse inputs are passed to such an operator, it will convert inputs to the dense format and fallback to the already available dense implementation.
   - The storage types (``stype``) of sparse operators' outputs depend on the storage types of inputs.
     By default the operators not available in ``mxnet.symbol.sparse`` infer "default" (dense) storage type for outputs.
     Please refer to the API reference section for further details on specific operators.

In the rest of this document, we list sparse related routines provided by the symbol.sparse package.

Symbol creation routines

.. autosummary::
    :nosignatures:

    zeros_like
    mxnet.symbol.var

Symbol manipulation routines

Changing symbol storage type

.. autosummary::
    :nosignatures:

    cast_storage

Joining arrays

.. autosummary::
    :nosignatures:

    concat

Indexing routines

.. autosummary::
    :nosignatures:

    slice
    retain

Mathematical functions

Arithmetic operations

.. autosummary::
    :nosignatures:

    elemwise_add
    elemwise_sub
    elemwise_mul
    broadcast_add
    broadcast_sub
    broadcast_mul
    broadcast_div
    negative
    dot
    add_n

Trigonometric functions

.. autosummary::
    :nosignatures:

    sin
    tan
    arcsin
    arctan
    degrees
    radians

Hyperbolic functions

.. autosummary::
    :nosignatures:

    sinh
    tanh
    arcsinh
    arctanh

Reduce functions

.. autosummary::
    :nosignatures:

    sum
    mean

Rounding

.. autosummary::
    :nosignatures:

    round
    rint
    fix
    floor
    ceil
    trunc

Exponents and logarithms

.. autosummary::
    :nosignatures:

    expm1
    log1p

Powers

.. autosummary::
    :nosignatures:

    sqrt
    square

Miscellaneous

.. autosummary::
    :nosignatures:

    clip
    abs
    sign

Neural network

More

.. autosummary::
    :nosignatures:

    make_loss
    stop_gradient
    Embedding
    LinearRegressionOutput
    LogisticRegressionOutput

API Reference


.. automodule:: mxnet.symbol.sparse
    :members:

Can you improve this documentation? These fine people already did:
Haibin Lin, Ziyue Huang, Sheng Zha & Hao Jin
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close