onnx-tensorflow icon indicating copy to clipboard operation
onnx-tensorflow copied to clipboard

Can't get Graph of imported model

Open Dawars opened this issue 4 years ago • 2 comments

I'd like to get a Grap/GraphDefinition of the imported model to run the following code: https://github.com/google-research/receptive_field#basic-usage

The code I tried to run:

model = onnx.load('unet.onnx')
g = tf.Graph()
with g.as_default():
    images = tf.compat.v1.placeholder(tf.float32, shape=(1, *input_size), name='input_image')
    tf_rep = prepare(model)

rf.compute_receptive_field_from_graph_def(g, 'input.1', '373')

tf_rep.graph is None, how can I get the Graph of the model? I've checked and I can run inference on the model thanks to the backend implementation, is it possible to access the graph as well?

ONNX model file

This is a variant of UNet: https://drive.google.com/file/d/1aWNdWRVsu08eMmuShbnHP0aH0hszRh-v/view?usp=sharing

Python, ONNX, ONNX-TF, Tensorflow version

This section can be obtained by running get_version.py from util folder.

  • Python version: 3.7
  • ONNX version: 1.7.0
  • ONNX-TF version: 1.6.0
  • Tensorflow version: 1.15/2.3

Dawars avatar Oct 12 '20 21:10 Dawars