Commit 99a8ee54 authored by Yuxin Wu's avatar Yuxin Wu

update docs

parent a979a3f3
...@@ -34,11 +34,22 @@ import mock ...@@ -34,11 +34,22 @@ import mock
#', '.join(map(str, args)) + ', ' \ #', '.join(map(str, args)) + ', ' \
#+ ', '.join(["{}={}".format(k,v) for k,v in kwargs.items()]) + ')' #+ ', '.join(["{}={}".format(k,v) for k,v in kwargs.items()]) + ')'
MOCK_MODULES = ['scipy', 'tensorflow', 'scipy.misc', 'h5py', 'nltk', MOCK_MODULES = ['scipy',
'tensorflow', 'tensorflow.contrib',
'tensorflow.contrib.framework',
'tensorflow.models',
'tensorflow.models.rnn',
'tensorflow.models.rnn.ptb',
'tensorflow.python',
'tensorflow.python.training',
'sklearn.datasets',
'scipy.misc', 'h5py', 'nltk',
'cv2', 'scipy.io', 'dill', 'zmq', 'subprocess32', 'lmdb', 'tornado.concurrent', 'cv2', 'scipy.io', 'dill', 'zmq', 'subprocess32', 'lmdb', 'tornado.concurrent',
'tornado', 'msgpack', 'msgpack_numpy', 'ale_python_interface'] 'tornado', 'msgpack', 'msgpack_numpy', 'ale_python_interface',
'sklearn']
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)
sys.modules['tensorflow'].__version__ = '0.12.0'
import tensorpack import tensorpack
from tensorpack.models import * from tensorpack.models import *
......
...@@ -4,14 +4,6 @@ tensorpack.RL package ...@@ -4,14 +4,6 @@ tensorpack.RL package
Submodules Submodules
---------- ----------
tensorpack.RL.atari module
--------------------------
.. automodule:: tensorpack.RL.atari
:members:
:undoc-members:
:show-inheritance:
tensorpack.RL.common module tensorpack.RL.common module
--------------------------- ---------------------------
...@@ -36,6 +28,14 @@ tensorpack.RL.expreplay module ...@@ -36,6 +28,14 @@ tensorpack.RL.expreplay module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tensorpack.RL.gymenv module
---------------------------
.. automodule:: tensorpack.RL.gymenv
:members:
:undoc-members:
:show-inheritance:
tensorpack.RL.history module tensorpack.RL.history module
---------------------------- ----------------------------
......
...@@ -12,10 +12,18 @@ tensorpack.callbacks.base module ...@@ -12,10 +12,18 @@ tensorpack.callbacks.base module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tensorpack.callbacks.common module tensorpack.callbacks.concurrency module
---------------------------------- ---------------------------------------
.. automodule:: tensorpack.callbacks.common .. automodule:: tensorpack.callbacks.concurrency
:members:
:undoc-members:
:show-inheritance:
tensorpack.callbacks.dispatcher module
--------------------------------------
.. automodule:: tensorpack.callbacks.dispatcher
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -60,10 +68,18 @@ tensorpack.callbacks.param module ...@@ -60,10 +68,18 @@ tensorpack.callbacks.param module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tensorpack.callbacks.summary module tensorpack.callbacks.saver module
----------------------------------- ---------------------------------
.. automodule:: tensorpack.callbacks.saver
:members:
:undoc-members:
:show-inheritance:
tensorpack.callbacks.stats module
---------------------------------
.. automodule:: tensorpack.callbacks.summary .. automodule:: tensorpack.callbacks.stats
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
......
...@@ -36,6 +36,14 @@ tensorpack.dataflow.dataset.mnist module ...@@ -36,6 +36,14 @@ tensorpack.dataflow.dataset.mnist module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tensorpack.dataflow.dataset.ptb module
--------------------------------------
.. automodule:: tensorpack.dataflow.dataset.ptb
:members:
:undoc-members:
:show-inheritance:
tensorpack.dataflow.dataset.svhn module tensorpack.dataflow.dataset.svhn module
--------------------------------------- ---------------------------------------
......
...@@ -68,6 +68,22 @@ tensorpack.dataflow.raw module ...@@ -68,6 +68,22 @@ tensorpack.dataflow.raw module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tensorpack.dataflow.remote module
---------------------------------
.. automodule:: tensorpack.dataflow.remote
:members:
:undoc-members:
:show-inheritance:
tensorpack.dataflow.tf_func module
----------------------------------
.. automodule:: tensorpack.dataflow.tf_func
:members:
:undoc-members:
:show-inheritance:
Module contents Module contents
--------------- ---------------
......
...@@ -68,6 +68,14 @@ tensorpack.models.regularize module ...@@ -68,6 +68,14 @@ tensorpack.models.regularize module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tensorpack.models.shapes module
-------------------------------
.. automodule:: tensorpack.models.shapes
:members:
:undoc-members:
:show-inheritance:
tensorpack.models.softmax module tensorpack.models.softmax module
-------------------------------- --------------------------------
......
...@@ -4,6 +4,14 @@ tensorpack.predict package ...@@ -4,6 +4,14 @@ tensorpack.predict package
Submodules Submodules
---------- ----------
tensorpack.predict.base module
------------------------------
.. automodule:: tensorpack.predict.base
:members:
:undoc-members:
:show-inheritance:
tensorpack.predict.common module tensorpack.predict.common module
-------------------------------- --------------------------------
......
...@@ -60,6 +60,30 @@ tensorpack.tfutils.symbolic_functions module ...@@ -60,6 +60,30 @@ tensorpack.tfutils.symbolic_functions module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tensorpack.tfutils.tower module
-------------------------------
.. automodule:: tensorpack.tfutils.tower
:members:
:undoc-members:
:show-inheritance:
tensorpack.tfutils.varmanip module
----------------------------------
.. automodule:: tensorpack.tfutils.varmanip
:members:
:undoc-members:
:show-inheritance:
tensorpack.tfutils.varreplace module
------------------------------------
.. automodule:: tensorpack.tfutils.varreplace
:members:
:undoc-members:
:show-inheritance:
Module contents Module contents
--------------- ---------------
......
...@@ -20,6 +20,14 @@ tensorpack.train.config module ...@@ -20,6 +20,14 @@ tensorpack.train.config module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tensorpack.train.input_data module
----------------------------------
.. automodule:: tensorpack.train.input_data
:members:
:undoc-members:
:show-inheritance:
tensorpack.train.multigpu module tensorpack.train.multigpu module
-------------------------------- --------------------------------
...@@ -28,6 +36,14 @@ tensorpack.train.multigpu module ...@@ -28,6 +36,14 @@ tensorpack.train.multigpu module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tensorpack.train.queue module
-----------------------------
.. automodule:: tensorpack.train.queue
:members:
:undoc-members:
:show-inheritance:
tensorpack.train.trainer module tensorpack.train.trainer module
------------------------------- -------------------------------
......
...@@ -4,6 +4,14 @@ tensorpack.utils package ...@@ -4,6 +4,14 @@ tensorpack.utils package
Submodules Submodules
---------- ----------
tensorpack.utils.argtools module
--------------------------------
.. automodule:: tensorpack.utils.argtools
:members:
:undoc-members:
:show-inheritance:
tensorpack.utils.concurrency module tensorpack.utils.concurrency module
----------------------------------- -----------------------------------
...@@ -12,6 +20,14 @@ tensorpack.utils.concurrency module ...@@ -12,6 +20,14 @@ tensorpack.utils.concurrency module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tensorpack.utils.debug module
-----------------------------
.. automodule:: tensorpack.utils.debug
:members:
:undoc-members:
:show-inheritance:
tensorpack.utils.discretize module tensorpack.utils.discretize module
---------------------------------- ----------------------------------
...@@ -28,6 +44,22 @@ tensorpack.utils.fs module ...@@ -28,6 +44,22 @@ tensorpack.utils.fs module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tensorpack.utils.globvars module
--------------------------------
.. automodule:: tensorpack.utils.globvars
:members:
:undoc-members:
:show-inheritance:
tensorpack.utils.gpu module
---------------------------
.. automodule:: tensorpack.utils.gpu
:members:
:undoc-members:
:show-inheritance:
tensorpack.utils.loadcaffe module tensorpack.utils.loadcaffe module
--------------------------------- ---------------------------------
...@@ -76,10 +108,10 @@ tensorpack.utils.serialize module ...@@ -76,10 +108,10 @@ tensorpack.utils.serialize module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tensorpack.utils.stat module tensorpack.utils.stats module
---------------------------- -----------------------------
.. automodule:: tensorpack.utils.stat .. automodule:: tensorpack.utils.stats
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -100,6 +132,14 @@ tensorpack.utils.utils module ...@@ -100,6 +132,14 @@ tensorpack.utils.utils module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tensorpack.utils.viz module
---------------------------
.. automodule:: tensorpack.utils.viz
:members:
:undoc-members:
:show-inheritance:
Module contents Module contents
--------------- ---------------
......
...@@ -41,7 +41,7 @@ class Model(ModelDesc): ...@@ -41,7 +41,7 @@ class Model(ModelDesc):
l = FullyConnected('fc0', z, 64 * 8 * 4 * 4, nl=tf.identity) l = FullyConnected('fc0', z, 64 * 8 * 4 * 4, nl=tf.identity)
l = tf.reshape(l, [-1, 4, 4, 64*8]) l = tf.reshape(l, [-1, 4, 4, 64*8])
l = BNReLU(l) l = BNReLU(l)
with argscope(Deconv2D, nl=BNReLU, kernel_shape=5, stride=2): with argscope(Deconv2D, nl=BNReLU, kernel_shape=4, stride=2):
l = Deconv2D('deconv1', l, [8, 8, 64 * 4]) l = Deconv2D('deconv1', l, [8, 8, 64 * 4])
l = Deconv2D('deconv2', l, [16, 16, 64 * 2]) l = Deconv2D('deconv2', l, [16, 16, 64 * 2])
l = Deconv2D('deconv3', l, [32, 32, 64]) l = Deconv2D('deconv3', l, [32, 32, 64])
...@@ -51,7 +51,7 @@ class Model(ModelDesc): ...@@ -51,7 +51,7 @@ class Model(ModelDesc):
def discriminator(self, imgs): def discriminator(self, imgs):
""" return a (b, 1) logits""" """ return a (b, 1) logits"""
with argscope(Conv2D, nl=tf.identity, kernel_shape=5, stride=2), \ with argscope(Conv2D, nl=tf.identity, kernel_shape=4, stride=2), \
argscope(LeakyReLU, alpha=0.2): argscope(LeakyReLU, alpha=0.2):
l = (LinearWrap(imgs) l = (LinearWrap(imgs)
.Conv2D('conv0', 64, nl=LeakyReLU) .Conv2D('conv0', 64, nl=LeakyReLU)
......
...@@ -24,14 +24,15 @@ from ..utils.stats import StatCounter ...@@ -24,14 +24,15 @@ from ..utils.stats import StatCounter
from .envbase import RLEnvironment, DiscreteActionSpace from .envbase import RLEnvironment, DiscreteActionSpace
_ALE_LOCK = threading.Lock() _ENV_LOCK = threading.Lock()
class GymEnv(RLEnvironment): class GymEnv(RLEnvironment):
""" """
An OpenAI/gym wrapper. Can optionally auto restart. An OpenAI/gym wrapper. Can optionally auto restart.
Only support discrete action space now
""" """
def __init__(self, name, dumpdir=None, viz=False, auto_restart=True): def __init__(self, name, dumpdir=None, viz=False, auto_restart=True):
with _ALE_LOCK: with _ENV_LOCK:
self.gymenv = gym.make(name) self.gymenv = gym.make(name)
if dumpdir: if dumpdir:
mkdir_p(dumpdir) mkdir_p(dumpdir)
......
...@@ -106,7 +106,7 @@ class PrefetchProcessZMQ(mp.Process): ...@@ -106,7 +106,7 @@ class PrefetchProcessZMQ(mp.Process):
self.ds.reset_state() self.ds.reset_state()
self.context = zmq.Context() self.context = zmq.Context()
self.socket = self.context.socket(zmq.PUSH) self.socket = self.context.socket(zmq.PUSH)
self.socket.set_hwm(1) self.socket.set_hwm(5)
self.socket.connect(self.conn_name) self.socket.connect(self.conn_name)
while True: while True:
for dp in self.ds.get_data(): for dp in self.ds.get_data():
......
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