本文整理汇总了Python中gin.operative_config_str方法的典型用法代码示例。如果您正苦于以下问题:Python gin.operative_config_str方法的具体用法?Python gin.operative_config_str怎么用?Python gin.operative_config_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gin
的用法示例。
在下文中一共展示了gin.operative_config_str方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _save_gin
# 需要导入模块: import gin [as 别名]
# 或者: from gin import operative_config_str [as 别名]
def _save_gin(output_dir, sw=None):
config_path = os.path.join(output_dir, "config.gin")
config_str = gin.operative_config_str()
with gfile.GFile(config_path, "w") as f:
f.write(config_str)
if sw:
sw.text("gin_config",
jaxboard.markdownify_operative_config_str(config_str))
示例2: save_gin
# 需要导入模块: import gin [as 别名]
# 或者: from gin import operative_config_str [as 别名]
def save_gin(self):
assert self._output_dir is not None
config_path = os.path.join(self._output_dir, 'config.gin')
config_str = gin.operative_config_str()
with tf.io.gfile.GFile(config_path, 'w') as f:
f.write(config_str)
if self._sw:
self._sw.text('gin_config',
jaxboard.markdownify_operative_config_str(config_str))
示例3: save_gin
# 需要导入模块: import gin [as 别名]
# 或者: from gin import operative_config_str [as 别名]
def save_gin(self):
""""Saves the operative gin config, only if it is the chief."""
if not self._is_chief:
return
assert self._output_dir is not None
config_path = os.path.join(self._output_dir, 'config.gin')
config_str = gin.operative_config_str()
with tf.io.gfile.GFile(config_path, 'w') as f:
f.write(config_str)
sw = self._train_sw
if sw:
sw.text('gin_config',
jaxboard.markdownify_operative_config_str(config_str))
示例4: save_gin_config
# 需要导入模块: import gin [as 别名]
# 或者: from gin import operative_config_str [as 别名]
def save_gin_config(self):
with open(self.config_path, 'w') as cfg_file:
cfg_file.write(gin.operative_config_str())
示例5: record_operative_gin_configurations
# 需要导入模块: import gin [as 别名]
# 或者: from gin import operative_config_str [as 别名]
def record_operative_gin_configurations(operative_config_dir):
"""Record operative Gin configurations in the given directory."""
gin_log_file = operative_config_path(operative_config_dir)
# If it exists already, rename it instead of overwriting it.
# This just saves the previous one, not all the ones before.
if tf.io.gfile.exists(gin_log_file):
tf.io.gfile.rename(gin_log_file, gin_log_file + '.old', overwrite=True)
with tf.io.gfile.GFile(gin_log_file, 'w') as f:
f.write(gin.operative_config_str())