My code:
final Tensor img1 = TensorImageUtils.bitmapToFloat32Tensor(bitmap1,
                    TensorImageUtils.TORCHVISION_NORM_MEAN_RGB, TensorImageUtils.TORCHVISION_NORM_STD_RGB);
            final Tensor img2 = TensorImageUtils.bitmapToFloat32Tensor(bitmap2,
                    TensorImageUtils.TORCHVISION_NORM_MEAN_RGB, TensorImageUtils.TORCHVISION_NORM_STD_RGB);

            IValue img = IValue.listFrom(img1, img2);
            final Tensor outputTensor = module.forward(img).toTensor();

error:

image878×251 39.3 KB

In fact, there are two pictures in my inputs. At first, I used torch.cat to splice on dim = 0 in pytorch. Later, I found that cat operation is not supported in Android. Instead, I changed the model to receive a list [tensor], read list [0] and list [1] respectively in the model, and then splice in the model. I noticed that the input type of forward can be an Ivalue, and the listfrom of Ivalue seems to support the conversion of list [tensor] to Ivalue, so I don’t understand what the problem is.My model input is two pictures . How should I implement this in Android, or how can I implement the torch.cat operation in Android？