Commit a36ad180 authored by Yuxin Wu's avatar Yuxin Wu

Improve TOC style and fix some documentations

parent ce7e4892
......@@ -30,7 +30,7 @@ $(function (){
if(groupName in obj) {
obj[groupName].append(entry);
} else {
var ul = $('<ul>');
var ul = $('<ul style="margin-bottom: 12px;">');
ul.append(entry);
obj[groupName] = ul;
}
......@@ -50,9 +50,9 @@ $(function (){
return;
var obj = createList(selected);
var block = $('<div style="min-width: 300px;">');
var block = $('<div style="min-width: 300px; margin-bottom: 2em;">');
for(var key in obj) {
var a = $('<h5>');
var a = $('<h6 style="margin-bottom: 0;">');
a.html(key + ':');
block.append(a);
block.append(obj[key]);
......
......@@ -8,9 +8,6 @@ tensorpack.dataflow package
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
DataFlow
---------------
.. automodule:: tensorpack.dataflow
:members:
:undoc-members:
......
tensorpack.tfutils package
==========================
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
tensorpack.tfutils.collection module
------------------------------------
......@@ -25,14 +31,6 @@ tensorpack.tfutils.gradproc module
:undoc-members:
:show-inheritance:
tensorpack.tfutils.model_utils module
--------------------------------------
.. automodule:: tensorpack.tfutils.model_utils
:members:
:undoc-members:
:show-inheritance:
tensorpack.tfutils.scope_utils module
--------------------------------------
......
......@@ -82,12 +82,3 @@ tensorpack.utils.viz module
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: tensorpack.utils
:members:
:undoc-members:
:show-inheritance:
termcolor
numpy
tqdm
tensorflow
Sphinx>=1.6
recommonmark==0.4.0
sphinx_rtd_theme
mock
tensorflow
......@@ -3,6 +3,7 @@
# File: _test.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
import logging
import tensorflow as tf
import unittest
......@@ -33,7 +34,7 @@ if __name__ == '__main__':
import tensorpack
from tensorpack.utils import logger
from . import *
logger.disable_logger()
logger.setLevel(logging.CRITICAL)
subs = tensorpack.models._test.TestModel.__subclasses__()
for cls in subs:
run_test_case(cls)
......@@ -83,8 +83,8 @@ class Distribution(object):
@class_scope
def entropy(self, x, theta):
r""" Entropy of this distribution parameterized by theta,
estimated from a batch of samples.
r"""
Entropy of this distribution parameterized by theta, estimated from a batch of samples.
.. math::
......
......@@ -50,6 +50,7 @@ def graph_memoized(func):
kwargs.pop(GRAPH_ARG_NAME)
return func(*args, **kwargs)
@functools.wraps(func)
def wrapper(*args, **kwargs):
assert GRAPH_ARG_NAME not in kwargs, "No Way!!"
graph = tf.get_default_graph()
......
......@@ -11,7 +11,7 @@ from datetime import datetime
from six.moves import input
import sys
__all__ = ['set_logger_dir', 'disable_logger', 'auto_set_dir']
__all__ = ['set_logger_dir', 'auto_set_dir']
class _MyFormatter(logging.Formatter):
......@@ -46,9 +46,10 @@ _LOGGING_METHOD = ['info', 'warning', 'error', 'critical', 'warn', 'exception',
# export logger functions
for func in _LOGGING_METHOD:
locals()[func] = getattr(_logger, func)
__all__.append(func)
def get_time_str():
def _get_time_str():
return datetime.now().strftime('%m%d-%H%M%S')
......@@ -61,7 +62,7 @@ _FILE_HANDLER = None
def _set_file(path):
global _FILE_HANDLER
if os.path.isfile(path):
backup_name = path + '.' + get_time_str()
backup_name = path + '.' + _get_time_str()
shutil.move(path, backup_name)
info("Log file '{}' backuped to '{}'".format(path, backup_name)) # noqa: F821
hdl = logging.FileHandler(
......@@ -97,13 +98,13 @@ If you're resuming from a previous run you can choose to keep it.""")
action = input().lower().strip()
act = action
if act == 'b':
backup_name = dirname + get_time_str()
backup_name = dirname + _get_time_str()
shutil.move(dirname, backup_name)
info("Directory '{}' backuped to '{}'".format(dirname, backup_name)) # noqa: F821
elif act == 'd':
shutil.rmtree(dirname)
elif act == 'n':
dirname = dirname + get_time_str()
dirname = dirname + _get_time_str()
info("Use a new log directory {}".format(dirname)) # noqa: F821
elif act == 'k':
pass
......@@ -117,12 +118,6 @@ If you're resuming from a previous run you can choose to keep it.""")
_set_file(os.path.join(dirname, 'log.log'))
def disable_logger():
""" Disable all logging ability from this moment"""
for func in _LOGGING_METHOD:
globals()[func] = lambda x: None
def auto_set_dir(action=None, name=None):
"""
Use :func:`logger.set_logger_dir` to set log directory to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment