Hi, I’m trying to deploy 1D CNN based multi-label signal classification model.
However, the output on python code is drastically different with java though I used same model which is deployed using torch.jit.trace.
Please give me any advice I can apply.
I’m trying to solve this problem for one week.
-
model : 1D CNN based DenseNet
-
train data input size : (Batch, channel, length)=(25,1,1000)
-
output class : 4 class / multi label classification
-
version of python and pytorch
- python : 3.8.8
- pytorch : 1.9.0+cu111
- input/output data type : torch_float32
[Java]
- pytorch_android version : 1.9.1
- input/output data type : float32(float)
- input tensor data :
- real_output : float[1000]
- shape : long[]{1,1,1000}
[Java Code]
final Tensor inputTensor = Tensor.fromBlob(real_output, shape, MemoryFormat.CONTIGUOUS);
final Tensor ai_output = module.forward(IValue.from(inputTensor)).toTensor();
final float[] ai_result = ai_output.getDataAsFloatArray();
for (int i=0;i<4;i++){
Log.d(TAG, “ai_result_” + i + " : " + ai_result[i]);
}