Commit 1af98901 authored by Yuxin Wu's avatar Yuxin Wu

see if rtd works better

parent 9d83d921
...@@ -34,7 +34,8 @@ import mock ...@@ -34,7 +34,8 @@ import mock
#+ ', '.join(["{}={}".format(k,v) for k,v in kwargs.items()]) + ')' #+ ', '.join(["{}={}".format(k,v) for k,v in kwargs.items()]) + ')'
MOCK_MODULES = ['numpy', 'scipy', 'tensorflow', 'scipy.misc', 'h5py', 'nltk', MOCK_MODULES = ['numpy', 'scipy', 'tensorflow', 'scipy.misc', 'h5py', 'nltk',
'cv2', 'scipy.io', 'dill', 'zmq'] 'cv2', 'scipy.io', 'dill', 'zmq', 'subprocess32', 'lmdb',
'tornado']
for mod_name in MOCK_MODULES: for mod_name in MOCK_MODULES:
sys.modules[mod_name] = mock.Mock(name=mod_name) sys.modules[mod_name] = mock.Mock(name=mod_name)
......
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
import tensorflow as tf import tensorflow as tf
from functools import wraps from functools import wraps
import six import six
import copy import copy, os
#from decorator import decorator
from ..tfutils import * from ..tfutils import *
from ..tfutils.modelutils import * from ..tfutils.modelutils import *
...@@ -31,7 +30,8 @@ def layer_register(summary_activation=False, log_shape=True): ...@@ -31,7 +30,8 @@ def layer_register(summary_activation=False, log_shape=True):
Can be overriden when creating the layer. Can be overriden when creating the layer.
:param log_shape: log input/output shape of this layer :param log_shape: log input/output shape of this layer
""" """
#@decorator only enable me when building docs.
def wrapper(func): def wrapper(func):
@wraps(func) @wraps(func)
def wrapped_func(name, inputs, *args, **kwargs): def wrapped_func(name, inputs, *args, **kwargs):
...@@ -69,6 +69,13 @@ def layer_register(summary_activation=False, log_shape=True): ...@@ -69,6 +69,13 @@ def layer_register(summary_activation=False, log_shape=True):
return outputs return outputs
wrapped_func.f = func # attribute to access the underlining function object wrapped_func.f = func # attribute to access the underlining function object
return wrapped_func return wrapped_func
# need some special handling for RTD to work with the arguments
on_rtd = os.environ.get('READTHEDOCS') == 'True'
if on_rtd:
from decorator import decorator
wrapper = decorator(wrapper)
return wrapper return wrapper
def shape2d(a): def shape2d(a):
......
...@@ -18,7 +18,7 @@ def describe_model(): ...@@ -18,7 +18,7 @@ def describe_model():
msg.append("{}: shape={}, dim={}".format( msg.append("{}: shape={}, dim={}".format(
v.name, shape.as_list(), ele)) v.name, shape.as_list(), ele))
size_mb = total * 4 / 1024.0**2 size_mb = total * 4 / 1024.0**2
msg.append("Total param={} ({:01f} MB)".format(total, size_mb)) msg.append("Total param={} ({:01f} MB assuming all float32)".format(total, size_mb))
logger.info("Model Params: {}".format('\n'.join(msg))) logger.info("Model Params: {}".format('\n'.join(msg)))
......
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