A helper function that shows how to train and validate a model at the same time. Parameters ---------- validate_step_size : int Validate the training network every N steps.
(self, validate_step_size=50)
| 209 | self._sess.run(self._train_op) |
| 210 | |
| 211 | def train_and_validate_to_end(self, validate_step_size=50): |
| 212 | """A helper function that shows how to train and validate a model at the same time. |
| 213 | |
| 214 | Parameters |
| 215 | ---------- |
| 216 | validate_step_size : int |
| 217 | Validate the training network every N steps. |
| 218 | |
| 219 | """ |
| 220 | while not self._sess.should_stop(): |
| 221 | self.train_on_batch() # Run a training step synchronously. |
| 222 | if self.global_step % validate_step_size == 0: |
| 223 | # logging.info("Average loss for validation dataset: %s" % self.get_validation_metrics()) |
| 224 | log_str = 'step: %d, ' % self.global_step |
| 225 | for n, m in self.validation_metrics: |
| 226 | log_str += '%s: %f, ' % (n.name, m) |
| 227 | logging.info(log_str) |
| 228 | |
| 229 | |
| 230 | @deprecated(date="2018-10-30", instructions="Using the TensorLayer distributed trainer.") |
nothing calls this directly
no test coverage detected