Some error happened when I importFrozenTF by SameDiffI

when I execute " package",some error happened.

the following is error log:

Exception in thread "main" java.lang.UnsupportedOperationException: Cannot get array for ARRAY type SDVariable - use SDVariable.exec or SameDiff.output instead
	at org.nd4j.autodiff.samediff.SameDiff.getArrForVarName(
	at org.nd4j.linalg.api.ops.impl.shape.Gather.initFromTensorFlow(
	at org.nd4j.autodiff.samediff.SameDiff.importFrozenTF(
	at org.deeplearning4j.examples.mine.learn01.ImportPBFile.main(

Version Information

Please indicate relevant versions, including, if relevant:
I work on windows10

Additional Information

The model is PB file downloaded from

@benbenwt please see: UnsupportedOperationException while training and let me know if you have any issues.

Thank you for replying my issue!:slight_smile:
I follow this Tutorials,and I have put necessary files into src/main/resources:

Then,I got this error:

Exception in thread "main" java.lang.IllegalArgumentException: No import process defined for IteratorV2
	at org.nd4j.samediff.frameworkimport.registry.OpMappingRegistry.lookupOpMappingProcess(OpMappingRegistry.kt:129)
	at org.nd4j.samediff.frameworkimport.ImportGraph.importGraph(ImportGraph.kt:227)
	at org.nd4j.samediff.frameworkimport.tensorflow.importer.TensorflowFrameworkImporter.importFromGraph(TensorflowFrameworkImporter.kt:58)
	at org.nd4j.samediff.frameworkimport.tensorflow.importer.TensorflowFrameworkImporter.runImport(TensorflowFrameworkImporter.kt:64)

this is my revised code:

   File frozenBertPB = new File("D:\\deeplearning4j-examples\\mydownload\\bert_mrpc_frozen_v1", "bert_mrpc_frozen.pb");
        Map<String, TFImportOverride> iterToPlaceholderOverride = overrideIteratorsToPlaceholders();
        TFOpImportFilter filterNodeIterV2 = filterNodeByName("IteratorV2");
        TensorflowFrameworkImporter tensorflowFrameworkImporter = new TensorflowFrameworkImporter();
        SameDiff sd = tensorflowFrameworkImporter.runImport(frozenBertPB.getAbsolutePath(), Collections.emptyMap());

I guess that I should set a filter for Iteratorv2,but I don’t know how to code.

@benbenwt perfect thanks. Since you posted your model, I’ll take a look. I imported a different version of BERT just fine, but may need to add more definitions. Of note here, you did do everything correctly.

Can you file an issue on Sign in to GitHub · GitHub so we can track this and get this fixed? Thanks!

Of course,Thank you very much for your time!I will file an issue on Github.And could you please Give me a link to the model that works fine?

@benbenwt I’ll do you one better and post the converted model for you so you can use the BERT model you’ve already been working with.

OK,I got it.Let’s fix it.:slight_smile: