Esempio n. 1
0
    def test_builder_eval(self):
        x_val = np.array([[-1, 2, -3], [4, -5, 6]], dtype=np.float32)
        v = mb.clamped_relu(x=x_val, alpha=2.0, beta=1.0)

        x = np.minimum(np.maximum(x_val, 0), 1.0)
        y = np.minimum(np.minimum(x_val, 0) * 2.0, 1.0)
        np.testing.assert_allclose(x + y, v.val, atol=1e-04, rtol=1e-05)
Esempio n. 2
0
 def build(x):
     return [mb.clamped_relu(x=x, alpha=alpha, beta=beta)]
Esempio n. 3
0
 def build(x):
     return mb.clamped_relu(x=x, alpha=2.0, beta=1.0)