We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `keras/backend/common.py`
Content:
```
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 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/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

{"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"}], "after_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    if isinstance(floatx, unicode):\n        floatx = floatx.encode('ascii')\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"}]}