From b1797a3498b7b323e207a4de18ae3930e2b187c8 Mon Sep 17 00:00:00 2001 From: Mark Ma <519329064@qq.com> Date: Fri, 11 Sep 2020 11:36:04 +0800 Subject: [PATCH] fixed InceptionV3 dygraph class creation is not wrapped with fluid.dygraph.guard() --- ppgan/metric/compute_fid.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ppgan/metric/compute_fid.py b/ppgan/metric/compute_fid.py index c7f8c0a..3e1d013 100644 --- a/ppgan/metric/compute_fid.py +++ b/ppgan/metric/compute_fid.py @@ -250,9 +250,10 @@ def calculate_fid_given_paths(paths, if not os.path.exists(p): raise RuntimeError('Invalid path: %s' % p) - if model is None: - block_idx = InceptionV3.BLOCK_INDEX_BY_DIM[dims] - model = InceptionV3([block_idx], class_dim=1008) + if model is None and style != 'stargan': + with fluid.dygraph.guard(): + block_idx = InceptionV3.BLOCK_INDEX_BY_DIM[dims] + model = InceptionV3([block_idx], class_dim=1008) m1, s1 = _compute_statistics_of_path(paths[0], model, batch_size, dims, use_gpu, premodel_path, style) -- GitLab