MCPcopy Create free account
hub / github.com/tensorflow/models / train

Method train

official/benchmark/tf_scan_benchmark.py:84–94  ·  view source on GitHub ↗
(self, epochs, batch_size, num_batches)

Source from the content-addressed store, hash-verified

82 return loss
83
84 def train(self, epochs, batch_size, num_batches):
85 data_generator_iter = gen_batches(num_batches, batch_size, self.units)
86 sample_x, sample_y = next(data_generator_iter)
87 self.train_on_batch(sample_x, sample_y)
88 self._training = True
89 progress_bar = tqdm(range(epochs), desc="Epochs")
90 for epoch in progress_bar:
91 for batch_x, batch_y in data_generator_iter:
92 loss = self.train_on_batch(batch_x, batch_y)
93 progress_bar.update(1)
94 progress_bar.set_postfix({"loss": f"{loss.numpy():.3f}"})
95
96
97def _run_benchmark(model):

Calls 3

train_on_batchMethod · 0.95
gen_batchesFunction · 0.85
updateMethod · 0.80