Table Of Contents
Table Of Contents

mxnet.ndarray.empty

mxnet.ndarray.empty(shape, ctx=None, dtype=None, stype=None)[source]

Returns a new array of given shape and type, without initializing entries.

Parameters
  • 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).

  • stype (str, optional) – An optional storage type (default is default).

Returns

A created array.

Return type

NDArray, CSRNDArray or RowSparseNDArray

Examples

>>> mx.nd.empty(1)
<NDArray 1 @cpu(0)>
>>> mx.nd.empty((1,2), mx.gpu(0))
<NDArray 1x2 @gpu(0)>
>>> mx.nd.empty((1,2), mx.gpu(0), 'float16')
<NDArray 1x2 @gpu(0)>
>>> mx.nd.empty((1,2), stype='csr')
<CSRNDArray 1x2 @cpu(0)>