prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Segmentation fault when using tfa.rotate in tf-nightly
  **System information**
  - OS Platform: Linux Ubuntu 18.04.3 LTS
  - TensorFlow version: tf-nightly (2.2.0-dev20200310) installed with pip
  - TensorFlow-Addons version: 0.8.3 (pip) and tfa-nightly (0.9.0-dev; pip)
  - Python version: 3.6.9
  - Is GPU used?: yes
  
  **Describe the bug**
  I currently have to use tf-nightly because of a separate issue. When I use tfa.rotate I get a segmentation fault. Behavior is the same with tfa 0.8.3 and tfa-nightly.
  
  **Code to reproduce the issue**
  ```
  import tensorflow as tf
  import tensorflow_addons as tfa
  
  img = tf.io.read_file(IMG_PATH)
  img = tf.image.decode_png(img)
  print(img.shape)
  img = tfa.image.rotate(img, 90)
  ```
  Output:     
  > (128, 128, 3)
  > Segmentation fault (core dumped)
  
  I also tried `interpolation="BILINEAR"`. Problem is the same. 
  
  </issue>
  <code>
  [start of tensorflow_addons/utils/ensure_tf_install.py]
  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 
  16 
  17 # Ensure TensorFlow is importable and its version is sufficiently recent. This
  18 # needs to happen before anything else, since the imports below will try to
  19 # import tensorflow, too.
  20 def _ensure_tf_install():
  21     """Attempt to import tensorflow, and ensure its version is sufficient.
  22     Raises:
  23       ImportError: if either tensorflow is not importable or its version is
  24       inadequate.
  25     """
  26     import tensorflow as tf
  27     import distutils.version
  28 
  29     #
  30     # Update this whenever we need to depend on a newer TensorFlow release.
  31     #
  32     required_tensorflow_version = "2.1.0"
  33 
  34     if distutils.version.LooseVersion(tf.__version__) < distutils.version.LooseVersion(
  35         required_tensorflow_version
  36     ):
  37         raise ImportError(
  38             "This version of TensorFlow Addons requires TensorFlow "
  39             "version >= {required}; Detected an installation of version "
  40             "{present}. Please upgrade TensorFlow to proceed.".format(
  41                 required=required_tensorflow_version, present=tf.__version__
  42             )
  43         )
  44
  [end of tensorflow_addons/utils/ensure_tf_install.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/tensorflow_addons/utils/ensure_tf_install.py b/tensorflow_addons/utils/ensure_tf_install.py
  --- a/tensorflow_addons/utils/ensure_tf_install.py
  +++ b/tensorflow_addons/utils/ensure_tf_install.py
  @@ -17,27 +17,40 @@
   # Ensure TensorFlow is importable and its version is sufficiently recent. This
   # needs to happen before anything else, since the imports below will try to
   # import tensorflow, too.
  +
  +from distutils.version import LooseVersion
  +import warnings
  +
  +import tensorflow as tf
  +
  +
  +warning_template = """
  +This version of TensorFlow Addons requires TensorFlow {required}.
  +Detected an installation of version {present}.
  +
  +While some functions might work, TensorFlow Addons was not tested
  +with this TensorFlow version. Also custom ops were not compiled
  +against this version of TensorFlow. If you use custom ops,
  +you might get errors (segmentation faults for example).
  +
  +It might help you to fallback to pure Python ops with
  +TF_ADDONS_PY_OPS . To do that, see
  +https://github.com/tensorflow/addons#gpucpu-custom-ops
  +
  +If you encounter errors, do *not* file bugs in GitHub because
  +the version of TensorFlow you are using is not supported.
  +"""
  +
  +
   def _ensure_tf_install():
  -    """Attempt to import tensorflow, and ensure its version is sufficient.
  -    Raises:
  -      ImportError: if either tensorflow is not importable or its version is
  -      inadequate.
  +    """Warn the user if the version of TensorFlow used is not supported.
       """
  -    import tensorflow as tf
  -    import distutils.version
   
  -    #
       # Update this whenever we need to depend on a newer TensorFlow release.
  -    #
  -    required_tensorflow_version = "2.1.0"
  -
  -    if distutils.version.LooseVersion(tf.__version__) < distutils.version.LooseVersion(
  -        required_tensorflow_version
  -    ):
  -        raise ImportError(
  -            "This version of TensorFlow Addons requires TensorFlow "
  -            "version >= {required}; Detected an installation of version "
  -            "{present}. Please upgrade TensorFlow to proceed.".format(
  -                required=required_tensorflow_version, present=tf.__version__
  -            )
  +    required_tf_version = "2.1.0"
  +
  +    if LooseVersion(tf.__version__) != LooseVersion(required_tf_version):
  +        message = warning_template.format(
  +            required=required_tf_version, present=tf.__version__
           )
  +        warnings.warn(message, UserWarning)
  
verification_info: {"golden_diff": "diff --git a/tensorflow_addons/utils/ensure_tf_install.py b/tensorflow_addons/utils/ensure_tf_install.py\n--- a/tensorflow_addons/utils/ensure_tf_install.py\n+++ b/tensorflow_addons/utils/ensure_tf_install.py\n@@ -17,27 +17,40 @@\n # Ensure TensorFlow is importable and its version is sufficiently recent. This\n # needs to happen before anything else, since the imports below will try to\n # import tensorflow, too.\n+\n+from distutils.version import LooseVersion\n+import warnings\n+\n+import tensorflow as tf\n+\n+\n+warning_template = \"\"\"\n+This version of TensorFlow Addons requires TensorFlow {required}.\n+Detected an installation of version {present}.\n+\n+While some functions might work, TensorFlow Addons was not tested\n+with this TensorFlow version. Also custom ops were not compiled\n+against this version of TensorFlow. If you use custom ops,\n+you might get errors (segmentation faults for example).\n+\n+It might help you to fallback to pure Python ops with\n+TF_ADDONS_PY_OPS . To do that, see\n+https://github.com/tensorflow/addons#gpucpu-custom-ops\n+\n+If you encounter errors, do *not* file bugs in GitHub because\n+the version of TensorFlow you are using is not supported.\n+\"\"\"\n+\n+\n def _ensure_tf_install():\n-    \"\"\"Attempt to import tensorflow, and ensure its version is sufficient.\n-    Raises:\n-      ImportError: if either tensorflow is not importable or its version is\n-      inadequate.\n+    \"\"\"Warn the user if the version of TensorFlow used is not supported.\n     \"\"\"\n-    import tensorflow as tf\n-    import distutils.version\n \n-    #\n     # Update this whenever we need to depend on a newer TensorFlow release.\n-    #\n-    required_tensorflow_version = \"2.1.0\"\n-\n-    if distutils.version.LooseVersion(tf.__version__) < distutils.version.LooseVersion(\n-        required_tensorflow_version\n-    ):\n-        raise ImportError(\n-            \"This version of TensorFlow Addons requires TensorFlow \"\n-            \"version >= {required}; Detected an installation of version \"\n-            \"{present}. Please upgrade TensorFlow to proceed.\".format(\n-                required=required_tensorflow_version, present=tf.__version__\n-            )\n+    required_tf_version = \"2.1.0\"\n+\n+    if LooseVersion(tf.__version__) != LooseVersion(required_tf_version):\n+        message = warning_template.format(\n+            required=required_tf_version, present=tf.__version__\n         )\n+        warnings.warn(message, UserWarning)\n", "issue": "Segmentation fault when using tfa.rotate in tf-nightly\n**System information**\r\n- OS Platform: Linux Ubuntu 18.04.3 LTS\r\n- TensorFlow version: tf-nightly (2.2.0-dev20200310) installed with pip\r\n- TensorFlow-Addons version: 0.8.3 (pip) and tfa-nightly (0.9.0-dev; pip)\r\n- Python version: 3.6.9\r\n- Is GPU used?: yes\r\n\r\n**Describe the bug**\r\nI currently have to use tf-nightly because of a separate issue. When I use tfa.rotate I get a segmentation fault. Behavior is the same with tfa 0.8.3 and tfa-nightly.\r\n\r\n**Code to reproduce the issue**\r\n```\r\nimport tensorflow as tf\r\nimport tensorflow_addons as tfa\r\n\r\nimg = tf.io.read_file(IMG_PATH)\r\nimg = tf.image.decode_png(img)\r\nprint(img.shape)\r\nimg = tfa.image.rotate(img, 90)\r\n```\r\nOutput:     \r\n> (128, 128, 3)\r\n> Segmentation fault (core dumped)\r\n\r\nI also tried `interpolation=\"BILINEAR\"`. Problem is the same. \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\n\n# Ensure TensorFlow is importable and its version is sufficiently recent. This\n# needs to happen before anything else, since the imports below will try to\n# import tensorflow, too.\ndef _ensure_tf_install():\n    \"\"\"Attempt to import tensorflow, and ensure its version is sufficient.\n    Raises:\n      ImportError: if either tensorflow is not importable or its version is\n      inadequate.\n    \"\"\"\n    import tensorflow as tf\n    import distutils.version\n\n    #\n    # Update this whenever we need to depend on a newer TensorFlow release.\n    #\n    required_tensorflow_version = \"2.1.0\"\n\n    if distutils.version.LooseVersion(tf.__version__) < distutils.version.LooseVersion(\n        required_tensorflow_version\n    ):\n        raise ImportError(\n            \"This version of TensorFlow Addons requires TensorFlow \"\n            \"version >= {required}; Detected an installation of version \"\n            \"{present}. Please upgrade TensorFlow to proceed.\".format(\n                required=required_tensorflow_version, present=tf.__version__\n            )\n        )\n", "path": "tensorflow_addons/utils/ensure_tf_install.py"}]}