diff options
author | 2018-05-16 18:03:01 -0700 | |
---|---|---|
committer | 2018-05-16 18:06:14 -0700 | |
commit | 0c33e1ff58e121a0cf6acdb6aeb8de53cb3abf25 (patch) | |
tree | 42d8a74609e78bffda238c3f8f0538bfdf61a80c /tensorflow/python/feature_column | |
parent | 1511cf2f51965151147d1ca2e822439c6656b821 (diff) |
Remove _USE_C_API staging in tests now that the C API is enabled by default.
This is in preparation for removing the _USE_C_API toggle altogether.
PiperOrigin-RevId: 196920481
Diffstat (limited to 'tensorflow/python/feature_column')
-rw-r--r-- | tensorflow/python/feature_column/feature_column_test.py | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/tensorflow/python/feature_column/feature_column_test.py b/tensorflow/python/feature_column/feature_column_test.py index 03c47eea31..f9206f4f38 100644 --- a/tensorflow/python/feature_column/feature_column_test.py +++ b/tensorflow/python/feature_column/feature_column_test.py @@ -1284,7 +1284,6 @@ def get_keras_linear_model_predictions(features, return retval -@test_util.with_c_api class LinearModelTest(test.TestCase): def test_raises_if_empty_feature_columns(self): @@ -1560,16 +1559,10 @@ class LinearModelTest(test.TestCase): price = fc.numeric_column('price', shape=2) with ops.Graph().as_default(): features = {'price': [[1.], [5.]]} - if ops._USE_C_API: - with self.assertRaisesRegexp( - Exception, - r'Cannot reshape a tensor with 2 elements to shape \[2,2\]'): - predictions = fc.linear_model(features, [price]) - else: - predictions = fc.linear_model(features, [price]) - with _initialized_session(): - with self.assertRaisesRegexp(Exception, 'requested shape has 4'): - predictions.eval() + with self.assertRaisesRegexp( + Exception, + r'Cannot reshape a tensor with 2 elements to shape \[2,2\]'): + fc.linear_model(features, [price]) def test_dense_reshaping(self): price = fc.numeric_column('price', shape=[1, 2]) @@ -1933,7 +1926,6 @@ class LinearModelTest(test.TestCase): sess.run(net, feed_dict={features['price']: np.array(1)}) -@test_util.with_c_api class _LinearModelTest(test.TestCase): def test_raises_if_empty_feature_columns(self): @@ -2198,16 +2190,10 @@ class _LinearModelTest(test.TestCase): price = fc.numeric_column('price', shape=2) with ops.Graph().as_default(): features = {'price': [[1.], [5.]]} - if ops._USE_C_API: - with self.assertRaisesRegexp( - Exception, - r'Cannot reshape a tensor with 2 elements to shape \[2,2\]'): - predictions = get_keras_linear_model_predictions(features, [price]) - else: - predictions = get_keras_linear_model_predictions(features, [price]) - with _initialized_session(): - with self.assertRaisesRegexp(Exception, 'requested shape has 4'): - predictions.eval() + with self.assertRaisesRegexp( + Exception, + r'Cannot reshape a tensor with 2 elements to shape \[2,2\]'): + get_keras_linear_model_predictions(features, [price]) def test_dense_reshaping(self): price = fc.numeric_column('price', shape=[1, 2]) @@ -2694,7 +2680,6 @@ class InputLayerTest(test.TestCase): self.assertAllEqual([[2, 2], [2, 2], [2, 2]], gradient) -@test_util.with_c_api class FunctionalInputLayerTest(test.TestCase): def test_raises_if_empty_feature_columns(self): @@ -2759,16 +2744,10 @@ class FunctionalInputLayerTest(test.TestCase): price = fc.numeric_column('price', shape=2) with ops.Graph().as_default(): features = {'price': [[1.], [5.]]} - if ops._USE_C_API: - with self.assertRaisesRegexp( - Exception, - r'Cannot reshape a tensor with 2 elements to shape \[2,2\]'): - net = fc.input_layer(features, [price]) - else: - net = fc.input_layer(features, [price]) - with _initialized_session(): - with self.assertRaisesRegexp(Exception, 'requested shape has 4'): - net.eval() + with self.assertRaisesRegexp( + Exception, + r'Cannot reshape a tensor with 2 elements to shape \[2,2\]'): + fc.input_layer(features, [price]) def test_reshaping(self): price = fc.numeric_column('price', shape=[1, 2]) |