diff options
author | Francois Chollet <fchollet@google.com> | 2018-01-04 15:28:49 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-01-04 15:36:09 -0800 |
commit | e4fbe7c2236d350e02f85eb6a58fa0dfa466ad5e (patch) | |
tree | 9f0b3761ac7c5fbf9bc7cce222a2d532dda9ea2f /tensorflow/contrib/seq2seq | |
parent | cb14c3527f4beabe17f5a4a72f17144dd7d25bc6 (diff) |
Make layer method `compute_output_shape` public.
Motivations:
- Useful for computing the shape of a layer's output without calling the layer.
- It is public in standalone keras (hence API discrepancy, which is something to be avoided).
- With eager mode and deferred mode for Network building, it is going to be increasingly necessary for users to implement this method or call it.
- Lots of internal users are apparently already relying on it, which highlights the importance of making this feature publicly available.
PiperOrigin-RevId: 180854139
Diffstat (limited to 'tensorflow/contrib/seq2seq')
-rw-r--r-- | tensorflow/contrib/seq2seq/python/ops/basic_decoder.py | 2 | ||||
-rw-r--r-- | tensorflow/contrib/seq2seq/python/ops/beam_search_decoder.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tensorflow/contrib/seq2seq/python/ops/basic_decoder.py b/tensorflow/contrib/seq2seq/python/ops/basic_decoder.py index c7c4182f0d..ed226239b8 100644 --- a/tensorflow/contrib/seq2seq/python/ops/basic_decoder.py +++ b/tensorflow/contrib/seq2seq/python/ops/basic_decoder.py @@ -90,7 +90,7 @@ class BasicDecoder(decoder.Decoder): output_shape_with_unknown_batch = nest.map_structure( lambda s: tensor_shape.TensorShape([None]).concatenate(s), size) - layer_output_shape = self._output_layer._compute_output_shape( # pylint: disable=protected-access + layer_output_shape = self._output_layer.compute_output_shape( output_shape_with_unknown_batch) return nest.map_structure(lambda s: s[1:], layer_output_shape) diff --git a/tensorflow/contrib/seq2seq/python/ops/beam_search_decoder.py b/tensorflow/contrib/seq2seq/python/ops/beam_search_decoder.py index 1ff3df4c22..ebe25ce077 100644 --- a/tensorflow/contrib/seq2seq/python/ops/beam_search_decoder.py +++ b/tensorflow/contrib/seq2seq/python/ops/beam_search_decoder.py @@ -250,7 +250,7 @@ class BeamSearchDecoder(decoder.Decoder): output_shape_with_unknown_batch = nest.map_structure( lambda s: tensor_shape.TensorShape([None]).concatenate(s), size) - layer_output_shape = self._output_layer._compute_output_shape( # pylint: disable=protected-access + layer_output_shape = self._output_layer.compute_output_shape( output_shape_with_unknown_batch) return nest.map_structure(lambda s: s[1:], layer_output_shape) |