prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Emit warning if compiled in Debug mode
  In debug mode ChainerX runs significantly slower.
  However sometimes it's difficult notice that.
  
  </issue>
  <code>
  [start of chainerx/__init__.py]
  1 import os
  2 import sys
  3 
  4 
  5 if sys.version_info[0] < 3:
  6     _available = False
  7 else:
  8     try:
  9         from chainerx import _core
  10         _available = True
  11     except Exception:
  12         _available = False
  13 
  14 
  15 if _available:
  16     from numpy import dtype  # NOQA
  17     from numpy import (
  18         bool_, int8, int16, int32, int64, uint8, float16, float32, float64)  # NOQA
  19     all_dtypes = (
  20         bool_, int8, int16, int32, int64, uint8, float16, float32, float64)
  21 
  22     from chainerx._core import *  # NOQA
  23     from chainerx._core import _to_cupy  # NOQA
  24 
  25     from builtins import bool, int, float  # NOQA
  26 
  27     from chainerx import _device  # NOQA
  28 
  29     from chainerx.creation.from_data import asanyarray  # NOQA
  30     from chainerx.creation.from_data import fromfile  # NOQA
  31     from chainerx.creation.from_data import fromfunction  # NOQA
  32     from chainerx.creation.from_data import fromiter  # NOQA
  33     from chainerx.creation.from_data import fromstring  # NOQA
  34     from chainerx.creation.from_data import loadtxt  # NOQA
  35 
  36     from chainerx.manipulation.shape import ravel  # NOQA
  37 
  38     from chainerx.math.misc import clip  # NOQA
  39 
  40     from chainerx import random  # NOQA
  41 
  42     _global_context = _core.Context()
  43     _core.set_global_default_context(_global_context)
  44 
  45     # Implements ndarray methods in Python
  46     from chainerx import _ndarray
  47     _ndarray.populate()
  48 
  49     # Temporary workaround implementations that fall back to NumPy/CuPy's
  50     # respective functions.
  51     from chainerx import _fallback_workarounds
  52     _fallback_workarounds.populate()
  53 
  54     # Dynamically inject docstrings
  55     from chainerx import _docs
  56     _docs.set_docs()
  57 
  58     from chainerx import _cuda
  59     # Share memory pool with CuPy.
  60     if bool(int(os.getenv('CHAINERX_CUDA_CUPY_SHARE_ALLOCATOR', '0'))):
  61         _cuda.cupy_share_allocator()
  62 else:
  63     class ndarray(object):
  64 
  65         """Dummy class for type testing."""
  66 
  67         def __init__(self, *args, **kwargs):
  68             raise RuntimeError('chainerx is not available.')
  69 
  70 
  71 def is_available():
  72     return _available
  73
  [end of chainerx/__init__.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/chainerx/__init__.py b/chainerx/__init__.py
  --- a/chainerx/__init__.py
  +++ b/chainerx/__init__.py
  @@ -1,5 +1,6 @@
   import os
   import sys
  +import warnings
   
   
   if sys.version_info[0] < 3:
  @@ -70,3 +71,9 @@
   
   def is_available():
       return _available
  +
  +
  +if _available and _core._is_debug():
  +    # Warn if the ChainerX core binary is built in debug mode
  +    warnings.warn(
  +        'ChainerX core binary is built in debug mode.', stacklevel=2)
  
verification_info: {"golden_diff": "diff --git a/chainerx/__init__.py b/chainerx/__init__.py\n--- a/chainerx/__init__.py\n+++ b/chainerx/__init__.py\n@@ -1,5 +1,6 @@\n import os\n import sys\n+import warnings\n \n \n if sys.version_info[0] < 3:\n@@ -70,3 +71,9 @@\n \n def is_available():\n     return _available\n+\n+\n+if _available and _core._is_debug():\n+    # Warn if the ChainerX core binary is built in debug mode\n+    warnings.warn(\n+        'ChainerX core binary is built in debug mode.', stacklevel=2)\n", "issue": "Emit warning if compiled in Debug mode\nIn debug mode ChainerX runs significantly slower.\r\nHowever sometimes it's difficult notice that.\n", "before_files": [{"content": "import os\nimport sys\n\n\nif sys.version_info[0] < 3:\n    _available = False\nelse:\n    try:\n        from chainerx import _core\n        _available = True\n    except Exception:\n        _available = False\n\n\nif _available:\n    from numpy import dtype  # NOQA\n    from numpy import (\n        bool_, int8, int16, int32, int64, uint8, float16, float32, float64)  # NOQA\n    all_dtypes = (\n        bool_, int8, int16, int32, int64, uint8, float16, float32, float64)\n\n    from chainerx._core import *  # NOQA\n    from chainerx._core import _to_cupy  # NOQA\n\n    from builtins import bool, int, float  # NOQA\n\n    from chainerx import _device  # NOQA\n\n    from chainerx.creation.from_data import asanyarray  # NOQA\n    from chainerx.creation.from_data import fromfile  # NOQA\n    from chainerx.creation.from_data import fromfunction  # NOQA\n    from chainerx.creation.from_data import fromiter  # NOQA\n    from chainerx.creation.from_data import fromstring  # NOQA\n    from chainerx.creation.from_data import loadtxt  # NOQA\n\n    from chainerx.manipulation.shape import ravel  # NOQA\n\n    from chainerx.math.misc import clip  # NOQA\n\n    from chainerx import random  # NOQA\n\n    _global_context = _core.Context()\n    _core.set_global_default_context(_global_context)\n\n    # Implements ndarray methods in Python\n    from chainerx import _ndarray\n    _ndarray.populate()\n\n    # Temporary workaround implementations that fall back to NumPy/CuPy's\n    # respective functions.\n    from chainerx import _fallback_workarounds\n    _fallback_workarounds.populate()\n\n    # Dynamically inject docstrings\n    from chainerx import _docs\n    _docs.set_docs()\n\n    from chainerx import _cuda\n    # Share memory pool with CuPy.\n    if bool(int(os.getenv('CHAINERX_CUDA_CUPY_SHARE_ALLOCATOR', '0'))):\n        _cuda.cupy_share_allocator()\nelse:\n    class ndarray(object):\n\n        \"\"\"Dummy class for type testing.\"\"\"\n\n        def __init__(self, *args, **kwargs):\n            raise RuntimeError('chainerx is not available.')\n\n\ndef is_available():\n    return _available\n", "path": "chainerx/__init__.py"}]}