Returns element-wise division of the input arrays with broadcasting.

    Equivalent to ``lhs / rhs`` and ``mx.nd.broadcast_div(lhs, rhs)``
    when shapes of lhs and rhs do not match. If lhs.shape == rhs.shape,
    this is equivalent to ``mx.nd.elemwise_div(lhs, rhs)``

    .. note::

        If the corresponding dimensions of two arrays have the same size or one of them has size 1,
        then the arrays are broadcastable to a common shape.

    Parameters
    ----------
    lhs : scalar or mxnet.ndarray.sparse.array
        First array in division.
    rhs : scalar or mxnet.ndarray.sparse.array
         Second array in division.
        The arrays to be divided. If ``lhs.shape != rhs.shape``, they must be
        broadcastable to a common shape.

    Returns
    -------
    NDArray
        The element-wise division of the input arrays.

    Examples
    --------
    >>> x = (mx.nd.ones((2,3))*6).tostype('csr')
    >>> y = mx.nd.arange(2).reshape((2,1)) + 1
    >>> z = mx.nd.arange(3) + 1
    >>> x.asnumpy()
    array([[ 6.,  6.,  6.],
           [ 6.,  6.,  6.]], dtype=float32)
    >>> y.asnumpy()
    array([[ 1.],
           [ 2.]], dtype=float32)
    >>> z.asnumpy()
    array([ 1.,  2.,  3.], dtype=float32)
    >>> x/2
    <NDArray 2x3 @cpu(0)>
    >>> (x/3).asnumpy()
    array([[ 2.,  2.,  2.],
           [ 2.,  2.,  2.]], dtype=float32)
    >>> (x/y).asnumpy()
    array([[ 6.,  6.,  6.],
           [ 3.,  3.,  3.]], dtype=float32)
    >>> mx.nd.sparse.divide(x,y).asnumpy()
    array([[ 6.,  6.,  6.],
           [ 3.,  3.,  3.]], dtype=float32)
    >>> (x/z).asnumpy()
    array([[ 6.,  3.,  2.],
           [ 6.,  3.,  2.]], dtype=float32)
    >>> mx.nd.sprase.divide(x,z).asnumpy()
    array([[ 6.,  3.,  2.],
           [ 6.,  3.,  2.]], dtype=float32)
    >>> z = z.reshape((1,3))
    >>> z.asnumpy()
    array([[ 1.,  2.,  3.]], dtype=float32)
    >>> (x/z).asnumpy()
    array([[ 6.,  3.,  2.],
           [ 6.,  3.,  2.]], dtype=float32)
    >>> mx.nd.sparse.divide(x,z).asnumpy()
    array([[ 6.,  3.,  2.],
           [ 6.,  3.,  2.]], dtype=float32)

def divide(lhs, rhs):
    """Returns element-wise division of the input arrays with broadcasting.

    Equivalent to ``lhs / rhs`` and ``mx.nd.broadcast_div(lhs, rhs)``
    when shapes of lhs and rhs do not match. If lhs.shape == rhs.shape,
    this is equivalent to ``mx.nd.elemwise_div(lhs, rhs)``

    .. note::

        If the corresponding dimensions of two arrays have the same size or one of them has size 1,
        then the arrays are broadcastable to a common shape.

    Parameters
    ----------
    lhs : scalar or mxnet.ndarray.sparse.array
        First array in division.
    rhs : scalar or mxnet.ndarray.sparse.array
         Second array in division.
        The arrays to be divided. If ``lhs.shape != rhs.shape``, they must be
        broadcastable to a common shape.

    Returns
    -------
    NDArray
        The element-wise division of the input arrays.

    Examples
    --------
    >>> x = (mx.nd.ones((2,3))*6).tostype('csr')
    >>> y = mx.nd.arange(2).reshape((2,1)) + 1
    >>> z = mx.nd.arange(3) + 1
    >>> x.asnumpy()
    array([[ 6.,  6.,  6.],
           [ 6.,  6.,  6.]], dtype=float32)
    >>> y.asnumpy()
    array([[ 1.],
           [ 2.]], dtype=float32)
    >>> z.asnumpy()
    array([ 1.,  2.,  3.], dtype=float32)
    >>> x/2
    <NDArray 2x3 @cpu(0)>
    >>> (x/3).asnumpy()
    array([[ 2.,  2.,  2.],
           [ 2.,  2.,  2.]], dtype=float32)
    >>> (x/y).asnumpy()
    array([[ 6.,  6.,  6.],
           [ 3.,  3.,  3.]], dtype=float32)
    >>> mx.nd.sparse.divide(x,y).asnumpy()
    array([[ 6.,  6.,  6.],
           [ 3.,  3.,  3.]], dtype=float32)
    >>> (x/z).asnumpy()
    array([[ 6.,  3.,  2.],
           [ 6.,  3.,  2.]], dtype=float32)
    >>> mx.nd.sprase.divide(x,z).asnumpy()
    array([[ 6.,  3.,  2.],
           [ 6.,  3.,  2.]], dtype=float32)
    >>> z = z.reshape((1,3))
    >>> z.asnumpy()
    array([[ 1.,  2.,  3.]], dtype=float32)
    >>> (x/z).asnumpy()
    array([[ 6.,  3.,  2.],
           [ 6.,  3.,  2.]], dtype=float32)
    >>> mx.nd.sparse.divide(x,z).asnumpy()
    array([[ 6.,  3.,  2.],
           [ 6.,  3.,  2.]], dtype=float32)
    """
    # pylint: disable= no-member, protected-access
    if isinstance(lhs, NDArray) and isinstance(rhs, NDArray) and lhs.shape == rhs.shape:
        return _ufunc_helper(
            lhs,
            rhs,
            op.elemwise_div,
            operator.truediv,
            _internal._div_scalar,
            None)

    return _ufunc_helper(
        lhs,
        rhs,
        op.broadcast_div,
        operator.truediv,
        _internal._div_scalar,
        None)