-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add a tutorial to describe how to use ONNX in TensorLayer #775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
example/tutorial_work_with_onnx.py
Outdated
y_ = tf.placeholder(tf.int64, shape=[batch_size]) | ||
|
||
net = tl.layers.InputLayer(x, name='input') | ||
## Professional conv API for tensorflow expert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused code.
example/tutorial_work_with_onnx.py
Outdated
|
||
if __name__ == '__main__': | ||
|
||
#sess = tf.InteractiveSession() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused code
example/tutorial_work_with_onnx.py
Outdated
acc = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) | ||
# y_op = tf.argmax(tf.nn.softmax(y), 1) | ||
|
||
# You can add more penalty to the cost function as follow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this code?
example/tutorial_work_with_onnx.py
Outdated
print(" test acc: %f" % (test_acc / n_batch)) | ||
|
||
|
||
if __name__ == '__main__': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed, we shall have a main function that is classified into four stages:
- Load a pre-trained model
- Save pre-trained model into two files: ckpt and pb.
- Save the ckpt and pb as a onnx file
- load the onnx file
- use the onnx file (which can be currently commented out)
The main function should have this structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will change the structure of the main function as we discussed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another advice for the function is that shall we supply the stage that train the model from scratch ?
* add tutorial of TensorLayer work with ONNX framework * modify the changelog * remove the unused code * remove the useless code * modify the code with yapf format * modify the structure of the tutotial * modify the format with yapf * add pip onnx-tf * modify the onnx tutorial structure * modify the format * fix the Trailing whitespace * add the contribution in changelog
Checklist
Motivation and Context
Description
1.add tutorial of TensorLayer work with ONNX framework