prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN 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. 
  
  --- 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/utils/ensure_tf_install.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 
  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 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()
  
  ```
  
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"}], "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\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.\n\nfrom distutils.version import LooseVersion\nimport warnings\n\nimport tensorflow as tf\n\n\nwarning_template = \"\"\"\nThis version of TensorFlow Addons requires TensorFlow {required}.\nDetected an installation of version {present}.\n\nWhile some functions might work, TensorFlow Addons was not tested\nwith this TensorFlow version. Also custom ops were not compiled\nagainst this version of TensorFlow. If you use custom ops,\nyou might get errors (segmentation faults for example).\n\nIt might help you to fallback to pure Python ops with\nTF_ADDONS_PY_OPS . To do that, see\nhttps://github.com/tensorflow/addons#gpucpu-custom-ops\n\nIf you encounter errors, do *not* file bugs in GitHub because\nthe version of TensorFlow you are using is not supported.\n\"\"\"\n\n\ndef _ensure_tf_install():\n    \"\"\"Warn the user if the version of TensorFlow used is not supported.\n    \"\"\"\n\n    # Update this whenever we need to depend on a newer TensorFlow release.\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", "path": "tensorflow_addons/utils/ensure_tf_install.py"}]}