6

I am trying to convert .onxx model to .pb model. I have written the code but i am getting error:

@tf_func(tf.ceil)AttributeError: module 'tensorflow' has no attribute 'ceil'

Code:

import onnx
from tensorflow.python.tools.import_pb_to_tensorboard import import_to_tensorboard
from onnx_tf.backend import prepare
onnx_model = onnx.load("original_3dlm.onnx")
tf_rep = prepare(onnx_model)
tf_rep.export_graph("model_var.pb")
import_to_tensorboard("model_var.pb", "tb_log")

How to resolve this issue? Is there any other way to convert Onxx to Tensorflow?

1
  • If you are trying with tf==1.x then Please use this answer Commented Mar 1, 2022 at 18:39

2 Answers 2

5

I solve this issue with this. Tensorflow Backend for ONNX. Let me know if you have any issue. Change from tensorflow 2.0 to 1.14.Maybe solve the problem.

Sign up to request clarification or add additional context in comments.

3 Comments

I have already used command line interface it is throwing same error
what tensorflow use?2.0?Maybe change to 1.14 or 1.13.In TF 2.0 there are many changes.
perfect! great!
1

your code as far as I can tell should be fine. The problem probably lies in the onnx-tf version you currently use. pip currently installs a version that only supports TensorFlow <= 1.15. run this in the terminal to install a more up-to-date version of onnx-tf.

pip uninstall onnx_tf
pip install git+https://github.com/onnx/onnx-tensorflow.git

refer to this issue for further details

2 Comments

how this is relevant to conversion. Please describe your solution properly
it should have already been clear but I made it clearer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.