Expand the shape of an array by inserting new axes of length 1.
Input array.
Position(s) in the expanded axes where the new axis (or axes) is placed. Can be a single integer or an array of integers.
Array with the number of dimensions increased.
const x = np.array([1, 2]);np.expandDims(x, 0); // Shape [1, 2]np.expandDims(x, 1); // Shape [2, 1]np.expandDims(x, [0, 2]); // Shape [1, 2, 1] Copy
const x = np.array([1, 2]);np.expandDims(x, 0); // Shape [1, 2]np.expandDims(x, 1); // Shape [2, 1]np.expandDims(x, [0, 2]); // Shape [1, 2, 1]
Expand the shape of an array by inserting new axes of length 1.