def __impl__(*args, **kwargs): program_translator = ProgramTranslator() if in_dygraph_mode() or not program_translator.enable_declarative: logger.info( "The decorator 'dygraph_to_static_func' doesn't work in " "dygraph mode or set ProgramTranslator.enable to False. " "We will just return dygraph output.") return dygraph_func(*args, **kwargs) static_func = program_translator.get_func(dygraph_func) return static_func(*args, **kwargs)
def __impl__(*args, **kwargs): if in_dygraph_mode(): warnings.warn( "The decorator 'dygraph_to_static_func' doesn't work in " "dygraph mode. We will just return dygraph output. Use the " "decorator in static mode if you would like to translate to " "static graph.") return dygraph_func(*args, **kwargs) program_translator = ProgramTranslator() static_func = program_translator.get_func(dygraph_func) return static_func(*args, **kwargs)