From a39a4f9b8cc4ce404972f35c7c0d2f1204415f75 Mon Sep 17 00:00:00 2001 From: abhilash1910 Date: Mon, 6 Sep 2021 20:34:13 +0530 Subject: [PATCH 1/2] Fix test case for dnc utils_test.py for TF <=2.5 ,typos --- sonnet/src/nets/dnc/control.py | 4 ++-- sonnet/src/nets/dnc/util_test.py | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/sonnet/src/nets/dnc/control.py b/sonnet/src/nets/dnc/control.py index b9d74bcb..74a08f42 100644 --- a/sonnet/src/nets/dnc/control.py +++ b/sonnet/src/nets/dnc/control.py @@ -27,7 +27,7 @@ def get_controller_ctor(controller_name): - """Returns the constructor for a givn controller name.""" + """Returns the constructor for a given controller name.""" if controller_name == 'LSTM': return recurrent.LSTM elif controller_name == 'GRU': @@ -100,7 +100,7 @@ def deep_core(control_name, num_layers: Number of layers. skip_connections: Boolean that indicates whether to use skip connections. See documenation for sonnet.DeepRnn in - //learning/deepmind/tensorflow/sonnet/python/modules/basic_rnn.py for more + https://github.com/deepmind/sonnet/blob/master/sonnet/python/modules/basic_rnn.py for more information. name: module name. diff --git a/sonnet/src/nets/dnc/util_test.py b/sonnet/src/nets/dnc/util_test.py index a7ed9f45..fa1d5e55 100644 --- a/sonnet/src/nets/dnc/util_test.py +++ b/sonnet/src/nets/dnc/util_test.py @@ -151,9 +151,15 @@ def testDifferentOutputSizeBreaks(self): lin_b = linear.Linear(output_size_b, name='lin_b') input_a = tf.random.uniform([batch_size, input_size]) input_b = tf.random.uniform([batch_size, input_size]) - with self.assertRaisesIncompatibleShapesError( - tf.errors.InvalidArgumentError): - util.apply_linear((input_a, input_b), (lin_a, lin_b)) + if tf.__version__>="2.5.0": + with self.assertRaisesIncompatibleShapesError( + tf.errors.InvalidArgumentError): + util.apply_linear((input_a, input_b), (lin_a, lin_b)) + else: + with self.assertRaises( + tf.errors.InvalidArgumentError): + util.apply_linear((input_a, input_b), (lin_a, lin_b)) + @parameterized.parameters( { From 352089c70b6808589f902592cd234ca2ee43f40e Mon Sep 17 00:00:00 2001 From: abhilash1910 Date: Wed, 8 Sep 2021 17:30:40 +0530 Subject: [PATCH 2/2] Revert tf checkpoint and RST x-link change --- sonnet/src/nets/dnc/control.py | 4 +--- sonnet/src/nets/dnc/util_test.py | 12 +++--------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/sonnet/src/nets/dnc/control.py b/sonnet/src/nets/dnc/control.py index 74a08f42..122e6361 100644 --- a/sonnet/src/nets/dnc/control.py +++ b/sonnet/src/nets/dnc/control.py @@ -99,9 +99,7 @@ def deep_core(control_name, control_config: Dictionary containing the configuration for the modules. num_layers: Number of layers. skip_connections: Boolean that indicates whether to use skip connections. - See documenation for sonnet.DeepRnn in - https://github.com/deepmind/sonnet/blob/master/sonnet/python/modules/basic_rnn.py for more - information. + See documentation for :class:`DeepRNN` for more information. name: module name. Returns: diff --git a/sonnet/src/nets/dnc/util_test.py b/sonnet/src/nets/dnc/util_test.py index fa1d5e55..a7ed9f45 100644 --- a/sonnet/src/nets/dnc/util_test.py +++ b/sonnet/src/nets/dnc/util_test.py @@ -151,15 +151,9 @@ def testDifferentOutputSizeBreaks(self): lin_b = linear.Linear(output_size_b, name='lin_b') input_a = tf.random.uniform([batch_size, input_size]) input_b = tf.random.uniform([batch_size, input_size]) - if tf.__version__>="2.5.0": - with self.assertRaisesIncompatibleShapesError( - tf.errors.InvalidArgumentError): - util.apply_linear((input_a, input_b), (lin_a, lin_b)) - else: - with self.assertRaises( - tf.errors.InvalidArgumentError): - util.apply_linear((input_a, input_b), (lin_a, lin_b)) - + with self.assertRaisesIncompatibleShapesError( + tf.errors.InvalidArgumentError): + util.apply_linear((input_a, input_b), (lin_a, lin_b)) @parameterized.parameters( {