You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I follow the instruction from deeplearning4j example to load onnx model but I got this problem.
Exception in thread "main" java.lang.IndexOutOfBoundsException
at java.base/java.nio.Buffer.checkIndex(Buffer.java:749)
at java.base/java.nio.HeapByteBuffer.getInt(HeapByteBuffer.java:439)
at com.google.flatbuffers.Table.__reset(Table.java:301)
at org.nd4j.graph.FlatGraph.__init(FlatGraph.java:33)
at org.nd4j.graph.FlatGraph.__assign(FlatGraph.java:34)
at org.nd4j.graph.FlatGraph.getRootAsFlatGraph(FlatGraph.java:32)
at org.nd4j.graph.FlatGraph.getRootAsFlatGraph(FlatGraph.java:31)
at org.nd4j.autodiff.samediff.SameDiff.fromFlatBuffers(SameDiff.java:5458)
at org.nd4j.autodiff.samediff.SameDiff.fromFlatFile(SameDiff.java:5428)
at org.nd4j.autodiff.samediff.SameDiff.load(SameDiff.java:5319)
at it.rcpvision.dl4j.workbench.test_onnx.main(test_onnx.java:18)
My java code like this:
import org.nd4j.autodiff.samediff.SameDiff;
import org.nd4j.common.resources.Downloader;
import org.nd4j.samediff.frameworkimport.onnx.importer.OnnxFrameworkImporter;
import java.io.File;
import java.net.URI;
import java.util.Arrays;
import java.util.Collections;
public class test_onnx {
public final static String MODEL_FILE_NAME = "super_resolution.onnx";
public static void main(String...args) throws Exception {
//load the imported model
SameDiff sameDiff = SameDiff.load(new File(MODEL_FILE_NAME),true);
//print the input names
System.out.println(sameDiff.inputs());
//print the shape of the input so we know what to feed the model
System.out.println(Arrays.toString(sameDiff.getVariable(sameDiff.inputs().get(0)).getShape()));
}
}
Issue Description
I follow the instruction from deeplearning4j example to load onnx model but I got this problem.
My java code like this:
And the onnx model is built from: https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html
Version Information
Do you know the reason for this error ? Any suggestion is appreciated. Thank you in advance !
The text was updated successfully, but these errors were encountered: