From 7efb78e55c9993068fdc82df3d2df9d989d111e4 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Wed, 10 Oct 2018 14:22:32 +0000 Subject: [PATCH] Add test case for tf.keras.regularizers.{l1,l2}(0.) with tf.get_variable Signed-off-by: Yong Tang --- tensorflow/python/keras/integration_test.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tensorflow/python/keras/integration_test.py b/tensorflow/python/keras/integration_test.py index 3c0f73b1c3a..0e6fc79dd36 100644 --- a/tensorflow/python/keras/integration_test.py +++ b/tensorflow/python/keras/integration_test.py @@ -26,6 +26,7 @@ from tensorflow.python.keras import testing_utils from tensorflow.python.layers import core as tf_core_layers from tensorflow.python.ops import nn from tensorflow.python.ops import rnn_cell +from tensorflow.python.ops import variable_scope from tensorflow.python.platform import test @@ -312,6 +313,15 @@ class KerasIntegrationTest(test.TestCase): verbose=0) self.assertGreater(history.history['val_acc'][-1], 0.7) + def test_regularizers_with_get_variable(self): + # Test case for GitHub issue 22470. + with self.cached_session(): + v = variable_scope.get_variable( + "v", + shape = [4, 4], + initializer=keras.initializers.glorot_uniform(), + regularizer=keras.regularizers.l2(0.)) + if __name__ == '__main__': test.main()