Skip to content

Commit

Permalink
fix export bug when multiple blocks in graph (#1162) (#1180)
Browse files Browse the repository at this point in the history
* fix expport bug when multiple blocks in graph

* fix

* refactor code
  • Loading branch information
rainyfly authored Dec 7, 2022
1 parent 72fbe8b commit 2f93fc4
Show file tree
Hide file tree
Showing 3 changed files with 210 additions and 175 deletions.
3 changes: 2 additions & 1 deletion visualdl/component/graph/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def translate_graph(model, input_spec, verbose=True):
with tempfile.TemporaryDirectory() as tmp:
model._full_name = '{}[{}]'.format(model.__class__.__name__, "model")
create_opname_scope(model)
paddle.jit.save(model, os.path.join(tmp, 'temp'), input_spec)
model = paddle.jit.to_static(model, input_spec)
paddle.jit.save(model, os.path.join(tmp, 'temp'))
model_data = open(os.path.join(tmp, 'temp.pdmodel'), 'rb').read()
result = analyse_model(model_data)
if verbose:
Expand Down
Loading

0 comments on commit 2f93fc4

Please sign in to comment.