Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rrelu kernel #573

Merged
merged 14 commits into from
Oct 25, 2019
10 changes: 9 additions & 1 deletion tensorflow_addons/activations/rrelu_test.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ def test_theoretical_gradients(self, dtype):
for training in [True, False]:
with self.subTest(training=training):
theoretical, numerical = tf.test.compute_gradient(
lambda x: rrelu(x, lower, upper, training=training), [x])
lambda x: rrelu(
x, lower, upper, training=training, seed=111111), [x])
if training is True and tf.test.is_gpu_available() is False:
fsx950223 marked this conversation as resolved.
Show resolved Hide resolved
numerical = [[[0.134971, 0., 0., 0., 0., 0.],
[0., 0.15648358, 0., 0., 0., 0.],
[0., 0., 0.18776372, 0., 0., 0.],
[0., 0., 0., 1., 0., 0.],
[0., 0., 0., 0., 1., 0.],
[0., 0., 0., 0., 0., 1.]]]
self.assertAllCloseAccordingToType(
theoretical, numerical, rtol=5e-4, atol=5e-4)

Expand Down