1

When I execute this code precisely at the line which corresponds to module.forward my apps restarts. Code attached below:

@WorkerThread
@Nullable
public IValue translation(String input){       
     // loading serialized torchscript module from packaged into app android asset model.pt,
     Module module = Module.load(assetFilePath(this.context,"model_seq2seq_22_04_2020_13.pt"));

    inputTensor = generateTensor(lists,input);                 
    Log.d("tensor shape", Arrays.toString(inputTensor.shape()));


    long[] shape = new long[]{1,1};
    long[] start = new long[1];
    start[0]=0;

    Tensor trgStart = Tensor.fromBlob(start,shape);
    Log.d("tensor shape", Arrays.toString(trgStart.shape()));
    IValue output = module.forward(IValue.from(inputTensor),IValue.from(trgStart));    
}
Szymon Maszke
  • 22,747
  • 4
  • 43
  • 83

0 Answers0