| 555 | |
| 556 | # compute loss |
| 557 | def _create_loss(self): |
| 558 | self._logits = tf.squeeze(self._logits) |
| 559 | self._crt_loss = tf.losses.sigmoid_cross_entropy( |
| 560 | self._label, |
| 561 | self._logits, |
| 562 | scope='loss', |
| 563 | reduction=tf.losses.Reduction.SUM_OVER_BATCH_SIZE) |
| 564 | self.loss = self._crt_loss + self._aux_loss |
| 565 | tf.summary.scalar('sigmoid_cross_entropy', self._crt_loss) |
| 566 | tf.summary.scalar('aux_loss', self._aux_loss) |
| 567 | tf.summary.scalar('loss', self.loss) |
| 568 | |
| 569 | # define optimizer and generate train_op |
| 570 | def _create_optimizer(self): |