Repository navigation
TF-TRT C++ conversion - #52012
TF-TRT C++ conversion#52012
Conversation
e6d0699 to
45680b7
Compare
|
We can avoid the change to the utilities for freezing the graph by updating out SavedModelBundle with the converted GraphDef. Something like this: |
afaa5af to
d876eae
Compare
|
@bixia1 ready for review. |
bixia1
left a comment
There was a problem hiding this comment.
I am still working on reviewing trt_convert.cc .
bixia1
left a comment
There was a problem hiding this comment.
Still working on trt_convert.cc.
| // We could set item_conifg.feed_nodes and item_config.fetch_nodes to the | ||
| // nodes in the signature def. Alternatively, we could also set collection | ||
| // 'train_op'. Grappler can use these to determine the input and outputs. | ||
| // If none of these are set, then it will use the SignatereDef from | ||
| // the MetaGraphDef. See grappler_item_builder.cc for details. |
There was a problem hiding this comment.
If we will go with the API where users provide input/output names, we should setup ItemConfig fetch_nodes/feed_nodes.
If we will go with the API where users provide SignatureDef, we need to clear the SignatureDef in the input meta_graph_def and keep only the one we need.
Also, if we will need to run grappler a few times, we probably want to avoid constructing GrapplerItem each time by somehow reusing the GrapplerItem, see TF code here.
There was a problem hiding this comment.
- I have set up feed_nodes and fetch_nodes.
- If a previous conversion had
RunMetaOptimizer(item, ..., out_graph_def), can we just replace the item's graphitem.graph = out_graph_defbefore the nextRunMetaOptimizercall? For now we have only a single grappler pass, but it might matter in the follow up PR where we need to inline the graph before freezing it.
| // We could set item_conifg.feed_nodes and item_config.fetch_nodes to the | ||
| // nodes in the signature def. Alternatively, we could also set collection | ||
| // 'train_op'. Grappler can use these to determine the input and outputs. | ||
| // If none of these are set, then it will use the SignatereDef from | ||
| // the MetaGraphDef. See grappler_item_builder.cc for details. |
There was a problem hiding this comment.
- I have set up feed_nodes and fetch_nodes.
- If a previous conversion had
RunMetaOptimizer(item, ..., out_graph_def), can we just replace the item's graphitem.graph = out_graph_defbefore the nextRunMetaOptimizercall? For now we have only a single grappler pass, but it might matter in the follow up PR where we need to inline the graph before freezing it.
09cd906 to
b02e321
Compare
|
@bixia1 I have removed the circular dependency, and added trt_convert_api as a dependency of trt_op_libs. Let me know if there are other issues that we want to address in this PR. |
|
Can you fix the PR description, such as to remove the information that is obsolete? The PR description will become part of the commit message. |
b02e321 to
5cbde12
Compare
TF-TRT C++ interface to convert models.
Differences compared to the Python API:
convert_to_static_engineconversion param allows to convert dynamic engines to static engines.The steps for model conversion by
ConvertAndBuild(On the Python side, steps 4-5 are done by a separate
buildfunction.)Related PRs: