Ejemplo n.º 1
0
 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, ())
Ejemplo n.º 2
0
 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))
Ejemplo n.º 3
0
 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, ())