We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
tf.sign(0) = 0


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `xquant/quantizers.py`
Content:
```
1 import tensorflow as tf
2 from xquant import utils
3 
4 
5 @utils.register_keras_custom_object
6 @tf.custom_gradient
7 def ste_sign(x):
8     r"""
9     Sign binarization function.
10     \\[q(x) = \mathrm{Sign}(x)\\]
11 
12     The gradient is estimated using the Straight-Through Estimator.
13     \\[\frac{\partial q(x)}{\partial x} = x\\]
14 
15     # Arguments
16     x: Input tensor.
17 
18     # Returns
19     Binarized tensor.
20 
21     # References
22     - [Binarized Neural Networks: Training Deep Neural Networks with Weights and
23       Activations Constrained to +1 or -1](http://arxiv.org/abs/1602.02830)
24     """
25 
26     def grad(dy):
27         return dy
28 
29     return tf.sign(x), grad
30 
31 
32 @utils.register_keras_custom_object
33 @tf.custom_gradient
34 def approx_sign(x):
35     r"""
36     Sign binarization function.
37     \\[q(x) = \mathrm{Sign}(x)\\]
38 
39     The gradient is estimated using the ApproxSign method.
40     \\[\frac{\partial q(x)}{\partial x} = (2 - 2 \left|x\right|))\\]
41 
42     # Arguments
43     x: Input tensor.
44 
45     # Returns
46     Binarized tensor.
47 
48     # References
49     - [Bi-Real Net: Enhancing the Performance of 1-bit CNNs With Improved
50       Representational Capability and Advanced
51       Training Algorithm](http://arxiv.org/abs/1808.00278)
52     """
53 
54     def grad(dy):
55         return (1 - tf.abs(x)) * 2 * dy
56 
57     return tf.sign(x), grad
58 
59 
60 def serialize(initializer):
61     return tf.keras.utils.serialize_keras_object(initializer)
62 
63 
64 def deserialize(name, custom_objects=None):
65     return tf.keras.utils.deserialize_keras_object(
66         name,
67         module_objects=globals(),
68         custom_objects=custom_objects,
69         printable_module_name="quantization function",
70     )
71 
72 
73 def get(identifier):
74     if identifier is None:
75         return None
76     if isinstance(identifier, str):
77         return deserialize(str(identifier))
78     if callable(identifier):
79         return identifier
80     raise ValueError(
81         "Could not interpret quantization function identifier:", identifier
82     )
83
```
--- 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/xquant/quantizers.py b/xquant/quantizers.py
--- a/xquant/quantizers.py
+++ b/xquant/quantizers.py
@@ -2,12 +2,22 @@
 from xquant import utils
 
 
+def sign(x):
+    """A sign function that will never be zero"""
+    return tf.sign(tf.sign(x) + 1e-10)
+
+
 @utils.register_keras_custom_object
 @tf.custom_gradient
 def ste_sign(x):
     r"""
     Sign binarization function.
-    \\[q(x) = \mathrm{Sign}(x)\\]
+    \\[
+    q(x) = \begin{cases}
+      -1 & x < 0 \\\
+      1 & x \geq 0
+   \end{cases}
+   \\]
 
     The gradient is estimated using the Straight-Through Estimator.
     \\[\frac{\partial q(x)}{\partial x} = x\\]
@@ -26,7 +36,7 @@
     def grad(dy):
         return dy
 
-    return tf.sign(x), grad
+    return sign(x), grad
 
 
 @utils.register_keras_custom_object
@@ -34,7 +44,12 @@
 def approx_sign(x):
     r"""
     Sign binarization function.
-    \\[q(x) = \mathrm{Sign}(x)\\]
+    \\[
+    q(x) = \begin{cases}
+      -1 & x < 0 \\\
+      1 & x \geq 0
+   \end{cases}
+   \\]
 
     The gradient is estimated using the ApproxSign method.
     \\[\frac{\partial q(x)}{\partial x} = (2 - 2 \left|x\right|))\\]
@@ -54,7 +69,7 @@
     def grad(dy):
         return (1 - tf.abs(x)) * 2 * dy
 
-    return tf.sign(x), grad
+    return sign(x), grad
 
 
 def serialize(initializer):

{"golden_diff": "diff --git a/xquant/quantizers.py b/xquant/quantizers.py\n--- a/xquant/quantizers.py\n+++ b/xquant/quantizers.py\n@@ -2,12 +2,22 @@\n from xquant import utils\n \n \n+def sign(x):\n+    \"\"\"A sign function that will never be zero\"\"\"\n+    return tf.sign(tf.sign(x) + 1e-10)\n+\n+\n @utils.register_keras_custom_object\n @tf.custom_gradient\n def ste_sign(x):\n     r\"\"\"\n     Sign binarization function.\n-    \\\\[q(x) = \\mathrm{Sign}(x)\\\\]\n+    \\\\[\n+    q(x) = \\begin{cases}\n+      -1 & x < 0 \\\\\\\n+      1 & x \\geq 0\n+   \\end{cases}\n+   \\\\]\n \n     The gradient is estimated using the Straight-Through Estimator.\n     \\\\[\\frac{\\partial q(x)}{\\partial x} = x\\\\]\n@@ -26,7 +36,7 @@\n     def grad(dy):\n         return dy\n \n-    return tf.sign(x), grad\n+    return sign(x), grad\n \n \n @utils.register_keras_custom_object\n@@ -34,7 +44,12 @@\n def approx_sign(x):\n     r\"\"\"\n     Sign binarization function.\n-    \\\\[q(x) = \\mathrm{Sign}(x)\\\\]\n+    \\\\[\n+    q(x) = \\begin{cases}\n+      -1 & x < 0 \\\\\\\n+      1 & x \\geq 0\n+   \\end{cases}\n+   \\\\]\n \n     The gradient is estimated using the ApproxSign method.\n     \\\\[\\frac{\\partial q(x)}{\\partial x} = (2 - 2 \\left|x\\right|))\\\\]\n@@ -54,7 +69,7 @@\n     def grad(dy):\n         return (1 - tf.abs(x)) * 2 * dy\n \n-    return tf.sign(x), grad\n+    return sign(x), grad\n \n \n def serialize(initializer):\n", "issue": "tf.sign(0) = 0\n\n", "before_files": [{"content": "import tensorflow as tf\nfrom xquant import utils\n\n\n@utils.register_keras_custom_object\n@tf.custom_gradient\ndef ste_sign(x):\n    r\"\"\"\n    Sign binarization function.\n    \\\\[q(x) = \\mathrm{Sign}(x)\\\\]\n\n    The gradient is estimated using the Straight-Through Estimator.\n    \\\\[\\frac{\\partial q(x)}{\\partial x} = x\\\\]\n\n    # Arguments\n    x: Input tensor.\n\n    # Returns\n    Binarized tensor.\n\n    # References\n    - [Binarized Neural Networks: Training Deep Neural Networks with Weights and\n      Activations Constrained to +1 or -1](http://arxiv.org/abs/1602.02830)\n    \"\"\"\n\n    def grad(dy):\n        return dy\n\n    return tf.sign(x), grad\n\n\n@utils.register_keras_custom_object\n@tf.custom_gradient\ndef approx_sign(x):\n    r\"\"\"\n    Sign binarization function.\n    \\\\[q(x) = \\mathrm{Sign}(x)\\\\]\n\n    The gradient is estimated using the ApproxSign method.\n    \\\\[\\frac{\\partial q(x)}{\\partial x} = (2 - 2 \\left|x\\right|))\\\\]\n\n    # Arguments\n    x: Input tensor.\n\n    # Returns\n    Binarized tensor.\n\n    # References\n    - [Bi-Real Net: Enhancing the Performance of 1-bit CNNs With Improved\n      Representational Capability and Advanced\n      Training Algorithm](http://arxiv.org/abs/1808.00278)\n    \"\"\"\n\n    def grad(dy):\n        return (1 - tf.abs(x)) * 2 * dy\n\n    return tf.sign(x), grad\n\n\ndef serialize(initializer):\n    return tf.keras.utils.serialize_keras_object(initializer)\n\n\ndef deserialize(name, custom_objects=None):\n    return tf.keras.utils.deserialize_keras_object(\n        name,\n        module_objects=globals(),\n        custom_objects=custom_objects,\n        printable_module_name=\"quantization function\",\n    )\n\n\ndef get(identifier):\n    if identifier is None:\n        return None\n    if isinstance(identifier, str):\n        return deserialize(str(identifier))\n    if callable(identifier):\n        return identifier\n    raise ValueError(\n        \"Could not interpret quantization function identifier:\", identifier\n    )\n", "path": "xquant/quantizers.py"}], "after_files": [{"content": "import tensorflow as tf\nfrom xquant import utils\n\n\ndef sign(x):\n    \"\"\"A sign function that will never be zero\"\"\"\n    return tf.sign(tf.sign(x) + 1e-10)\n\n\n@utils.register_keras_custom_object\n@tf.custom_gradient\ndef ste_sign(x):\n    r\"\"\"\n    Sign binarization function.\n    \\\\[\n    q(x) = \\begin{cases}\n      -1 & x < 0 \\\\\\\n      1 & x \\geq 0\n   \\end{cases}\n   \\\\]\n\n    The gradient is estimated using the Straight-Through Estimator.\n    \\\\[\\frac{\\partial q(x)}{\\partial x} = x\\\\]\n\n    # Arguments\n    x: Input tensor.\n\n    # Returns\n    Binarized tensor.\n\n    # References\n    - [Binarized Neural Networks: Training Deep Neural Networks with Weights and\n      Activations Constrained to +1 or -1](http://arxiv.org/abs/1602.02830)\n    \"\"\"\n\n    def grad(dy):\n        return dy\n\n    return sign(x), grad\n\n\n@utils.register_keras_custom_object\n@tf.custom_gradient\ndef approx_sign(x):\n    r\"\"\"\n    Sign binarization function.\n    \\\\[\n    q(x) = \\begin{cases}\n      -1 & x < 0 \\\\\\\n      1 & x \\geq 0\n   \\end{cases}\n   \\\\]\n\n    The gradient is estimated using the ApproxSign method.\n    \\\\[\\frac{\\partial q(x)}{\\partial x} = (2 - 2 \\left|x\\right|))\\\\]\n\n    # Arguments\n    x: Input tensor.\n\n    # Returns\n    Binarized tensor.\n\n    # References\n    - [Bi-Real Net: Enhancing the Performance of 1-bit CNNs With Improved\n      Representational Capability and Advanced\n      Training Algorithm](http://arxiv.org/abs/1808.00278)\n    \"\"\"\n\n    def grad(dy):\n        return (1 - tf.abs(x)) * 2 * dy\n\n    return sign(x), grad\n\n\ndef serialize(initializer):\n    return tf.keras.utils.serialize_keras_object(initializer)\n\n\ndef deserialize(name, custom_objects=None):\n    return tf.keras.utils.deserialize_keras_object(\n        name,\n        module_objects=globals(),\n        custom_objects=custom_objects,\n        printable_module_name=\"quantization function\",\n    )\n\n\ndef get(identifier):\n    if identifier is None:\n        return None\n    if isinstance(identifier, str):\n        return deserialize(str(identifier))\n    if callable(identifier):\n        return identifier\n    raise ValueError(\n        \"Could not interpret quantization function identifier:\", identifier\n    )\n", "path": "xquant/quantizers.py"}]}