MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / auto_set_dir

Function auto_set_dir

tensorpack/utils/logger.py:156–165  ·  view source on GitHub ↗

Use :func:`logger.set_logger_dir` to set log directory to "./train_log/{scriptname}:{name}". "scriptname" is the name of the main python file currently running

(action=None, name=None)

Source from the content-addressed store, hash-verified

154
155
156def auto_set_dir(action=None, name=None):
157 """
158 Use :func:`logger.set_logger_dir` to set log directory to
159 "./train_log/{scriptname}:{name}". "scriptname" is the name of the main python file currently running"""
160 mod = sys.modules['__main__']
161 basename = os.path.basename(mod.__file__)
162 auto_dirname = os.path.join('train_log', basename[:basename.rfind('.')])
163 if name:
164 auto_dirname += '_%s' % name if os.name == 'nt' else ':%s' % name
165 set_logger_dir(auto_dirname, action=action)
166
167
168def get_logger_dir():

Callers

nothing calls this directly

Calls 3

set_logger_dirFunction · 0.85
basenameMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected