aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/__init__.py
diff options
context:
space:
mode:
authorGravatar Francois Chollet <fchollet@google.com>2018-04-10 13:49:37 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-04-10 13:51:54 -0700
commit693b339ab2f062ec5bbb29f976c5d1fd94fbffa5 (patch)
tree1e11b6becc6b156b6e89ebb3f4d5d2f886bed188 /tensorflow/python/__init__.py
parent6b593d329005ffb1a10b1c9cd1374d2cdb620b21 (diff)
Refactor layers:
- tf.layers layers now subclasses tf.keras.layers layers. - tf.keras.layers is now agnostic to variable scopes and global collections (future-proof). It also uses ResourceVariable everywhere by default. - As a result tf.keras.layers is in general lower-complexity, with fewer hacks and workarounds. However some of current code is temporary (variable creation should be moved to Checkpointable, arguably, and there are some dependency issues that will require later refactors). - The legacy tf.layers layers behavior is kept, with references to variable scopes and global collections injected in the subclassed tf.layers.base.Layer class (the content of tf.layers.base.Layer is the complexity differential between the old implementation and the new one). Note: this refactor does slightly change the behavior of tf.layers.base.Layer, by disabling extreme edge-case behavior that either has long been invalid, or is dangerous and should most definitely be disabled. This will not affect any users since such behaviors only existed in the base Layer unit tests. The behaviors disabled are: - Option to create reusable variables in `call` (already invalid for some time). - Option to use a variable scope to create layer variables outside of the layer while not having the layer track such variables locally. PiperOrigin-RevId: 192339798
Diffstat (limited to 'tensorflow/python/__init__.py')
-rw-r--r--tensorflow/python/__init__.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tensorflow/python/__init__.py b/tensorflow/python/__init__.py
index ab1d01a835..da836aca6f 100644
--- a/tensorflow/python/__init__.py
+++ b/tensorflow/python/__init__.py
@@ -149,6 +149,16 @@ from tensorflow.python.ops import tensor_array_ops
from tensorflow.python.eager.context import executing_eagerly
from tensorflow.python.framework.ops import enable_eager_execution
+# Necessary for the symbols in this module to be taken into account by
+# the namespace management system (API decorators).
+from tensorflow.python.ops import rnn
+from tensorflow.python.ops import rnn_cell
+
+# Required due to `rnn` and `rnn_cell` not being imported in `nn` directly
+# (due to a circular dependency issue: rnn depends on layers).
+nn.dynamic_rnn = rnn.dynamic_rnn
+nn.rnn_cell = rnn_cell
+
# Symbols whitelisted for export without documentation.
# TODO(cwhipkey): review these and move to contrib, expose through
# documentation, or remove.