Table Of Contents
Table Of Contents

expand_dims

mxnet.ndarray.expand_dims(data=None, axis=_Null, out=None, name=None, **kwargs)

Inserts a new axis of size 1 into the array shape

For example, given x with shape (2,3,4), then expand_dims(x, axis=1) will return a new array with shape (2,1,3,4).

Defined in src/operator/tensor/matrix_op.cc:L347

Parameters:
  • data (NDArray) – Source input
  • axis (int, required) – Position where new axis is to be inserted. Suppose that the input NDArray’s dimension is ndim, the range of the inserted axis is [-ndim, ndim]
  • out (NDArray, optional) – The output NDArray to hold the result.
Returns:

out – The output of this function.

Return type:

NDArray or list of NDArrays