prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  problem with K.common._FLOATX
  I tried to run:
  
  ```
  a = K.random_normal((100, 200))
  ```
  
  and I got the error:
  
  ```
  /home/eders/python/Theano/theano/sandbox/rng_mrg.pyc in get_substream_rstates(self, n_streams, dtype, inc_rstate)
     1167 
     1168         """
  -> 1169         assert isinstance(dtype, str)
     1170         assert n_streams < 2**72
     1171         assert n_streams > 0
  
  AssertionError:
  ```
  
  I tried to print K.common._FLOATX to see what was going on and it is `u'float32'`. That little `u` upfront is making theano crash. I believe that when reading the type from json it was not converted to the right type of string. Anybody else had that problem? I'll check the code to see if I can fix it.
  
  
  </issue>
  <code>
  [start of keras/backend/common.py]
  1 import numpy as np
  2 
  3 # the type of float to use throughout the session.
  4 _FLOATX = 'float32'
  5 _EPSILON = 10e-8
  6 
  7 
  8 def epsilon():
  9     return _EPSILON
  10 
  11 
  12 def set_epsilon(e):
  13     global _EPSILON
  14     _EPSILON = e
  15 
  16 
  17 def floatx():
  18     return _FLOATX
  19 
  20 
  21 def set_floatx(floatx):
  22     global _FLOATX
  23     if floatx not in {'float32', 'float64'}:
  24         raise Exception('Unknown floatx type: ' + str(floatx))
  25     _FLOATX = floatx
  26 
  27 
  28 def cast_to_floatx(x):
  29     '''Cast a Numpy array to floatx.
  30     '''
  31     return np.asarray(x, dtype=_FLOATX)
  32
  [end of keras/backend/common.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/keras/backend/common.py b/keras/backend/common.py
  --- a/keras/backend/common.py
  +++ b/keras/backend/common.py
  @@ -22,6 +22,8 @@
       global _FLOATX
       if floatx not in {'float32', 'float64'}:
           raise Exception('Unknown floatx type: ' + str(floatx))
  +    if isinstance(floatx, unicode):
  +        floatx = floatx.encode('ascii')
       _FLOATX = floatx
  
verification_info: {"golden_diff": "diff --git a/keras/backend/common.py b/keras/backend/common.py\n--- a/keras/backend/common.py\n+++ b/keras/backend/common.py\n@@ -22,6 +22,8 @@\n     global _FLOATX\n     if floatx not in {'float32', 'float64'}:\n         raise Exception('Unknown floatx type: ' + str(floatx))\n+    if isinstance(floatx, unicode):\n+        floatx = floatx.encode('ascii')\n     _FLOATX = floatx\n", "issue": "problem with K.common._FLOATX\nI tried to run:\n\n```\na = K.random_normal((100, 200))\n```\n\nand I got the error:\n\n```\n/home/eders/python/Theano/theano/sandbox/rng_mrg.pyc in get_substream_rstates(self, n_streams, dtype, inc_rstate)\n   1167 \n   1168         \"\"\"\n-> 1169         assert isinstance(dtype, str)\n   1170         assert n_streams < 2**72\n   1171         assert n_streams > 0\n\nAssertionError:\n```\n\nI tried to print K.common._FLOATX to see what was going on and it is `u'float32'`. That little `u` upfront is making theano crash. I believe that when reading the type from json it was not converted to the right type of string. Anybody else had that problem? I'll check the code to see if I can fix it.\n\n", "before_files": [{"content": "import numpy as np\n\n# the type of float to use throughout the session.\n_FLOATX = 'float32'\n_EPSILON = 10e-8\n\n\ndef epsilon():\n    return _EPSILON\n\n\ndef set_epsilon(e):\n    global _EPSILON\n    _EPSILON = e\n\n\ndef floatx():\n    return _FLOATX\n\n\ndef set_floatx(floatx):\n    global _FLOATX\n    if floatx not in {'float32', 'float64'}:\n        raise Exception('Unknown floatx type: ' + str(floatx))\n    _FLOATX = floatx\n\n\ndef cast_to_floatx(x):\n    '''Cast a Numpy array to floatx.\n    '''\n    return np.asarray(x, dtype=_FLOATX)\n", "path": "keras/backend/common.py"}]}