def test_binary_cross_entropy_loss(self): # TODO(jonni): Clarify desired semantics/naming, then test it. layer = tl.BinaryCrossEntropyLoss() xs = [np.ones((9, 1)), np.ones((9, 1)), np.ones((9, 1))] y = layer(xs) self.assertEqual(y.shape, ())
def test_names(self): layer = tl.L2Loss() self.assertEqual('L2Loss_in3', str(layer)) layer = tl.Accuracy() self.assertEqual('Accuracy_in3', str(layer)) layer = tl.SequenceAccuracy() self.assertEqual('SequenceAccuracy_in3', str(layer)) layer = tl.BinaryCrossEntropyLoss() self.assertEqual('BinaryCrossEntropyLoss_in3', str(layer)) layer = tl.CrossEntropyLoss() self.assertEqual('CrossEntropyLoss_in3', str(layer)) layer = tl.BinaryCrossEntropySum() self.assertEqual('BinaryCrossEntropySum_in3', str(layer)) layer = tl.CrossEntropySum() self.assertEqual('CrossEntropySum_in3', str(layer))
def test_binary_cross_entropy_loss(self): layer = tl.BinaryCrossEntropyLoss() xs = [np.ones((9, 1)), np.ones((9, 1)), np.ones((9, 1))] y = layer(xs) self.assertEqual(y.shape, ())