INNER CODE UNIT · Python
loss
deepchem/deepchem · contrib/tensorflow_models/__init__.py:373
loss = fetched_values[-1]
avg_loss += loss
index += 1
index_in_epoch += 1
if len(epoch_end_indices) > 0 and index >= epoch_end_indices[0]:
# We have reached the end of an epoch.
if epoch % checkpoint_interval == checkpoint_interval - 1:
saver.save(sess, self._save_path, global_step=epoch)
avg_loss = float(avg_loss) / index_in_epoch
log('Ending epoch %d: Average loss %g' % (epoch, avg_loss),
self.verbose)
epoch += 1
index_in_epoch = 0
avg_loss = 0.0
del epoch_end_indices[0]
except tf.errors.OutOfRangeError:
# We have reached the end of the data.
pass