neuralgym.utils

neuralgym.utils.callback_log(texts)

Callback_log will show caller’s location.

Parameters:texts (str) – Text to show.
neuralgym.utils.warning_log(texts)

Warning_log will show caller’s location and red texts.

Parameters:texts (str) – Text to show.
neuralgym.utils.error_log(texts)

Error_log will show caller’s location, red texts and raise RuntimeError.

Parameters:texts (str) – Text to show.
neuralgym.utils.colored_log(prompt, texts, color='green', bold=True, highlight=False)

Show colored logs.

neuralgym.utils.get_sess(sess=None)

Get default session if sess is None.

Parameters:sess – Valid sess or None.
Returns:Valid sess or get default sess.
class neuralgym.utils.ProgressBar

Bases: object

Visualize progress.

It displays a progress bar in console with time recorder and statistics.

progress(progress, texts='')

Update progress bar with current progress and additional texts.

Parameters:
  • progress (float) – A float between [0,1] indicating progress.
  • texts (str) – additional texts (e.g. statistics) appear at the end of progress bar.
restart()

Restart time recorder and progress recorder.