MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _create_loss

Method _create_loss

modelzoo/bst/train.py:331–336  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

329
330 # compute loss
331 def _create_loss(self):
332 loss_func = tf.keras.losses.CategoricalCrossentropy()
333 self.probability = tf.squeeze(self.probability)
334 self.loss = tf.math.reduce_mean(
335 loss_func(self._label, self.probability))
336 tf.summary.scalar('loss', self.loss)
337
338 # define optimizer and generate train_op
339 def _create_optimizer(self):

Callers 1

__init__Method · 0.95

Calls 2

reduce_meanMethod · 0.80
scalarMethod · 0.45

Tested by

no test coverage detected