本文整理匯總了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())