Resizing Tensors in Pytorch Android

Hi everyone,

I just trained a model on python and used torch.jit.trace to serialize it for usage in android development. One important detail is that I would need to resize the raw data I’m getting from the android app into the input dimensions used by my model. What is the syntax/API required to resize tensors in android?

I’ve been following the tutorial here: Android | PyTorch

The line

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

is used to convert an image into a float32 tensor, but I couldn’t find anything about resizing or transformations on that page.

Have u solved the problem?
I’m just meet the problem cuz my model needs input in size((1,1,h,w))
while PyTorch only provide function that support 3 channels(RGB)