Ejemplo n.º 1
0
 def _flags_data(self, opdef, model_paths, local_cache):
     main_mod = op_util.split_main(opdef.main)[0]
     try:
         flags_data = local_cache[main_mod]
     except KeyError:
         flags_data = self._flags_data_(main_mod, model_paths, opdef)
         local_cache[main_mod] = flags_data
     return flags_data
Ejemplo n.º 2
0
 def python_script_opdef_loaded(self, opdef):
     if opdef.output_scalars is not None:
         return
     assert opdef.main, opdef
     main_mod = op_util.split_main(opdef.main)[0]
     model_paths = op_util.opdef_model_paths(opdef)
     try:
         _path, mod_path = python_util.find_module(main_mod, model_paths)
     except ImportError:
         return
     script = python_util.Script(mod_path)
     if self.is_keras_script(script):
         if opdef.output_scalars is None:
             opdef.output_scalars = KERAS_OUTPUT_SCALARS
Ejemplo n.º 3
0
 def python_script_opdef(self, op):
     if (op.compare is not None and op.output_scalars is not None):
         return
     assert op.main, op
     plugin = pluginlib.for_name("python_script")
     main_mod = op_util.split_main(op.main)[0]
     model_paths = op_util.opdef_model_paths(op)
     try:
         _sys_path, mod_path = plugin.find_module(main_mod, model_paths)
     except ImportError:
         return
     script = python_util.Script(mod_path)
     if self.is_keras_script(script):
         if op.compare is None:
             flags = ["=%s" % f.name for f in op.flags]
             op.compare = flags + KERAS_BASE_COMPARE
         if op.output_scalars is None:
             op.output_scalars = KERAS_OUTPUT_SCALARS