コード例 #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)
コード例 #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)
コード例 #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)
コード例 #4
0
ファイル: functions_test.py プロジェクト: google/prettytensor
 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)