(self)
| 45 | return path |
| 46 | |
| 47 | def setUp(self): |
| 48 | super().setUp() |
| 49 | |
| 50 | self.decode_fn = data_utils.make_decode_fn(self.name_to_features, |
| 51 | self.samples_per_example) |
| 52 | |
| 53 | self.data1 = np.random.randint( |
| 54 | 0, |
| 55 | 10, |
| 56 | size=(self.dataset_size // self.samples_per_example, |
| 57 | self.data_dim * self.samples_per_example), |
| 58 | dtype=np.int64) |
| 59 | |
| 60 | self.data2 = np.random.randint( |
| 61 | 0, |
| 62 | 10, |
| 63 | size=(self.dataset_size // self.samples_per_example, |
| 64 | self.data_dim * self.samples_per_example), |
| 65 | dtype=np.int64) |
| 66 | |
| 67 | self.workdir_obj = self.create_tempdir() |
| 68 | self.workdir = self.workdir_obj.full_path |
| 69 | self.data_patterns = [ |
| 70 | os.path.join(self.workdir, filename) for filename in self.data_files |
| 71 | ] |
| 72 | |
| 73 | for dataset_idx, data in enumerate([self.data1, self.data2]): |
| 74 | writer = tf.io.TFRecordWriter(self.data_patterns[dataset_idx]) |
| 75 | for row in data: |
| 76 | features = tf.train.Features(feature={ |
| 77 | 'x': tf.train.Feature(int64_list=tf.train.Int64List(value=row)), |
| 78 | }) |
| 79 | |
| 80 | record_bytes = tf.train.Example(features=features).SerializeToString() |
| 81 | writer.write(record_bytes) |
| 82 | |
| 83 | @parameterized.parameters( |
| 84 | (1, 1, 1, 0, False), |
nothing calls this directly
no outgoing calls
no test coverage detected