MCPcopy Index your code
hub / github.com/tensorlayer/TensorLayer / train_and_validate_to_end

Method train_and_validate_to_end

tensorlayer/distributed.py:211–227  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.")

Callers

nothing calls this directly

Calls 1

train_on_batchMethod · 0.95

Tested by

no test coverage detected