diff options
author | Avijit <Avijit.Chakraborty@intel.com> | 2018-08-12 16:21:41 -0700 |
---|---|---|
committer | Avijit <Avijit.Chakraborty@intel.com> | 2018-08-12 16:21:41 -0700 |
commit | 9523a98466d16cf01fc76a67b489f1124cf626ac (patch) | |
tree | bd4c460b67fab60c2fb1a6c56bf22d1cbb5391e6 /tensorflow/python/keras/applications/imagenet_utils_test.py | |
parent | 93e950c308071071f35d6dcb35b9f91b8a34876c (diff) | |
parent | 1a22b0b982fa1a953651b98af8f3cd30542048fd (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'tensorflow/python/keras/applications/imagenet_utils_test.py')
-rw-r--r-- | tensorflow/python/keras/applications/imagenet_utils_test.py | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/tensorflow/python/keras/applications/imagenet_utils_test.py b/tensorflow/python/keras/applications/imagenet_utils_test.py index 3493393090..037e939ac5 100644 --- a/tensorflow/python/keras/applications/imagenet_utils_test.py +++ b/tensorflow/python/keras/applications/imagenet_utils_test.py @@ -88,112 +88,6 @@ class ImageNetUtilsTest(test.TestCase): out2 = model2.predict(x2[np.newaxis])[0] self.assertAllClose(out1, out2.transpose(1, 2, 0)) - def test_obtain_input_shape(self): - # input_shape and default_size are not identical. - with self.assertRaises(ValueError): - keras.applications.imagenet_utils._obtain_input_shape( - input_shape=(224, 224, 3), - default_size=299, - min_size=139, - data_format='channels_last', - require_flatten=True, - weights='imagenet') - - # Test invalid use cases - for data_format in ['channels_last', 'channels_first']: - # input_shape is smaller than min_size. - shape = (100, 100) - if data_format == 'channels_last': - input_shape = shape + (3,) - else: - input_shape = (3,) + shape - with self.assertRaises(ValueError): - keras.applications.imagenet_utils._obtain_input_shape( - input_shape=input_shape, - default_size=None, - min_size=139, - data_format=data_format, - require_flatten=False) - - # shape is 1D. - shape = (100,) - if data_format == 'channels_last': - input_shape = shape + (3,) - else: - input_shape = (3,) + shape - with self.assertRaises(ValueError): - keras.applications.imagenet_utils._obtain_input_shape( - input_shape=input_shape, - default_size=None, - min_size=139, - data_format=data_format, - require_flatten=False) - - # the number of channels is 5 not 3. - shape = (100, 100) - if data_format == 'channels_last': - input_shape = shape + (5,) - else: - input_shape = (5,) + shape - with self.assertRaises(ValueError): - keras.applications.imagenet_utils._obtain_input_shape( - input_shape=input_shape, - default_size=None, - min_size=139, - data_format=data_format, - require_flatten=False) - - # require_flatten=True with dynamic input shape. - with self.assertRaises(ValueError): - keras.applications.imagenet_utils._obtain_input_shape( - input_shape=None, - default_size=None, - min_size=139, - data_format='channels_first', - require_flatten=True) - - assert keras.applications.imagenet_utils._obtain_input_shape( - input_shape=(3, 200, 200), - default_size=None, - min_size=139, - data_format='channels_first', - require_flatten=True) == (3, 200, 200) - - assert keras.applications.imagenet_utils._obtain_input_shape( - input_shape=None, - default_size=None, - min_size=139, - data_format='channels_last', - require_flatten=False) == (None, None, 3) - - assert keras.applications.imagenet_utils._obtain_input_shape( - input_shape=None, - default_size=None, - min_size=139, - data_format='channels_first', - require_flatten=False) == (3, None, None) - - assert keras.applications.imagenet_utils._obtain_input_shape( - input_shape=None, - default_size=None, - min_size=139, - data_format='channels_last', - require_flatten=False) == (None, None, 3) - - assert keras.applications.imagenet_utils._obtain_input_shape( - input_shape=(150, 150, 3), - default_size=None, - min_size=139, - data_format='channels_last', - require_flatten=False) == (150, 150, 3) - - assert keras.applications.imagenet_utils._obtain_input_shape( - input_shape=(3, None, None), - default_size=None, - min_size=139, - data_format='channels_first', - require_flatten=False) == (3, None, None) - if __name__ == '__main__': test.main() |