Beispiel #1
0
 def test_invalid_total_samples(self):
     self.assertRaises(
         ValueError, lambda: cca.PipelineResultsIterator(
             zip(pipeline_helper.generate_data(1)), 0))
     self.assertRaises(
         ValueError, lambda: cca.PipelineResultsIterator(
             zip(pipeline_helper.generate_data(1)), -1))
 def setUp(self) -> None:
     self.orig_len = 5
     self.dups_num = 4
     self.data = list(pipeline_helper.generate_data(self.orig_len))
     self.op = cca.Duplicate(self.dups_num)
     self.result = pipeline_helper.run_ops_in_trivial_pipeline(
         self.data, [self.op])
Beispiel #3
0
 def test_iterates_correctly(self):
     imgs, dms = pipeline_helper.generate_data(5)
     data = zip(imgs, dms)
     iterator = cca.PipelineResultsIterator(zip(imgs, dms), 10, False)
     for i, (orig, from_iter) in enumerate(zip(data, iterator)):
         with self.subTest(i=i):
             self.assertTrue(np.all(orig[0] == from_iter[0]))
             self.assertTrue(np.all(orig[1] == from_iter[1]))
Beispiel #4
0
 def setUp(self) -> None:
     self.samples_num = 5
     self.data = pipeline_helper.generate_data(self.samples_num)
 def setUp(self) -> None:
     self.orig_len = 3
     self.data = list(pipeline_helper.generate_data(self.orig_len))
 def _generate_sample(width, height):
     imgs, dms = pipeline_helper.generate_data(1, width, height)
     return imgs[0], dms[0]
 def _do_dropout(self, rate):
     data = pipeline_helper.generate_data(self.orig_len)
     op = cca.Dropout(rate)
     return pipeline_helper.run_ops_in_trivial_pipeline(data, [op])