Commit 27ba042b authored by Yuxin Wu's avatar Yuxin Wu

update docs and fix build

parent b5ca3021
...@@ -45,15 +45,18 @@ The tower function needs to follow some rules: ...@@ -45,15 +45,18 @@ The tower function needs to follow some rules:
* (Recommended) Put non-trainable variables that need to be used in inference into `MODEL_VARIABLES`. * (Recommended) Put non-trainable variables that need to be used in inference into `MODEL_VARIABLES`.
3. It must __respect variable scope names__: 3. It must __respect variable scope names__:
The name of any trainable variables created in the function must be like "variable_scope_name/custom/scopes/name". The name of any trainable variables created in the function must be like "variable_scope_name/other/scopes/and/name".
Therefore, the name of any trainable variables must: Strictly speaking, the name of any trainable variables must:
* Start with the name of the enclosing variable_scope when the tower function is called.
* Not use the same variable_scope's name twice in its name.
* Not depend on name_scope's name. * Not depend on name_scope's name.
* Not depend on some tensor's name. * Not depend on any tensor's name (because the tensor's name may depend on name_scope's name).
* Not use the same variable_scope's name twice.
Tensorpack layers create variables based on the name given to the layer (i.e., `Conv2D('name', x)`). Tensorpack layers create variables based on the name given to the layer:
So the name of the layer needs to follow the above rules as well. e.g., `Conv2D('test', x)` will open a variable scope named "test".
In order to respect the above rules,
the name of the layer must not depend on name_scope's name or any tensor's name.
4. It must __respect variable scope reuse__: 4. It must __respect variable scope reuse__:
* The creation of any trainable variables must __respect reuse__ variable scope. * The creation of any trainable variables must __respect reuse__ variable scope.
To respect variable reuse (i.e. sharing), use `tf.get_variable` instead of `tf.Variable` in the function. To respect variable reuse (i.e. sharing), use `tf.get_variable` instead of `tf.Variable` in the function.
......
...@@ -108,7 +108,9 @@ class NumpySerializer(): ...@@ -108,7 +108,9 @@ class NumpySerializer():
@staticmethod @staticmethod
def load(path, shuffle=True): def load(path, shuffle=True):
buffer = np.load(path)['buffer'] # allow_pickle defaults to False since numpy 1.16.3
# (https://www.numpy.org/devdocs/release.html#unpickling-while-loading-requires-explicit-opt-in)
buffer = np.load(path, allow_pickle=True)['buffer']
return DataFromList(buffer, shuffle=shuffle) return DataFromList(buffer, shuffle=shuffle)
......
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