What is the best way to make a 4D tensor from a 3D one?

Given a 3-dimensional tensor as a NDArray, what is the best way to transform it into a 4-dimensional NDArray in C++? I have some errors while trying to create a 4D NDArray where its first dimension equals to 1.

try

expand_dims(axis=0)