prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Syft Keras bug on Windows
  Relevant slack discussion: https://openmined.slack.com/archives/C6DEWA4FR/p1559899875021800
  
  Bug:
  ![image](https://user-images.githubusercontent.com/7891333/59118559-79fa9400-891e-11e9-990e-1bba1fe9ec93.png)
  
  It looks like the problem here is that the `tfe.config` is being saved in a location that is not a valid filepath in Windows.  As a result, there is likely a file with the name `/tmp/tfe.config` being saved in some folder on the machine, as opposed to a file with the name `tfe.config` being saved in the root subdirectory called `tmp`.
  
  The fix for this should use `os.path` to figure out which filepath the tfe.config should be saved to, and then the logging messages should print the OS-specific CLI command for launching each `TFEWorker` process.
  
  </issue>
  <code>
  [start of syft/workers/tfe.py]
  1 """To be extended in the near future."""
  2 from collections import OrderedDict
  3 import logging
  4 import subprocess
  5 
  6 import tf_encrypted as tfe
  7 
  8 
  9 logger = logging.getLogger("tf_encrypted")
  10 
  11 
  12 class TFEWorker:
  13     # TODO(Morten) this should be turned into a proxy, with existing code
  14     # extracted into a new component that's launched via a script
  15 
  16     def __init__(self, host=None, auto_managed=True):
  17         self.host = host
  18         self._server_process = None
  19         self._auto_managed = auto_managed
  20 
  21     def start(self, player_name, *workers):
  22         if self.host is None:
  23             # we're running using a tfe.LocalConfig which doesn't require us to do anything
  24             return
  25 
  26         config_filename = "/tmp/tfe.config"
  27 
  28         config, _ = self.config_from_workers(workers)
  29         config.save(config_filename)
  30 
  31         if self._auto_managed:
  32             cmd = "python -m tf_encrypted.player --config {} {}".format(
  33                 config_filename, player_name
  34             )
  35             self._server_process = subprocess.Popen(cmd.split(" "))
  36         else:
  37             logger.info(
  38                 "If not done already, please launch the following "
  39                 "command in a terminal on host '%s':\n"
  40                 "'python -m tf_encrypted.player --config %s %s'\n"
  41                 "This can be done automatically in a local subprocess by "
  42                 "setting `auto_managed=True` when instantiating a TFEWorker.",
  43                 self.host,
  44                 config_filename,
  45                 player_name,
  46             )
  47 
  48     def stop(self):
  49         if self.host is None:
  50             # we're running using a tfe.LocalConfig which doesn't require us to do anything
  51             return
  52 
  53         if self._auto_managed:
  54             if self._server_process is None:
  55                 return
  56             self._server_process.kill()
  57             self._server_process.communicate()
  58             self._server_process = None
  59         else:
  60             logger.info("Please terminate the process on host '%s'.", self.host)
  61 
  62     def connect_to_model(self, input_shape, output_shape, *workers):
  63         config, _ = self.config_from_workers(workers)
  64         tfe.set_config(config)
  65 
  66         prot = tfe.protocol.SecureNN(
  67             config.get_player("server0"), config.get_player("server1"), config.get_player("server2")
  68         )
  69         tfe.set_protocol(prot)
  70 
  71         self._tf_client = tfe.serving.QueueClient(
  72             input_shape=input_shape, output_shape=output_shape
  73         )
  74 
  75         sess = tfe.Session(config=config)
  76         self._tf_session = sess
  77 
  78     def query_model(self, data):
  79         self.query_model_async(data)
  80         return self.query_model_join()
  81 
  82     def query_model_async(self, data):
  83         self._tf_client.send_input(self._tf_session, data)
  84 
  85     def query_model_join(self):
  86         return self._tf_client.receive_output(self._tf_session)
  87 
  88     @classmethod
  89     def config_from_workers(cls, workers):
  90         if len(workers) != 3:
  91             raise ValueError("Expected three workers but {} were given".format(len(workers)))
  92 
  93         player_to_worker_mapping = OrderedDict()
  94         player_to_worker_mapping["server0"] = workers[0]
  95         player_to_worker_mapping["server1"] = workers[1]
  96         player_to_worker_mapping["server2"] = workers[2]
  97 
  98         use_local_config = all(worker.host is None for worker in workers)
  99         if use_local_config:
  100             config = tfe.LocalConfig(
  101                 player_names=player_to_worker_mapping.keys(), auto_add_unknown_players=False
  102             )
  103             return config, player_to_worker_mapping
  104 
  105         # use tfe.RemoteConfig
  106         hostmap = OrderedDict(
  107             [(player_name, worker.host) for player_name, worker in player_to_worker_mapping.items()]
  108         )
  109         config = tfe.RemoteConfig(hostmap)
  110         return config, player_to_worker_mapping
  111
  [end of syft/workers/tfe.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/syft/workers/tfe.py b/syft/workers/tfe.py
  --- a/syft/workers/tfe.py
  +++ b/syft/workers/tfe.py
  @@ -1,12 +1,15 @@
   """To be extended in the near future."""
   from collections import OrderedDict
   import logging
  +import os
   import subprocess
  +import tempfile
   
   import tf_encrypted as tfe
   
   
   logger = logging.getLogger("tf_encrypted")
  +_TMP_DIR = tempfile.gettempdir()
   
   
   class TFEWorker:
  @@ -23,26 +26,24 @@
               # we're running using a tfe.LocalConfig which doesn't require us to do anything
               return
   
  -        config_filename = "/tmp/tfe.config"
  +        config_filename = os.path.join(_TMP_DIR, "tfe.config")
   
           config, _ = self.config_from_workers(workers)
           config.save(config_filename)
   
  +        launch_cmd = "python -m tf_encrypted.player --config {} {}".format(
  +            config_filename, player_name
  +        )
           if self._auto_managed:
  -            cmd = "python -m tf_encrypted.player --config {} {}".format(
  -                config_filename, player_name
  -            )
  -            self._server_process = subprocess.Popen(cmd.split(" "))
  +            self._server_process = subprocess.Popen(launch_cmd.split(" "))
           else:
               logger.info(
                   "If not done already, please launch the following "
  -                "command in a terminal on host '%s':\n"
  -                "'python -m tf_encrypted.player --config %s %s'\n"
  +                "command in a terminal on host %s: '%s'\n"
                   "This can be done automatically in a local subprocess by "
  -                "setting `auto_managed=True` when instantiating a TFEWorker.",
  +                "setting `auto_managed=True` when instantiating a TFEWorker.\n",
                   self.host,
  -                config_filename,
  -                player_name,
  +                launch_cmd,
               )
   
       def stop(self):
  
verification_info: {"golden_diff": "diff --git a/syft/workers/tfe.py b/syft/workers/tfe.py\n--- a/syft/workers/tfe.py\n+++ b/syft/workers/tfe.py\n@@ -1,12 +1,15 @@\n \"\"\"To be extended in the near future.\"\"\"\n from collections import OrderedDict\n import logging\n+import os\n import subprocess\n+import tempfile\n \n import tf_encrypted as tfe\n \n \n logger = logging.getLogger(\"tf_encrypted\")\n+_TMP_DIR = tempfile.gettempdir()\n \n \n class TFEWorker:\n@@ -23,26 +26,24 @@\n             # we're running using a tfe.LocalConfig which doesn't require us to do anything\n             return\n \n-        config_filename = \"/tmp/tfe.config\"\n+        config_filename = os.path.join(_TMP_DIR, \"tfe.config\")\n \n         config, _ = self.config_from_workers(workers)\n         config.save(config_filename)\n \n+        launch_cmd = \"python -m tf_encrypted.player --config {} {}\".format(\n+            config_filename, player_name\n+        )\n         if self._auto_managed:\n-            cmd = \"python -m tf_encrypted.player --config {} {}\".format(\n-                config_filename, player_name\n-            )\n-            self._server_process = subprocess.Popen(cmd.split(\" \"))\n+            self._server_process = subprocess.Popen(launch_cmd.split(\" \"))\n         else:\n             logger.info(\n                 \"If not done already, please launch the following \"\n-                \"command in a terminal on host '%s':\\n\"\n-                \"'python -m tf_encrypted.player --config %s %s'\\n\"\n+                \"command in a terminal on host %s: '%s'\\n\"\n                 \"This can be done automatically in a local subprocess by \"\n-                \"setting `auto_managed=True` when instantiating a TFEWorker.\",\n+                \"setting `auto_managed=True` when instantiating a TFEWorker.\\n\",\n                 self.host,\n-                config_filename,\n-                player_name,\n+                launch_cmd,\n             )\n \n     def stop(self):\n", "issue": "Syft Keras bug on Windows\nRelevant slack discussion: https://openmined.slack.com/archives/C6DEWA4FR/p1559899875021800\r\n\r\nBug:\r\n![image](https://user-images.githubusercontent.com/7891333/59118559-79fa9400-891e-11e9-990e-1bba1fe9ec93.png)\r\n\r\nIt looks like the problem here is that the `tfe.config` is being saved in a location that is not a valid filepath in Windows.  As a result, there is likely a file with the name `/tmp/tfe.config` being saved in some folder on the machine, as opposed to a file with the name `tfe.config` being saved in the root subdirectory called `tmp`.\r\n\r\nThe fix for this should use `os.path` to figure out which filepath the tfe.config should be saved to, and then the logging messages should print the OS-specific CLI command for launching each `TFEWorker` process.\n", "before_files": [{"content": "\"\"\"To be extended in the near future.\"\"\"\nfrom collections import OrderedDict\nimport logging\nimport subprocess\n\nimport tf_encrypted as tfe\n\n\nlogger = logging.getLogger(\"tf_encrypted\")\n\n\nclass TFEWorker:\n    # TODO(Morten) this should be turned into a proxy, with existing code\n    # extracted into a new component that's launched via a script\n\n    def __init__(self, host=None, auto_managed=True):\n        self.host = host\n        self._server_process = None\n        self._auto_managed = auto_managed\n\n    def start(self, player_name, *workers):\n        if self.host is None:\n            # we're running using a tfe.LocalConfig which doesn't require us to do anything\n            return\n\n        config_filename = \"/tmp/tfe.config\"\n\n        config, _ = self.config_from_workers(workers)\n        config.save(config_filename)\n\n        if self._auto_managed:\n            cmd = \"python -m tf_encrypted.player --config {} {}\".format(\n                config_filename, player_name\n            )\n            self._server_process = subprocess.Popen(cmd.split(\" \"))\n        else:\n            logger.info(\n                \"If not done already, please launch the following \"\n                \"command in a terminal on host '%s':\\n\"\n                \"'python -m tf_encrypted.player --config %s %s'\\n\"\n                \"This can be done automatically in a local subprocess by \"\n                \"setting `auto_managed=True` when instantiating a TFEWorker.\",\n                self.host,\n                config_filename,\n                player_name,\n            )\n\n    def stop(self):\n        if self.host is None:\n            # we're running using a tfe.LocalConfig which doesn't require us to do anything\n            return\n\n        if self._auto_managed:\n            if self._server_process is None:\n                return\n            self._server_process.kill()\n            self._server_process.communicate()\n            self._server_process = None\n        else:\n            logger.info(\"Please terminate the process on host '%s'.\", self.host)\n\n    def connect_to_model(self, input_shape, output_shape, *workers):\n        config, _ = self.config_from_workers(workers)\n        tfe.set_config(config)\n\n        prot = tfe.protocol.SecureNN(\n            config.get_player(\"server0\"), config.get_player(\"server1\"), config.get_player(\"server2\")\n        )\n        tfe.set_protocol(prot)\n\n        self._tf_client = tfe.serving.QueueClient(\n            input_shape=input_shape, output_shape=output_shape\n        )\n\n        sess = tfe.Session(config=config)\n        self._tf_session = sess\n\n    def query_model(self, data):\n        self.query_model_async(data)\n        return self.query_model_join()\n\n    def query_model_async(self, data):\n        self._tf_client.send_input(self._tf_session, data)\n\n    def query_model_join(self):\n        return self._tf_client.receive_output(self._tf_session)\n\n    @classmethod\n    def config_from_workers(cls, workers):\n        if len(workers) != 3:\n            raise ValueError(\"Expected three workers but {} were given\".format(len(workers)))\n\n        player_to_worker_mapping = OrderedDict()\n        player_to_worker_mapping[\"server0\"] = workers[0]\n        player_to_worker_mapping[\"server1\"] = workers[1]\n        player_to_worker_mapping[\"server2\"] = workers[2]\n\n        use_local_config = all(worker.host is None for worker in workers)\n        if use_local_config:\n            config = tfe.LocalConfig(\n                player_names=player_to_worker_mapping.keys(), auto_add_unknown_players=False\n            )\n            return config, player_to_worker_mapping\n\n        # use tfe.RemoteConfig\n        hostmap = OrderedDict(\n            [(player_name, worker.host) for player_name, worker in player_to_worker_mapping.items()]\n        )\n        config = tfe.RemoteConfig(hostmap)\n        return config, player_to_worker_mapping\n", "path": "syft/workers/tfe.py"}]}