# Increse the dimensions of tensor in java

I have (pytorch) tensor object in java.

The shape of tensor is (3 x H x W) where 3 represent (R,G,B) each.

The tensor is actually gained from bitmap image (shape = H x W)
by performing the following command, outputting (3 x H x W) which is in the TensorImageUtils.
(https://pytorch.org/docs/1.3.1/org/pytorch/TensorImageUtils.html)

``````final Tensor inputTensor = TensorImageUtils.bitmapToFloat32Tensor(bitmap,
TensorImageUtils.TORCHVISION_NORM_MEAN_RGB, TensorImageUtils.TORCHVISION_NORM_STD_RGB);
``````

but I need (1 x 3 x H x W) tensor, not (3 x H x W) in java.
In python, that can be performed by

torch.unsqueeze(x, 0) where x is (3 x H x W) tensor
(https://pytorch.org/docs/stable/generated/torch.unsqueeze.html)

in java, I think there is no unsqueeze command, how can i expand the dimension of tensor in java?