Beispiel #1
0
 def test_tracer_index(self):
     lyr = cb.Parallel(activation_fns.Tanh(), activation_fns.Tanh())
     a = tracer.Tracer('a')
     b = tracer.Tracer('b')
     d, e = lyr @ (a, b)
     result0 = tracer.IndexExpr(0, tracer.ApplyExpr(lyr, ('a', 'b')))
     result1 = tracer.IndexExpr(1, tracer.ApplyExpr(lyr, ('a', 'b')))
     self.assertEqual(d.expr, result0)
     self.assertEqual(e.expr, result1)
Beispiel #2
0
 def test_tracer_apply(self):
     lyr = cb.Add()
     a = tracer.Tracer('a')
     b = tracer.Tracer('b')
     c = lyr @ (a, b)
     result = tracer.ApplyExpr(lyr, ('a', 'b'))
     self.assertEqual(c.expr, result)