def _build_phases(self):
    'Returns list of phases from config.\n\n        These phases will look like:\n        {\n          train: is this a train or test phase?\n          optimizer: optimizer settings\n        }\n\n        - If this is a test only run, then only test phases will be\n        generated\n        - If this is a training run with both train and test datasets, then x phases =\n          x train phases + x test phases, interleaved. If test_phase_period > 1, test\n          phases are only added after test_phase_period train phases. The last phase is\n          always a test phase.\n        - If this is a training run with only a train dataset, then x phases = x train\n          phases.\n        '
    if (not self.test_only):
        phases = [{'train': True} for _ in range(math.ceil((self.train_phases_per_epoch * self.num_epochs)))]
        if self._train_only:
            return phases
        final_phases = []
        for (i, phase) in enumerate(phases):
            final_phases.append(phase)
            if (((i + 1) % self.test_phase_period) == 0):
                final_phases.append({'train': False})
        if final_phases[(- 1)]['train']:
            final_phases.append({'train': False})
        return final_phases
    return [{'train': False} for _ in range(self.num_epochs)]
Returns list of phases from config.

These phases will look like:
{
  train: is this a train or test phase?
  optimizer: optimizer settings
}

- If this is a test only run, then only test phases will be
generated
- If this is a training run with both train and test datasets, then x phases =
  x train phases + x test phases, interleaved. If test_phase_period > 1, test
  phases are only added after test_phase_period train phases. The last phase is
  always a test phase.
- If this is a training run with only a train dataset, then x phases = x train
  phases.
def _build_phases(self):
    'Returns list of phases from config.\n\n        These phases will look like:\n        {\n          train: is this a train or test phase?\n          optimizer: optimizer settings\n        }\n\n        - If this is a test only run, then only test phases will be\n        generated\n        - If this is a training run with both train and test datasets, then x phases =\n          x train phases + x test phases, interleaved. If test_phase_period > 1, test\n          phases are only added after test_phase_period train phases. The last phase is\n          always a test phase.\n        - If this is a training run with only a train dataset, then x phases = x train\n          phases.\n        '
    if (not self.test_only):
        phases = [{'train': True} for _ in range(math.ceil((self.train_phases_per_epoch * self.num_epochs)))]
        if self._train_only:
            return phases
        final_phases = []
        for (i, phase) in enumerate(phases):
            final_phases.append(phase)
            if (((i + 1) % self.test_phase_period) == 0):
                final_phases.append({'train': False})
        if final_phases[(- 1)]['train']:
            final_phases.append({'train': False})
        return final_phases
    return [{'train': False} for _ in range(self.num_epochs)]