aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib
diff options
context:
space:
mode:
authorGravatar Skye Wanderman-Milne <skyewm@google.com>2018-05-16 18:03:01 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-05-16 18:06:14 -0700
commit0c33e1ff58e121a0cf6acdb6aeb8de53cb3abf25 (patch)
tree42d8a74609e78bffda238c3f8f0538bfdf61a80c /tensorflow/contrib
parent1511cf2f51965151147d1ca2e822439c6656b821 (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/contrib')
-rw-r--r--tensorflow/contrib/compiler/jit_test.py2
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/bijectors/reshape_test.py19
-rw-r--r--tensorflow/contrib/framework/python/framework/tensor_util_test.py16
-rw-r--r--tensorflow/contrib/losses/python/losses/loss_ops_test.py9
-rw-r--r--tensorflow/contrib/tensorrt/test/tf_trt_integration_test.py1
-rw-r--r--tensorflow/contrib/training/python/training/batch_sequences_with_states_test.py14
6 files changed, 8 insertions, 53 deletions
diff --git a/tensorflow/contrib/compiler/jit_test.py b/tensorflow/contrib/compiler/jit_test.py
index b2f678fb29..a56a01b163 100644
--- a/tensorflow/contrib/compiler/jit_test.py
+++ b/tensorflow/contrib/compiler/jit_test.py
@@ -24,7 +24,6 @@ from tensorflow.python.framework import function
from tensorflow.python.framework import op_def_registry
from tensorflow.python.framework import ops
from tensorflow.python.framework import random_seed
-from tensorflow.python.framework import test_util
from tensorflow.python.ops import gradients
from tensorflow.python.ops import init_ops
from tensorflow.python.ops import math_ops
@@ -170,7 +169,6 @@ class JITTest(test.TestCase):
self.assertEqual(b"jit_scope_0", func_attrs["_XlaScope"].s)
-@test_util.with_c_api
class CompilationEnabledInGradientTest(test.TestCase):
def testCompilationInGradient(self):
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/bijectors/reshape_test.py b/tensorflow/contrib/distributions/python/kernel_tests/bijectors/reshape_test.py
index 46f2c63f9b..d44e49b487 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/bijectors/reshape_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/bijectors/reshape_test.py
@@ -22,15 +22,12 @@ import numpy as np
from tensorflow.contrib.distributions.python.ops.bijectors.reshape import Reshape
from tensorflow.python.framework import dtypes
-from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
-from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_ops
from tensorflow.python.ops.distributions.bijector_test_util import assert_bijective_and_finite
from tensorflow.python.platform import test
-@test_util.with_c_api
class _ReshapeBijectorTest(object):
"""Base class for testing the reshape transformation.
@@ -265,7 +262,6 @@ class _ReshapeBijectorTest(object):
raise NotImplementedError("Subclass failed to implement `build_shapes`.")
-@test_util.with_c_api
class ReshapeBijectorTestStatic(test.TestCase, _ReshapeBijectorTest):
def build_shapes(self, shape_in, shape_out):
@@ -305,21 +301,13 @@ class ReshapeBijectorTestStatic(test.TestCase, _ReshapeBijectorTest):
bijector, x, y, event_ndims=2, rtol=1e-6, atol=0)
def testInvalidDimensionsOpError(self):
- if ops._USE_C_API:
- error_message = "Invalid value in tensor used for shape: -2"
- else:
- error_message = "elements must be either positive integers or `-1`."
- self._testInvalidDimensionsOpError(error_message)
+ self._testInvalidDimensionsOpError(
+ "Invalid value in tensor used for shape: -2")
def testInputOutputMismatchOpError(self):
- if ops._USE_C_API:
- error_message = "Cannot reshape a tensor with"
- else:
- error_message = "Input to reshape is a tensor with"
- self._testInputOutputMismatchOpError(error_message)
+ self._testInputOutputMismatchOpError("Cannot reshape a tensor with")
-@test_util.with_c_api
class ReshapeBijectorTestDynamic(test.TestCase, _ReshapeBijectorTest):
def build_shapes(self, shape_in, shape_out):
@@ -341,7 +329,6 @@ class ReshapeBijectorTestDynamic(test.TestCase, _ReshapeBijectorTest):
self._testInputOutputMismatchOpError("Input to reshape is a tensor with")
-@test_util.with_c_api
class ReshapeBijectorTestDynamicNdims(test.TestCase, _ReshapeBijectorTest):
def build_shapes(self, shape_in, shape_out):
diff --git a/tensorflow/contrib/framework/python/framework/tensor_util_test.py b/tensorflow/contrib/framework/python/framework/tensor_util_test.py
index 8fc4f60492..af1b404cb5 100644
--- a/tensorflow/contrib/framework/python/framework/tensor_util_test.py
+++ b/tensorflow/contrib/framework/python/framework/tensor_util_test.py
@@ -78,7 +78,6 @@ class AssertScalarIntTest(test.TestCase):
[3, 4], dtype=dtypes.int32))
-@test_util.with_c_api
class WithShapeTest(test.TestCase):
def _assert_with_shape(self, tensor, expected_value, expected_shape,
@@ -216,25 +215,18 @@ class WithShapeTest(test.TestCase):
tensor_partial_shape.set_shape([None, 2])
for incompatible_shape in [[0], [1]]:
- if ops._USE_C_API:
- error_message = "Shapes must be equal rank, but are 2 and 1"
- else:
- error_message = r"Shapes \(\?, 2\) and \([01],\) are not compatible"
self.assertRaisesRegexp(
- ValueError, error_message,
+ ValueError, "Shapes must be equal rank, but are 2 and 1",
tensor_util.with_shape, incompatible_shape, tensor_partial_shape)
for incompatible_shape in [[1, 2, 1]]:
self.assertRaisesRegexp(ValueError, "Dimensions must be equal",
tensor_util.with_shape, incompatible_shape,
tensor_partial_shape)
for incompatible_shape in [[2, 1]]:
- if ops._USE_C_API:
- error_message = (r"Dimension 1 in both shapes must be equal, but are "
- r"2 and 1. Shapes are \[\?,2\] and \[2,1\].")
- else:
- error_message = r"Shapes \(\?, 2\) and \(2, 1\) are not compatible"
self.assertRaisesRegexp(
- ValueError, error_message,
+ ValueError,
+ r"Dimension 1 in both shapes must be equal, but are 2 and 1. "
+ r"Shapes are \[\?,2\] and \[2,1\].",
tensor_util.with_shape, incompatible_shape, tensor_partial_shape)
compatible_shape = [2, 2]
diff --git a/tensorflow/contrib/losses/python/losses/loss_ops_test.py b/tensorflow/contrib/losses/python/losses/loss_ops_test.py
index 1417772e04..2a442a8fc8 100644
--- a/tensorflow/contrib/losses/python/losses/loss_ops_test.py
+++ b/tensorflow/contrib/losses/python/losses/loss_ops_test.py
@@ -24,10 +24,8 @@ from tensorflow.contrib.framework.python.ops import arg_scope
from tensorflow.contrib.losses.python.losses import loss_ops
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
-from tensorflow.python.framework import errors_impl
from tensorflow.python.framework import ops
from tensorflow.python.framework import random_seed
-from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import init_ops
from tensorflow.python.ops import math_ops
@@ -275,7 +273,6 @@ class SoftmaxCrossEntropyLossTest(test.TestCase):
self.assertAlmostEqual(np.average(weights) * 10.0, loss, 3)
-@test_util.with_c_api
class SparseSoftmaxCrossEntropyLossTest(test.TestCase):
def testNoneWeightRaisesValueError(self):
@@ -473,11 +470,7 @@ class SparseSoftmaxCrossEntropyLossTest(test.TestCase):
labels = constant_op.constant([[0, 1], [2, 3]])
weights = constant_op.constant([1.2, 3.4, 5.6, 7.8])
- if ops._USE_C_API:
- error_type = ValueError
- else:
- error_type = errors_impl.InvalidArgumentError
- with self.assertRaises(error_type):
+ with self.assertRaises(ValueError):
loss_ops.sparse_softmax_cross_entropy(
logits, labels, weights=weights).eval()
diff --git a/tensorflow/contrib/tensorrt/test/tf_trt_integration_test.py b/tensorflow/contrib/tensorrt/test/tf_trt_integration_test.py
index 7a47328762..d426e9f12c 100644
--- a/tensorflow/contrib/tensorrt/test/tf_trt_integration_test.py
+++ b/tensorflow/contrib/tensorrt/test/tf_trt_integration_test.py
@@ -34,7 +34,6 @@ from tensorflow.python.ops import nn_ops as nn_ops
from tensorflow.python.platform import googletest
-@test_util.with_c_api
class IntegrationTest(test_util.TensorFlowTestCase):
"""Class to test Tensorflow-TensorRT integration."""
diff --git a/tensorflow/contrib/training/python/training/batch_sequences_with_states_test.py b/tensorflow/contrib/training/python/training/batch_sequences_with_states_test.py
index f305197c19..df07ff44ee 100644
--- a/tensorflow/contrib/training/python/training/batch_sequences_with_states_test.py
+++ b/tensorflow/contrib/training/python/training/batch_sequences_with_states_test.py
@@ -27,7 +27,6 @@ from tensorflow.python.framework import dtypes
from tensorflow.python.framework import errors_impl
from tensorflow.python.framework import ops
from tensorflow.python.framework import sparse_tensor
-from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import random_ops
@@ -506,19 +505,6 @@ class BatchSequencesWithStatesTest(test.TestCase):
expected_seq4_batch2=expected_seq4_batch2)
-class BatchSequencesWithStatesTestWithCApi(BatchSequencesWithStatesTest):
-
- def setUp(self):
- self._prev_value = ops._USE_C_API
- ops._USE_C_API = True
- super(BatchSequencesWithStatesTestWithCApi, self).setUp()
-
- def tearDown(self):
- super(BatchSequencesWithStatesTestWithCApi, self).tearDown()
- ops._USE_C_API = self._prev_value
-
-
-@test_util.with_c_api
class PaddingTest(test.TestCase):
def testPaddingInvalidLengths(self):