SameDiff sd = SameDiff.importFrozenTF(modelFile);
After you import the TensorFlow model there are 2 ways to find the inputs and outputs. The first method is to look at the output of
Where the input variables are the output of no ops, and the output variables are the input of no ops. Another way to find the inputs is
List<String> inputs = sd.inputs();
To run inference use:
INDArray out = sd.batchOutput()
For multiple outputs, use
execSingle(), to return a
Map<String,INDArray>of outputs instead. Alternatively, you can use methods such as
SameDiff.output(Map<String, INDArray> placeholders, String... outputs)to get the same output.
SameDiff’s TensorFlow import is still being developed, and does not yet have support for every single operation and datatype in TensorFlow. Almost all of the common/standard operations are importable and tested, however - including almost everything in the tf, tf.math, tf.layers, tf.losses, tf.bitwise and tf.nn namespaces. The majority of existing pretrained models out there should be importable into SameDiff.