Open xiaotiancd opened 5 years ago
Append the steps and errors we hit:
Convert tensorflow pb file to onnx format following https://github.com/onnx/tutorials/blob/master/tutorials/TensorflowToOnnx-1.ipynb
Convert onnx to tensorflow model:
import onnx import warnings from onnx_tf.backend import prepare model = onnx.load('./output/mnist1.onnx') tf_rep = prepare(model) Traceback (most recent call last): File "
", line 1, in File "/dlfs/chudg/onnx/onnx-tensorflow/onnx_tf/backend.py", line 55, in prepare return cls.onnx_model_to_tensorflow_rep(model, strict) File "/dlfs/chudg/onnx/onnx-tensorflow/onnx_tf/backend.py", line 75, in onnx_model_to_tensorflow_rep return cls._onnx_graph_to_tensorflow_rep(model.graph, opset_import, strict) File "/dlfs/chudg/onnx/onnx-tensorflow/onnx_tf/backend.py", line 112, in _onnx_graph_to_tensorflow_rep shape=shape) File "/opt/anaconda3/envs/dlipy3/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 2143, in placeholder return gen_array_ops.placeholder(dtype=dtype, shape=shape, name=name) File "/opt/anaconda3/envs/dlipy3/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 6262, in placeholder "Placeholder", dtype=dtype, shape=shape, name=name) File "/opt/anaconda3/envs/dlipy3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 410, in _apply_op_helper with g.as_default(), ops.name_scope(name) as scope: File "/opt/anaconda3/envs/dlipy3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 6513, in enter return self._name_scope.enter() File "/opt/anaconda3/envs/dlipy3/lib/python3.6/contextlib.py", line 81, in enter return next(self.gen) File "/opt/anaconda3/envs/dlipy3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 4312, in name_scope raise ValueError("'%s' is not a valid scope name" % name) ValueError: 'input/input:0' is not a valid scope name
Hello, I am trying to workout some pruning algorithm using ONNX with tensorflow backend, so it contains the procedure to reformat a tensorflow model to ONNX, followed by pruning with forward pass. while the accuracy is not as high as what I need, I want to retrain it from the pruned onnx model, but looks like it is impossible to get that back to tensorflow. Any idea that someone could help to fix this? BTW, we used the tool tensorflow-onnx from developed by MS to get an onnx model from tensorflow, now we need to get that back.
thank you!
Xiaotian