Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.

Commit

Permalink
s/runScheduledSampleFunc/_run_scheduled_sample_func to keep linter ha…
Browse files Browse the repository at this point in the history
…ppy.

PiperOrigin-RevId: 212057756
  • Loading branch information
afrozenator authored and Copybara-Service committed Sep 7, 2018
1 parent d115041 commit 0686288
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tensor2tensor/layers/common_video_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

class CommonVideoTest(tf.test.TestCase):

def runScheduledSampleFunc(self, func, var, batch_size):
def _run_scheduled_sample_func(self, func, var, batch_size):
ground_truth_x = list(range(1, batch_size+1))
generated_x = [-x for x in ground_truth_x]
ground_truth_x = tf.convert_to_tensor(ground_truth_x)
Expand All @@ -35,39 +35,39 @@ def runScheduledSampleFunc(self, func, var, batch_size):

@tf.contrib.eager.run_test_in_graph_and_eager_modes()
def testScheduledSampleProbStart(self):
ground_truth_x, _, ss_out = self.runScheduledSampleFunc(
ground_truth_x, _, ss_out = self._run_scheduled_sample_func(
common_video.scheduled_sample_prob, 1.0, 10)
self.assertAllEqual(ground_truth_x, ss_out)

@tf.contrib.eager.run_test_in_graph_and_eager_modes()
def testScheduledSampleProbMid(self):
_, _, ss_out = self.runScheduledSampleFunc(
_, _, ss_out = self._run_scheduled_sample_func(
common_video.scheduled_sample_prob, 0.5, 1000)
positive_count = np.sum(ss_out > 0)
self.assertAlmostEqual(positive_count / 1000.0, 0.5, places=1)

@tf.contrib.eager.run_test_in_graph_and_eager_modes()
def testScheduledSampleProbEnd(self):
_, generated_x, ss_out = self.runScheduledSampleFunc(
_, generated_x, ss_out = self._run_scheduled_sample_func(
common_video.scheduled_sample_prob, 0.0, 10)
self.assertAllEqual(generated_x, ss_out)

@tf.contrib.eager.run_test_in_graph_and_eager_modes()
def testScheduledSampleCountStart(self):
ground_truth_x, _, ss_out = self.runScheduledSampleFunc(
ground_truth_x, _, ss_out = self._run_scheduled_sample_func(
common_video.scheduled_sample_count, 10, 10)
self.assertAllEqual(ground_truth_x, ss_out)

@tf.contrib.eager.run_test_in_graph_and_eager_modes()
def testScheduledSampleCountMid(self):
_, _, ss_out = self.runScheduledSampleFunc(
_, _, ss_out = self._run_scheduled_sample_func(
common_video.scheduled_sample_count, 5, 10)
positive_count = np.sum(ss_out > 0)
self.assertEqual(positive_count, 5)

@tf.contrib.eager.run_test_in_graph_and_eager_modes()
def testScheduledSampleCountEnd(self):
_, generated_x, ss_out = self.runScheduledSampleFunc(
_, generated_x, ss_out = self._run_scheduled_sample_func(
common_video.scheduled_sample_count, 0, 10)
self.assertAllEqual(generated_x, ss_out)

Expand Down

0 comments on commit 0686288

Please sign in to comment.