예제 #1
0
파일: metrics_test.py 프로젝트: yliu45/trax
 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, ())
예제 #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))
예제 #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, ())