aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/losses
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-09-17 13:24:29 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-17 13:34:57 -0700
commita768624f1d0ae3629caf5b9784b4b6911b881c18 (patch)
treef7581648c47b4ad95d10099f4485e5f41463f767 /tensorflow/contrib/losses
parentd7b4bf68dc80f1abf90bd6b857f079157028a861 (diff)
Move from deprecated self.test_session() to self.cached_session().
self.test_session() has been deprecated in 9962eb5e84b15e309410071b06c2ed2d6148ed44 as its name confuses readers of the test. Moving to cached_session() instead which is more explicit about: * the fact that the session may be reused. * the session is not closed even when doing a "with self.test_session()" statement. PiperOrigin-RevId: 213326581
Diffstat (limited to 'tensorflow/contrib/losses')
-rw-r--r--tensorflow/contrib/losses/python/metric_learning/metric_loss_ops_test.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/tensorflow/contrib/losses/python/metric_learning/metric_loss_ops_test.py b/tensorflow/contrib/losses/python/metric_learning/metric_loss_ops_test.py
index 4ec539ab42..9c389144ff 100644
--- a/tensorflow/contrib/losses/python/metric_learning/metric_loss_ops_test.py
+++ b/tensorflow/contrib/losses/python/metric_learning/metric_loss_ops_test.py
@@ -61,7 +61,7 @@ def pairwise_distance_np(feature, squared=False):
class ContrastiveLossTest(test.TestCase):
def testContrastive(self):
- with self.test_session():
+ with self.cached_session():
num_data = 10
feat_dim = 6
margin = 1.0
@@ -90,7 +90,7 @@ class ContrastiveLossTest(test.TestCase):
class TripletSemiHardLossTest(test.TestCase):
def testTripletSemiHard(self):
- with self.test_session():
+ with self.cached_session():
num_data = 10
feat_dim = 6
margin = 1.0
@@ -146,7 +146,7 @@ class TripletSemiHardLossTest(test.TestCase):
class LiftedStructLossTest(test.TestCase):
def testLiftedStruct(self):
- with self.test_session():
+ with self.cached_session():
num_data = 10
feat_dim = 6
margin = 1.0
@@ -217,7 +217,7 @@ def convert_to_list_of_sparse_tensor(np_matrix):
class NpairsLossTest(test.TestCase):
def testNpairs(self):
- with self.test_session():
+ with self.cached_session():
num_data = 15
feat_dim = 6
num_classes = 5
@@ -261,7 +261,7 @@ class NpairsLossTest(test.TestCase):
class NpairsLossMultiLabelTest(test.TestCase):
def testNpairsMultiLabelLossWithSingleLabelEqualsNpairsLoss(self):
- with self.test_session():
+ with self.cached_session():
num_data = 15
feat_dim = 6
reg_lambda = 0.02
@@ -290,7 +290,7 @@ class NpairsLossMultiLabelTest(test.TestCase):
self.assertAllClose(loss_npairs, loss_npairs_multilabel)
def testNpairsMultiLabel(self):
- with self.test_session():
+ with self.cached_session():
num_data = 15
feat_dim = 6
num_classes = 10
@@ -527,7 +527,7 @@ class ClusterLossTest(test.TestCase):
def testClusteringLossPAMOff(self):
if not HAS_SKLEARN:
return
- with self.test_session():
+ with self.cached_session():
margin_multiplier = 10.0
embeddings, labels = self._genClusters(n_samples=128, n_clusters=64)
@@ -544,7 +544,7 @@ class ClusterLossTest(test.TestCase):
def testClusteringLossPAMOn(self):
if not HAS_SKLEARN:
return
- with self.test_session():
+ with self.cached_session():
margin_multiplier = 10.0
embeddings, labels = self._genClusters(n_samples=128, n_clusters=64)