wrapper
()
| 347 | self.features[phase] = features |
| 348 | |
| 349 | def wrapper(): |
| 350 | """wrapper""" |
| 351 | all_dev_batches = [] |
| 352 | for epoch_index in range(epoch): |
| 353 | if phase == "train": |
| 354 | self.current_example = 0 |
| 355 | self.current_epoch = epoch_index |
| 356 | |
| 357 | trainer_id = self.trainer_id |
| 358 | if shuffle: |
| 359 | np.random.shuffle(examples) |
| 360 | for batch_data in self._prepare_batch_data( |
| 361 | examples, batch_size, phase=phase, do_decode=do_decode, place=place): |
| 362 | if len(all_dev_batches) < dev_count: |
| 363 | all_dev_batches.append(batch_data) |
| 364 | if len(all_dev_batches) == dev_count: |
| 365 | yield all_dev_batches[trainer_id] |
| 366 | all_dev_batches = [] |
| 367 | |
| 368 | if phase != "train": |
| 369 | if trainer_id < len(all_dev_batches): |
| 370 | yield all_dev_batches[trainer_id] |
| 371 | |
| 372 | return wrapper |
| 373 |
nothing calls this directly
no test coverage detected