Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def call(*args, **kwargs):
global _writer
if _writer is None:
logdir = logger.get_dir()
if logdir is None:
logdir = logger.auto_set_dir(action='d')
logger.warning(
"[tensorboard] logdir is None, will save tensorboard files to {}"
.format(logdir))
_writer = SummaryWriter(logdir=logger.get_dir())
func = getattr(_writer, func_name)
func(*args, **kwargs)
_writer.flush()
def restore(agent):
learnDir = os.path.join(logger.get_dir(),'learn_01')
predictDir = os.path.join(logger.get_dir(),'predict_01')
logger.info('restore model from {}'.format(learnDir))
agent.load_params(learnDir,predictDir)
def call(*args, **kwargs):
global _writer
if _writer is None:
logdir = logger.get_dir()
if logdir is None:
logdir = logger.auto_set_dir(action='d')
logger.warning(
"[tensorboard] logdir is None, will save tensorboard files to {}"
.format(logdir))
_writer = SummaryWriter(logdir=logger.get_dir())
func = getattr(_writer, func_name)
func(*args, **kwargs)
_writer.flush()
def restore(agent):
learnDir = os.path.join(logger.get_dir(),'learn')
predictDir = os.path.join(logger.get_dir(),'predict')
print('restore model from {}'.format(learnDir))
agent.load_params(learnDir,predictDir)
def save(agent):
learnDir = os.path.join(logger.get_dir(),'learn')
predictDir = os.path.join(logger.get_dir(),'predict')
agent.save_params(learnDir,predictDir)
def save(agent):
learnDir = os.path.join(logger.get_dir(),'learn')
predictDir = os.path.join(logger.get_dir(),'predict')
agent.save_params(learnDir,predictDir)
def save(agent):
learnDir = os.path.join(logger.get_dir(),'learn_01')
predictDir = os.path.join(logger.get_dir(),'predict_01')
agent.save_params(learnDir,predictDir)