diff options
author | Skye Wanderman-Milne <skyewm@google.com> | 2018-04-05 08:47:47 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-04-05 08:54:14 -0700 |
commit | 7162214b8acc23826f9b72fb6bb65fe4c4555c74 (patch) | |
tree | db0bb0dbbbfb3b82a68e22ca2a3c7ed7426ffbaa /tensorflow/contrib/rnn | |
parent | ed439fc7a70d6acf2f8eb59253b7ac073f23221b (diff) |
Use constants in tf.zeros if the constant won't be too big.
Using fill saves on GraphDef size, but can slow down models since the
total number of ops is greater (fill + shape + constant op). This
change makes us only use fill for large shapes.
PiperOrigin-RevId: 191747456
Diffstat (limited to 'tensorflow/contrib/rnn')
-rw-r--r-- | tensorflow/contrib/rnn/python/kernel_tests/rnn_cell_test.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tensorflow/contrib/rnn/python/kernel_tests/rnn_cell_test.py b/tensorflow/contrib/rnn/python/kernel_tests/rnn_cell_test.py index 63fdd91d36..c7d85862f6 100644 --- a/tensorflow/contrib/rnn/python/kernel_tests/rnn_cell_test.py +++ b/tensorflow/contrib/rnn/python/kernel_tests/rnn_cell_test.py @@ -842,12 +842,12 @@ class RNNCellTest(test.TestCase): batch_size = 3 input_size = 4 expected_state_c = np.array( - [[6.450831e-04, 4.697885e-04], [9.862894e-05, 7.212213e-04], - [4.401947e-04, 9.143004e-04]], + [[0.00072015, 0.00036633], [0.00083481, 0.00047266], + [0.00085111, 0.00053054]], dtype=np.float32) expected_state_h = np.array( - [[4.621217e-04, 3.365449e-04], [7.438179e-05, 5.439147e-04], - [3.347936e-04, 6.953785e-04]], + [[0.0005159, 0.00026243], [0.00062958, 0.00035646], + [0.00064732, 0.00040351]], dtype=np.float32) with variable_scope.variable_scope( "root", initializer=init_ops.constant_initializer(0.5)): |