We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Build fails because of optimizers
Some tests for optimizers fail because of this commit https://github.com/tensorflow/tensorflow/commit/2cb745ef1e0b4082a618c81274fca39be0cb4fc6. It can be fixed by replacing `self._get_hyper('epsilon')` with `self.epsilon` when trying to access the value of epsilon. For more details, please refer to https://github.com/tensorflow/tensorflow/commit/2cb745ef1e0b4082a618c81274fca39be0cb4fc6.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `tensorflow_addons/optimizers/lazy_adam.py`
Content:
```
1 # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 # ==============================================================================
15 """Variant of the Adam optimizer that handles sparse updates more efficiently.
16 
17 Compared with the original Adam optimizer, the one in this file can
18 provide a large improvement in model training throughput for some
19 applications. However, it provides slightly different semantics than the
20 original Adam algorithm, and may lead to different empirical results.
21 """
22 
23 from __future__ import absolute_import
24 from __future__ import division
25 from __future__ import print_function
26 
27 import tensorflow as tf
28 from tensorflow_addons.utils import keras_utils
29 
30 
31 @keras_utils.register_keras_custom_object
32 class LazyAdam(tf.keras.optimizers.Adam):
33     """Variant of the Adam optimizer that handles sparse updates more
34     efficiently.
35 
36     The original Adam algorithm maintains two moving-average accumulators for
37     each trainable variable; the accumulators are updated at every step.
38     This class provides lazier handling of gradient updates for sparse
39     variables.  It only updates moving-average accumulators for sparse variable
40     indices that appear in the current batch, rather than updating the
41     accumulators for all indices. Compared with the original Adam optimizer,
42     it can provide large improvements in model training throughput for some
43     applications. However, it provides slightly different semantics than the
44     original Adam algorithm, and may lead to different empirical results.
45 
46     Note, amsgrad is currently not supported and the argument can only be
47     False.
48     """
49 
50     def _resource_apply_sparse(self, grad, var, indices):
51         var_dtype = var.dtype.base_dtype
52         lr_t = self._decayed_lr(var_dtype)
53         beta_1_t = self._get_hyper('beta_1', var_dtype)
54         beta_2_t = self._get_hyper('beta_2', var_dtype)
55         local_step = tf.cast(self.iterations + 1, var_dtype)
56         beta_1_power = tf.math.pow(beta_1_t, local_step)
57         beta_2_power = tf.math.pow(beta_2_t, local_step)
58         epsilon_t = self._get_hyper('epsilon', var_dtype)
59         lr = (lr_t * tf.math.sqrt(1 - beta_2_power) / (1 - beta_1_power))
60 
61         # \\(m := beta1 * m + (1 - beta1) * g_t\\)
62         m = self.get_slot(var, "m")
63         m_t_slice = beta_1_t * tf.gather(m, indices) + (1 - beta_1_t) * grad
64 
65         m_update_kwargs = {
66             'resource': m.handle,
67             'indices': indices,
68             'updates': m_t_slice
69         }
70         m_update_op = tf.raw_ops.ResourceScatterUpdate(**m_update_kwargs)
71 
72         # \\(v := beta2 * v + (1 - beta2) * (g_t * g_t)\\)
73         v = self.get_slot(var, "v")
74         v_t_slice = (beta_2_t * tf.gather(v, indices) +
75                      (1 - beta_2_t) * tf.math.square(grad))
76 
77         v_update_kwargs = {
78             'resource': v.handle,
79             'indices': indices,
80             'updates': v_t_slice
81         }
82         v_update_op = tf.raw_ops.ResourceScatterUpdate(**v_update_kwargs)
83 
84         # \\(variable -= learning_rate * m_t / (epsilon_t + sqrt(v_t))\\)
85         var_slice = lr * m_t_slice / (tf.math.sqrt(v_t_slice) + epsilon_t)
86 
87         var_update_kwargs = {
88             'resource': var.handle,
89             'indices': indices,
90             'updates': var_slice
91         }
92         var_update_op = tf.raw_ops.ResourceScatterSub(**var_update_kwargs)
93 
94         return tf.group(*[var_update_op, m_update_op, v_update_op])
95
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/tensorflow_addons/optimizers/lazy_adam.py b/tensorflow_addons/optimizers/lazy_adam.py
--- a/tensorflow_addons/optimizers/lazy_adam.py
+++ b/tensorflow_addons/optimizers/lazy_adam.py
@@ -55,7 +55,7 @@
         local_step = tf.cast(self.iterations + 1, var_dtype)
         beta_1_power = tf.math.pow(beta_1_t, local_step)
         beta_2_power = tf.math.pow(beta_2_t, local_step)
-        epsilon_t = self._get_hyper('epsilon', var_dtype)
+        epsilon_t = tf.convert_to_tensor(self.epsilon, var_dtype)
         lr = (lr_t * tf.math.sqrt(1 - beta_2_power) / (1 - beta_1_power))
 
         # \\(m := beta1 * m + (1 - beta1) * g_t\\)

{"golden_diff": "diff --git a/tensorflow_addons/optimizers/lazy_adam.py b/tensorflow_addons/optimizers/lazy_adam.py\n--- a/tensorflow_addons/optimizers/lazy_adam.py\n+++ b/tensorflow_addons/optimizers/lazy_adam.py\n@@ -55,7 +55,7 @@\n         local_step = tf.cast(self.iterations + 1, var_dtype)\n         beta_1_power = tf.math.pow(beta_1_t, local_step)\n         beta_2_power = tf.math.pow(beta_2_t, local_step)\n-        epsilon_t = self._get_hyper('epsilon', var_dtype)\n+        epsilon_t = tf.convert_to_tensor(self.epsilon, var_dtype)\n         lr = (lr_t * tf.math.sqrt(1 - beta_2_power) / (1 - beta_1_power))\n \n         # \\\\(m := beta1 * m + (1 - beta1) * g_t\\\\)\n", "issue": "Build fails because of optimizers\nSome tests for optimizers fail because of this commit https://github.com/tensorflow/tensorflow/commit/2cb745ef1e0b4082a618c81274fca39be0cb4fc6. It can be fixed by replacing `self._get_hyper('epsilon')` with `self.epsilon` when trying to access the value of epsilon. For more details, please refer to https://github.com/tensorflow/tensorflow/commit/2cb745ef1e0b4082a618c81274fca39be0cb4fc6.\r\n\n", "before_files": [{"content": "# Copyright 2019 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ==============================================================================\n\"\"\"Variant of the Adam optimizer that handles sparse updates more efficiently.\n\nCompared with the original Adam optimizer, the one in this file can\nprovide a large improvement in model training throughput for some\napplications. However, it provides slightly different semantics than the\noriginal Adam algorithm, and may lead to different empirical results.\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport tensorflow as tf\nfrom tensorflow_addons.utils import keras_utils\n\n\n@keras_utils.register_keras_custom_object\nclass LazyAdam(tf.keras.optimizers.Adam):\n    \"\"\"Variant of the Adam optimizer that handles sparse updates more\n    efficiently.\n\n    The original Adam algorithm maintains two moving-average accumulators for\n    each trainable variable; the accumulators are updated at every step.\n    This class provides lazier handling of gradient updates for sparse\n    variables.  It only updates moving-average accumulators for sparse variable\n    indices that appear in the current batch, rather than updating the\n    accumulators for all indices. Compared with the original Adam optimizer,\n    it can provide large improvements in model training throughput for some\n    applications. However, it provides slightly different semantics than the\n    original Adam algorithm, and may lead to different empirical results.\n\n    Note, amsgrad is currently not supported and the argument can only be\n    False.\n    \"\"\"\n\n    def _resource_apply_sparse(self, grad, var, indices):\n        var_dtype = var.dtype.base_dtype\n        lr_t = self._decayed_lr(var_dtype)\n        beta_1_t = self._get_hyper('beta_1', var_dtype)\n        beta_2_t = self._get_hyper('beta_2', var_dtype)\n        local_step = tf.cast(self.iterations + 1, var_dtype)\n        beta_1_power = tf.math.pow(beta_1_t, local_step)\n        beta_2_power = tf.math.pow(beta_2_t, local_step)\n        epsilon_t = self._get_hyper('epsilon', var_dtype)\n        lr = (lr_t * tf.math.sqrt(1 - beta_2_power) / (1 - beta_1_power))\n\n        # \\\\(m := beta1 * m + (1 - beta1) * g_t\\\\)\n        m = self.get_slot(var, \"m\")\n        m_t_slice = beta_1_t * tf.gather(m, indices) + (1 - beta_1_t) * grad\n\n        m_update_kwargs = {\n            'resource': m.handle,\n            'indices': indices,\n            'updates': m_t_slice\n        }\n        m_update_op = tf.raw_ops.ResourceScatterUpdate(**m_update_kwargs)\n\n        # \\\\(v := beta2 * v + (1 - beta2) * (g_t * g_t)\\\\)\n        v = self.get_slot(var, \"v\")\n        v_t_slice = (beta_2_t * tf.gather(v, indices) +\n                     (1 - beta_2_t) * tf.math.square(grad))\n\n        v_update_kwargs = {\n            'resource': v.handle,\n            'indices': indices,\n            'updates': v_t_slice\n        }\n        v_update_op = tf.raw_ops.ResourceScatterUpdate(**v_update_kwargs)\n\n        # \\\\(variable -= learning_rate * m_t / (epsilon_t + sqrt(v_t))\\\\)\n        var_slice = lr * m_t_slice / (tf.math.sqrt(v_t_slice) + epsilon_t)\n\n        var_update_kwargs = {\n            'resource': var.handle,\n            'indices': indices,\n            'updates': var_slice\n        }\n        var_update_op = tf.raw_ops.ResourceScatterSub(**var_update_kwargs)\n\n        return tf.group(*[var_update_op, m_update_op, v_update_op])\n", "path": "tensorflow_addons/optimizers/lazy_adam.py"}], "after_files": [{"content": "# Copyright 2019 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ==============================================================================\n\"\"\"Variant of the Adam optimizer that handles sparse updates more efficiently.\n\nCompared with the original Adam optimizer, the one in this file can\nprovide a large improvement in model training throughput for some\napplications. However, it provides slightly different semantics than the\noriginal Adam algorithm, and may lead to different empirical results.\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport tensorflow as tf\nfrom tensorflow_addons.utils import keras_utils\n\n\n@keras_utils.register_keras_custom_object\nclass LazyAdam(tf.keras.optimizers.Adam):\n    \"\"\"Variant of the Adam optimizer that handles sparse updates more\n    efficiently.\n\n    The original Adam algorithm maintains two moving-average accumulators for\n    each trainable variable; the accumulators are updated at every step.\n    This class provides lazier handling of gradient updates for sparse\n    variables.  It only updates moving-average accumulators for sparse variable\n    indices that appear in the current batch, rather than updating the\n    accumulators for all indices. Compared with the original Adam optimizer,\n    it can provide large improvements in model training throughput for some\n    applications. However, it provides slightly different semantics than the\n    original Adam algorithm, and may lead to different empirical results.\n\n    Note, amsgrad is currently not supported and the argument can only be\n    False.\n    \"\"\"\n\n    def _resource_apply_sparse(self, grad, var, indices):\n        var_dtype = var.dtype.base_dtype\n        lr_t = self._decayed_lr(var_dtype)\n        beta_1_t = self._get_hyper('beta_1', var_dtype)\n        beta_2_t = self._get_hyper('beta_2', var_dtype)\n        local_step = tf.cast(self.iterations + 1, var_dtype)\n        beta_1_power = tf.math.pow(beta_1_t, local_step)\n        beta_2_power = tf.math.pow(beta_2_t, local_step)\n        epsilon_t = tf.convert_to_tensor(self.epsilon, var_dtype)\n        lr = (lr_t * tf.math.sqrt(1 - beta_2_power) / (1 - beta_1_power))\n\n        # \\\\(m := beta1 * m + (1 - beta1) * g_t\\\\)\n        m = self.get_slot(var, \"m\")\n        m_t_slice = beta_1_t * tf.gather(m, indices) + (1 - beta_1_t) * grad\n\n        m_update_kwargs = {\n            'resource': m.handle,\n            'indices': indices,\n            'updates': m_t_slice\n        }\n        m_update_op = tf.raw_ops.ResourceScatterUpdate(**m_update_kwargs)\n\n        # \\\\(v := beta2 * v + (1 - beta2) * (g_t * g_t)\\\\)\n        v = self.get_slot(var, \"v\")\n        v_t_slice = (beta_2_t * tf.gather(v, indices) +\n                     (1 - beta_2_t) * tf.math.square(grad))\n\n        v_update_kwargs = {\n            'resource': v.handle,\n            'indices': indices,\n            'updates': v_t_slice\n        }\n        v_update_op = tf.raw_ops.ResourceScatterUpdate(**v_update_kwargs)\n\n        # \\\\(variable -= learning_rate * m_t / (epsilon_t + sqrt(v_t))\\\\)\n        var_slice = lr * m_t_slice / (tf.math.sqrt(v_t_slice) + epsilon_t)\n\n        var_update_kwargs = {\n            'resource': var.handle,\n            'indices': indices,\n            'updates': var_slice\n        }\n        var_update_op = tf.raw_ops.ResourceScatterSub(**var_update_kwargs)\n\n        return tf.group(*[var_update_op, m_update_op, v_update_op])\n", "path": "tensorflow_addons/optimizers/lazy_adam.py"}]}