Skip to content

Commit 2f93fc4

Browse files
authored
fix export bug when multiple blocks in graph (#1162) (#1180)
* fix expport bug when multiple blocks in graph * fix * refactor code
1 parent 72fbe8b commit 2f93fc4

File tree

3 files changed

+210
-175
lines changed

3 files changed

+210
-175
lines changed

visualdl/component/graph/exporter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def translate_graph(model, input_spec, verbose=True):
2626
with tempfile.TemporaryDirectory() as tmp:
2727
model._full_name = '{}[{}]'.format(model.__class__.__name__, "model")
2828
create_opname_scope(model)
29-
paddle.jit.save(model, os.path.join(tmp, 'temp'), input_spec)
29+
model = paddle.jit.to_static(model, input_spec)
30+
paddle.jit.save(model, os.path.join(tmp, 'temp'))
3031
model_data = open(os.path.join(tmp, 'temp.pdmodel'), 'rb').read()
3132
result = analyse_model(model_data)
3233
if verbose:

0 commit comments

Comments
 (0)