Commit c8a9e4e5 authored by Yuxin Wu's avatar Yuxin Wu

get_collection in TowerTensorHandle

parent 2f9e2c0e
...@@ -36,7 +36,6 @@ We refuse toy examples. ...@@ -36,7 +36,6 @@ We refuse toy examples.
Instead of showing you 10 arbitrary networks trained on toy datasets, Instead of showing you 10 arbitrary networks trained on toy datasets,
[tensorpack examples](examples) faithfully replicate papers and care about reproducing numbers, [tensorpack examples](examples) faithfully replicate papers and care about reproducing numbers,
demonstrating its flexibility for actual research. demonstrating its flexibility for actual research.
Some highlights:
### Vision: ### Vision:
+ [Train ResNet](examples/ResNet) and [other models](examples/ImageNetModels) on ImageNet. + [Train ResNet](examples/ResNet) and [other models](examples/ImageNetModels) on ImageNet.
...@@ -57,7 +56,6 @@ Some highlights: ...@@ -57,7 +56,6 @@ Some highlights:
+ [char-rnn for fun](examples/Char-RNN) + [char-rnn for fun](examples/Char-RNN)
+ [LSTM language model on PennTreebank](examples/PennTreebank) + [LSTM language model on PennTreebank](examples/PennTreebank)
## Install: ## Install:
Dependencies: Dependencies:
......
...@@ -98,6 +98,7 @@ class MinSaver(Callback): ...@@ -98,6 +98,7 @@ class MinSaver(Callback):
reverse (bool): if True, will save the maximum. reverse (bool): if True, will save the maximum.
filename (str): the name for the saved model. filename (str): the name for the saved model.
Defaults to ``min-{monitor_stat}.tfmodel``. Defaults to ``min-{monitor_stat}.tfmodel``.
checkpoint_dir (str): the directory containing checkpoints.
Example: Example:
Save the model with minimum validation error to Save the model with minimum validation error to
...@@ -108,9 +109,8 @@ class MinSaver(Callback): ...@@ -108,9 +109,8 @@ class MinSaver(Callback):
MinSaver('val-error') MinSaver('val-error')
Notes: Notes:
It assumes that :class:`ModelSaver` is used with It assumes that :class:`ModelSaver` is used with the same ``checkpoint_dir``
the same ``checkpoint_dir``. And it will save and appears earlier in the callback list.
the model to that directory as well.
The default for both :class:`ModelSaver` and :class:`MinSaver` The default for both :class:`ModelSaver` and :class:`MinSaver`
is ``checkpoint_dir=logger.get_logger_dir()`` is ``checkpoint_dir=logger.get_logger_dir()``
""" """
......
...@@ -333,6 +333,15 @@ class TowerTensorHandle(object): ...@@ -333,6 +333,15 @@ class TowerTensorHandle(object):
name_with_vs = name name_with_vs = name
return get_op_or_tensor_by_name(name_with_vs) return get_op_or_tensor_by_name(name_with_vs)
def get_collection(self, name):
"""
Get items from a collection that are added in this tower.
Args:
name (str): the name of the collection
"""
return self._ctx.get_collection_in_tower(name)
@property @property
def input(self): def input(self):
""" """
......
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