Table Of Contents
Table Of Contents


mxnet.ndarray.full(shape, val, ctx=None, dtype=<class 'numpy.float32'>, out=None)[source]

Returns a new array of given shape and type, filled with the given value val.

  • shape (int or tuple of int) – The shape of the new array.
  • val (scalar) – Fill value.
  • ctx (Context, optional) – Device context (default is the current default context).
  • dtype (str or numpy.dtype, optional) – The data type of the returned NDArray. The default datatype is float32.
  • out (NDArray, optional) – The output NDArray (default is None).

NDArray filled with val, with the given shape, ctx, and dtype.

Return type:



>>> mx.nd.full(1, 2.0).asnumpy()
array([ 2.], dtype=float32)
>>> mx.nd.full((1, 2), 2.0, mx.gpu(0))
<NDArray 1x2 @gpu(0)>
>>> mx.nd.full((1, 2), 2.0, dtype='float16').asnumpy()
array([[ 2.,  2.]], dtype=float16)