Ejemplo n.º 1
0
 def testLeakyRelu(self):
     values = (numpy.array([-100., -10., 1., 0, 1., 10., 100.],
                           dtype=numpy.float32))
     tensor = tf.constant(values)
     out = self.Run(functions.leaky_relu(tensor))
     for i in range(len(values)):
         values[i] *= 0.01 if values[i] < 0 else 1
     testing.assert_allclose(out[0], values, rtol=TOLERANCE)
Ejemplo n.º 2
0
 def test_leaky_relu(self):
     values = (numpy.array([-100., -10., 1., 0, 1., 10., 100.],
                           dtype=numpy.float32))
     tensor = tf.constant(values)
     out = self.eval_tensor(functions.leaky_relu(tensor))
     for i, value in enumerate(values):
         if value < 0:
             values[i] *= 0.01
     testing.assert_allclose(out[0], values, rtol=TOLERANCE, atol=TOLERANCE)
Ejemplo n.º 3
0
 def testLeakyRelu(self):
   values = (
       numpy.array(
           [-100., -10., 1., 0, 1., 10., 100.],
           dtype=numpy.float32))
   tensor = tf.constant(values)
   out = self.Run(functions.leaky_relu(tensor))
   for i in range(len(values)):
     values[i] *= 0.01 if values[i] < 0 else 1
   testing.assert_allclose(out[0], values, rtol=TOLERANCE)
Ejemplo n.º 4
0
 def test_leaky_relu(self):
   values = (
       numpy.array(
           [-100., -10., 1., 0, 1., 10., 100.],
           dtype=numpy.float32))
   tensor = tf.constant(values)
   out = self.eval_tensor(functions.leaky_relu(tensor))
   for i, value in enumerate(values):
     if value < 0:
       values[i] *= 0.01
   testing.assert_allclose(out[0], values, rtol=TOLERANCE, atol=TOLERANCE)