diff --git a/fleetrec/core/utils/util.py b/fleetrec/core/utils/util.py index 6c6bd12ae5b25340bce35cbbfd77aa5f81236b0e..b410df1d8bb31fe7e613925e2a731d61924d8835 100755 --- a/fleetrec/core/utils/util.py +++ b/fleetrec/core/utils/util.py @@ -16,9 +16,20 @@ import os import time import datetime +from paddle import fluid from fleetrec.core.utils import fs as fs +def save_program_proto(path, program=None): + if program is None: + _program = fluid.default_main_program() + else: + _program = program + + with open(path, "wb") as f: + f.write(_program.desc.serialize_to_string()) + + def str2bool(v): if isinstance(v, bool): return v