mxnet.ndarray.sparse.zeros¶
-
mxnet.ndarray.sparse.
zeros
(stype, shape, ctx=None, dtype=None, **kwargs)[source]¶ Return a new array of given shape and type, filled with zeros.
- Parameters
stype (string) – The storage type of the empty array, such as ‘row_sparse’, ‘csr’, etc
shape (int or tuple of int) – The shape of the empty array
ctx (Context, optional) – An optional device context (default is the current default context)
dtype (str or numpy.dtype, optional) – An optional value type (default is float32)
- Returns
A created array
- Return type
Examples
>>> mx.nd.sparse.zeros('csr', (1,2)) <CSRNDArray 1x2 @cpu(0)> >>> mx.nd.sparse.zeros('row_sparse', (1,2), ctx=mx.cpu(), dtype='float16').asnumpy() array([[ 0., 0.]], dtype=float16)