def test_make_one_hot_works(self):
     n_classes = 10
     for i in range(n_classes):
         one_hot_lab = du.make_onehot(i, n_classes)
         one_hot_lab_true = [0. for _ in range(n_classes)]
         one_hot_lab_true[i] = 1.
         one_hot_lab_true = tf.constant(one_hot_lab_true)
         self.assertAllClose(one_hot_lab, one_hot_lab_true)
Esempio n. 2
0
 def get_loss(self, batch_x, batch_y, return_preds=False):
     if not self.onehot:
         batch_y = dataset_utils.make_onehot(batch_y, self.n_classes)
     return self.get_loss_with_onehot_labels(batch_x, batch_y, return_preds)