24
24
25
25
class CommonVideoTest (tf .test .TestCase ):
26
26
27
- def runScheduledSampleFunc (self , func , var , batch_size ):
27
+ def _run_scheduled_sample_func (self , func , var , batch_size ):
28
28
ground_truth_x = list (range (1 , batch_size + 1 ))
29
29
generated_x = [- x for x in ground_truth_x ]
30
30
ground_truth_x = tf .convert_to_tensor (ground_truth_x )
@@ -35,39 +35,39 @@ def runScheduledSampleFunc(self, func, var, batch_size):
35
35
36
36
@tf .contrib .eager .run_test_in_graph_and_eager_modes ()
37
37
def testScheduledSampleProbStart (self ):
38
- ground_truth_x , _ , ss_out = self .runScheduledSampleFunc (
38
+ ground_truth_x , _ , ss_out = self ._run_scheduled_sample_func (
39
39
common_video .scheduled_sample_prob , 1.0 , 10 )
40
40
self .assertAllEqual (ground_truth_x , ss_out )
41
41
42
42
@tf .contrib .eager .run_test_in_graph_and_eager_modes ()
43
43
def testScheduledSampleProbMid (self ):
44
- _ , _ , ss_out = self .runScheduledSampleFunc (
44
+ _ , _ , ss_out = self ._run_scheduled_sample_func (
45
45
common_video .scheduled_sample_prob , 0.5 , 1000 )
46
46
positive_count = np .sum (ss_out > 0 )
47
47
self .assertAlmostEqual (positive_count / 1000.0 , 0.5 , places = 1 )
48
48
49
49
@tf .contrib .eager .run_test_in_graph_and_eager_modes ()
50
50
def testScheduledSampleProbEnd (self ):
51
- _ , generated_x , ss_out = self .runScheduledSampleFunc (
51
+ _ , generated_x , ss_out = self ._run_scheduled_sample_func (
52
52
common_video .scheduled_sample_prob , 0.0 , 10 )
53
53
self .assertAllEqual (generated_x , ss_out )
54
54
55
55
@tf .contrib .eager .run_test_in_graph_and_eager_modes ()
56
56
def testScheduledSampleCountStart (self ):
57
- ground_truth_x , _ , ss_out = self .runScheduledSampleFunc (
57
+ ground_truth_x , _ , ss_out = self ._run_scheduled_sample_func (
58
58
common_video .scheduled_sample_count , 10 , 10 )
59
59
self .assertAllEqual (ground_truth_x , ss_out )
60
60
61
61
@tf .contrib .eager .run_test_in_graph_and_eager_modes ()
62
62
def testScheduledSampleCountMid (self ):
63
- _ , _ , ss_out = self .runScheduledSampleFunc (
63
+ _ , _ , ss_out = self ._run_scheduled_sample_func (
64
64
common_video .scheduled_sample_count , 5 , 10 )
65
65
positive_count = np .sum (ss_out > 0 )
66
66
self .assertEqual (positive_count , 5 )
67
67
68
68
@tf .contrib .eager .run_test_in_graph_and_eager_modes ()
69
69
def testScheduledSampleCountEnd (self ):
70
- _ , generated_x , ss_out = self .runScheduledSampleFunc (
70
+ _ , generated_x , ss_out = self ._run_scheduled_sample_func (
71
71
common_video .scheduled_sample_count , 0 , 10 )
72
72
self .assertAllEqual (generated_x , ss_out )
73
73
0 commit comments