We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Implement rsqrt Functionality in FloatTensor with CPU/GPU Backend Support
### User Story: 
As a Data Scientist using PySyft's FloatTensor type, I want to leverage a wide range of methods which use our new Unity backend. For this ticket to be complete, the rsqrt() should be added to our FloatTensor class with the appropriate functionality, returning a new tensor.

Furthermore, the function should automatically determine which backend to use (CPU/GPU) based on where the data is located. If the data is located on the CPU, a performant CPU implementation should run but if the data for a given FloatTensor is located on a GPU, it should be run using an HLSL kernel where appropriate. Obviously, if no GPU is available, it should automatically fall back to the CPU implementation.

### Every Reference You Might Need for this Issue:

- For a reference on the operation this performs check out [PyTorch](http://pytorch.org/docs/master/tensors.html)'s documentation.
- For a reference on how to program in Unity, check out [this basic tutorial](https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial)
- For a reference on how to write HLSL code, check out [this basic tutorial](http://kylehalladay.com/blog/tutorial/2014/06/27/Compute-Shaders-Are-Nifty.html)
- For a complete tutorial on how to add functions to FloatTensor (step by step guide) see [this Google Document](https://docs.google.com/document/d/1WRd7gGLFN0Awtf86AICYIHtg3gfFWLBa5wYTthsB3i0/edit)
- For a reference on how other functions like this have been implemented check out the functions in [this notebook](https://github.com/OpenMined/OpenMined/blob/master/notebooks/Syft%20Tensor%20Example%20Notebook.ipynb) as well as the corresponding files that made it possible ([SyftController](https://github.com/OpenMined/OpenMined/blob/master/Assets/OpenMined/Network/Controllers/SyftController.cs), [FloatTensor.Ops](https://github.com/OpenMined/OpenMined/blob/master/Assets/OpenMined/Syft/Tensor/FloatTensor.Ops.cs), [FloatTensor.ShaderOps](https://github.com/OpenMined/OpenMined/blob/master/Assets/OpenMined/Syft/Tensor/FloatTensor.ShaderOps.cs), [FloatTensorShaders](https://github.com/OpenMined/OpenMined/blob/master/Assets/OpenMined/Syft/Math/Shaders/FloatTensorShaders.compute), and [FloatTensorTest](https://github.com/OpenMined/OpenMined/blob/master/Assets/OpenMined.Tests/Editor/FloatTensorTest.cs)).
- And of course, please consider our [Contributor Guidelines](https://github.com/OpenMined/Docs/blob/master/contributing/guidelines.md) for all contributions.
### Acceptance Criteria:

- [ ] an integration test in PySyft demonstrating the correct CPU and GPU operation implemented over a FloatTensor while connected to a Unity backend
- [ ] a Unit Test in OpenMined/OpenMined demonstrating the correct operation on a FloatTensor
- [ ] [inline](http://pytorch.org/docs/master/tensors.html) documentation in the python code. For inspiration on inline documentation, please check out PyTorch's documentation for this operator.
- [ ] Link your Pull Request back to this Issue so that it gets closed appropriately when the PR is merged.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `syft/syft.py`
Content:
```
1 import zmq
2 import uuid
3 
4 
5 class FloatTensor():
6 
7     def __init__(self, controller, data, data_is_pointer=False, verbose=False):
8         self.verbose = verbose
9         self.controller = controller
10         if(data is not None and not data_is_pointer):
11             data = data.astype('float')
12             controller.socket.send_json({"objectType": "tensor",
13                                          "functionCall": "create",
14                                          "data": list(data.flatten()),
15                                          "shape": data.shape})
16             self.id = int(controller.socket.recv_string())
17             if(verbose):
18                 print("FloatTensor.__init__: " +  str(self.id))
19 
20         elif(data_is_pointer):
21             self.id = int(data)
22 
23     def __del__(self):
24         self.delete_tensor()
25 
26     def abs(self):
27         return self.no_params_func("abs", return_response=True)
28 
29     def abs_(self):
30         return self.no_params_func("abs_")
31 
32     def acos(self):
33         return self.no_params_func("acos", return_response=True)
34 
35     def acos_(self):
36         return self.no_params_func("acos_")
37 
38     def asin(self):
39         return self.no_params_func("asin", return_response=True)
40 
41     def asin_(self):
42         return self.no_params_func("asin_")
43 
44     def atan(self):
45         return self.no_params_func("atan", return_response=True)
46 
47     def atan_(self):
48         return self.no_params_func("atan_")
49 
50     def addmm_(self, x, y):
51         return self.params_func("addmm_", [x.id, y.id])
52 
53     def addmm(self, x, y):
54         copy = self.copy()
55         copy.params_func("addmm_", [x.id, y.id])
56         return copy
57 
58     def addmv_(self, x, y):
59         return self.params_func("addmv_", [x.id, y.id])
60 
61     def addmv(self, x, y):
62         copy = self.copy()
63         copy.params_func("addmv_", [x.id, y.id])
64         return copy
65 
66     def __add__(self, x):
67         return self.arithmetic_operation(x, "add", False)
68 
69     def __iadd__(self, x):
70         return self.arithmetic_operation(x, "add", True)
71 
72     def copy(self):
73         return self.no_params_func("copy", return_response=True)
74 
75     def cos(self):
76         return self.no_params_func("cos", return_response=True)
77 
78     def cos_(self):
79         return self.no_params_func("cos_")
80 
81     def cosh(self):
82         return self.no_params_func("cosh", return_response=True)
83 
84     def cosh_(self):
85         return self.no_params_func("cosh_")
86 
87     def __truediv__(self, x):
88         return self.arithmetic_operation(x, "div", False)
89 
90     def __itruediv__(self, x):
91         return self.arithmetic_operation(x, "div", True)
92 
93     def floor_(self):
94         return self.no_params_func("floor_")
95 
96     def __mul__(self, x):
97         return self.arithmetic_operation(x, "mul", False)
98 
99     def __imul__(self, x):
100         return self.arithmetic_operation(x, "mul", True)
101 
102     def neg(self):
103         return self.no_params_func("neg", return_response=True)
104 
105     def sigmoid_(self):
106         return self.no_params_func("sigmoid_")
107 
108     def sign(self):
109         return self.no_params_func("sign", return_response=True)
110 
111     def sin(self):
112         return self.no_params_func("sin", return_response=True)
113 
114     def sin_(self):
115         return self.no_params_func("sin_")
116 
117     def size(self):
118         """
119         Returns the size of the self tensor as a FloatTensor.
120 
121         Note:
122             The returned value currently is a FloatTensor because it leverages
123             the messaging mechanism with Unity.
124         """
125         return self.no_params_func("size", return_response=True)
126 
127     def sqrt(self):
128         return self.no_params_func("sqrt", return_response=True)
129 
130     def trunc(self):
131         return self.no_params_func("trunc", return_response=True)
132 
133     def __sub__(self, x):
134         return self.arithmetic_operation(x, "sub", False)
135 
136     def __isub__(self,x):
137         return self.arithmetic_operation(x,"sub",True)
138 
139     def sum(self,dim):
140         assert type(dim) == int
141         return self.arithmetic_operation(dim, "sum", False)
142 
143     def view(self, *args):
144         new_dim = list(args)
145         assert type(new_dim) == list
146         assert type(new_dim[0]) == int
147         return self.params_func("view", new_dim, return_response=True)
148 
149     def view_(self, *args):
150         new_dim = list(args)
151         assert type(new_dim) == list
152         assert type(new_dim[0]) == int
153         self.params_func("view_", new_dim, return_response=False)
154         return self
155 
156     def T(self):
157         return self.no_params_func("transpose", return_response=True)
158 
159     def triu(self, k=0):
160         return self.params_func("triu", [k], return_response=True)
161 
162     def triu_(self, k=0):
163         return self.params_func("triu_", [k])
164 
165     # Fills this tensor with zeros.
166     def zero_(self):
167         return self.no_params_func("zero_")
168 
169     def __repr__(self):
170         return self.no_params_func("print", True, False)
171 
172     def __str__(self):
173         return self.no_params_func("print", True, False)
174 
175     def cpu(self):
176         return self.no_params_func("cpu")
177 
178     def gpu(self):
179         return self.no_params_func("gpu")
180 
181     def cmd(self, functionCall, tensorIndexParams=[]):
182         cmd = {
183             'functionCall': functionCall,
184             'objectType': 'tensor',
185             'objectIndex': self.id,
186             'tensorIndexParams': tensorIndexParams}
187         return cmd
188 
189     def params_func(self, name, params, return_response=False, return_as_tensor=True):
190         # send the command
191         self.controller.socket.send_json(
192             self.cmd(name, tensorIndexParams=params))
193         # receive output from command
194         res = self.controller.socket.recv_string()
195 
196         if(self.verbose):
197             print(res)
198 
199         if(return_response):
200             if(return_as_tensor):
201                 if(self.verbose):
202                     print("FloatTensor.__init__: " +  res)
203                 return FloatTensor(self.controller,int(res),True)
204             else:
205                 return res
206         return self
207 
208     def no_params_func(self, name, return_response=False, return_as_tensor=True):
209         return(self.params_func(name, [], return_response, return_as_tensor))
210 
211     def arithmetic_operation(self, x, name, inline=False):
212 
213         operation_cmd = name
214 
215         if(type(x) == FloatTensor):
216             operation_cmd += "_elem"
217             parameter = x.id
218         else:
219             operation_cmd += "_scalar"
220             parameter = str(x)
221 
222         if(inline):
223             operation_cmd += "_"
224 
225         self.controller.socket.send_json(
226             self.cmd(operation_cmd, [parameter]))  # sends the command
227         return FloatTensor(self.controller, int(self.controller.socket.recv_string()), True)
228 
229     def delete_tensor(self):
230         if(self.id is not None):
231             self.no_params_func("delete")
232         self.verbose = None
233         self.controller = None
234         self.id = None
235 
236     def T(self):
237         return self.no_params_func("transpose", return_response=True)
238 
239     def is_contiguous(self):
240         return self.no_params_func("is_contiguous", return_response=True, return_as_tensor=False)
241 
242     def sinh(self):
243         return self.no_params_func("sinh", return_response=True)
244 
245     def sinh_(self):
246         return self.no_params_func("sinh_")
247 
248     def tan(self):
249         return self.no_params_func("tan", return_response=True)
250 
251     def tan_(self):
252         return self.no_params_func("tan_")
253 
254     def tanh(self):
255         return self.no_params_func("tanh", return_response=True)
256 
257 
258 class SyftController():
259 
260     def __init__(self,verbose=True):
261 
262         self.identity = str(uuid.uuid4())
263 
264         context = zmq.Context()
265         self.socket = context.socket(zmq.DEALER)
266         self.socket.setsockopt_string(zmq.IDENTITY, self.identity)
267         self.socket.connect("tcp://localhost:5555")
268         self.verbose=verbose
269 
270     def FloatTensor(self, data):
271         verbose = self.verbose
272         return FloatTensor(self, data,verbose=verbose)
273
```
--- 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/syft/syft.py b/syft/syft.py
--- a/syft/syft.py
+++ b/syft/syft.py
@@ -102,6 +102,9 @@
     def neg(self):
         return self.no_params_func("neg", return_response=True)
 
+    def rsqrt(self):
+        return self.no_params_func("rsqrt",return_response=True)
+
     def sigmoid_(self):
         return self.no_params_func("sigmoid_")

{"golden_diff": "diff --git a/syft/syft.py b/syft/syft.py\n--- a/syft/syft.py\n+++ b/syft/syft.py\n@@ -102,6 +102,9 @@\n     def neg(self):\n         return self.no_params_func(\"neg\", return_response=True)\n \n+    def rsqrt(self):\n+        return self.no_params_func(\"rsqrt\",return_response=True)\n+\n     def sigmoid_(self):\n         return self.no_params_func(\"sigmoid_\")\n", "issue": "Implement rsqrt Functionality in FloatTensor with CPU/GPU Backend Support\n### User Story: \r\nAs a Data Scientist using PySyft's FloatTensor type, I want to leverage a wide range of methods which use our new Unity backend. For this ticket to be complete, the rsqrt() should be added to our FloatTensor class with the appropriate functionality, returning a new tensor.\r\n\r\nFurthermore, the function should automatically determine which backend to use (CPU/GPU) based on where the data is located. If the data is located on the CPU, a performant CPU implementation should run but if the data for a given FloatTensor is located on a GPU, it should be run using an HLSL kernel where appropriate. Obviously, if no GPU is available, it should automatically fall back to the CPU implementation.\r\n\r\n### Every Reference You Might Need for this Issue:\r\n\r\n- For a reference on the operation this performs check out [PyTorch](http://pytorch.org/docs/master/tensors.html)'s documentation.\r\n- For a reference on how to program in Unity, check out [this basic tutorial](https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial)\r\n- For a reference on how to write HLSL code, check out [this basic tutorial](http://kylehalladay.com/blog/tutorial/2014/06/27/Compute-Shaders-Are-Nifty.html)\r\n- For a complete tutorial on how to add functions to FloatTensor (step by step guide) see [this Google Document](https://docs.google.com/document/d/1WRd7gGLFN0Awtf86AICYIHtg3gfFWLBa5wYTthsB3i0/edit)\r\n- For a reference on how other functions like this have been implemented check out the functions in [this notebook](https://github.com/OpenMined/OpenMined/blob/master/notebooks/Syft%20Tensor%20Example%20Notebook.ipynb) as well as the corresponding files that made it possible ([SyftController](https://github.com/OpenMined/OpenMined/blob/master/Assets/OpenMined/Network/Controllers/SyftController.cs), [FloatTensor.Ops](https://github.com/OpenMined/OpenMined/blob/master/Assets/OpenMined/Syft/Tensor/FloatTensor.Ops.cs), [FloatTensor.ShaderOps](https://github.com/OpenMined/OpenMined/blob/master/Assets/OpenMined/Syft/Tensor/FloatTensor.ShaderOps.cs), [FloatTensorShaders](https://github.com/OpenMined/OpenMined/blob/master/Assets/OpenMined/Syft/Math/Shaders/FloatTensorShaders.compute), and [FloatTensorTest](https://github.com/OpenMined/OpenMined/blob/master/Assets/OpenMined.Tests/Editor/FloatTensorTest.cs)).\r\n- And of course, please consider our [Contributor Guidelines](https://github.com/OpenMined/Docs/blob/master/contributing/guidelines.md) for all contributions.\r\n### Acceptance Criteria:\r\n\r\n- [ ] an integration test in PySyft demonstrating the correct CPU and GPU operation implemented over a FloatTensor while connected to a Unity backend\r\n- [ ] a Unit Test in OpenMined/OpenMined demonstrating the correct operation on a FloatTensor\r\n- [ ] [inline](http://pytorch.org/docs/master/tensors.html) documentation in the python code. For inspiration on inline documentation, please check out PyTorch's documentation for this operator.\r\n- [ ] Link your Pull Request back to this Issue so that it gets closed appropriately when the PR is merged.\n", "before_files": [{"content": "import zmq\nimport uuid\n\n\nclass FloatTensor():\n\n    def __init__(self, controller, data, data_is_pointer=False, verbose=False):\n        self.verbose = verbose\n        self.controller = controller\n        if(data is not None and not data_is_pointer):\n            data = data.astype('float')\n            controller.socket.send_json({\"objectType\": \"tensor\",\n                                         \"functionCall\": \"create\",\n                                         \"data\": list(data.flatten()),\n                                         \"shape\": data.shape})\n            self.id = int(controller.socket.recv_string())\n            if(verbose):\n                print(\"FloatTensor.__init__: \" +  str(self.id))\n\n        elif(data_is_pointer):\n            self.id = int(data)\n\n    def __del__(self):\n        self.delete_tensor()\n\n    def abs(self):\n        return self.no_params_func(\"abs\", return_response=True)\n\n    def abs_(self):\n        return self.no_params_func(\"abs_\")\n\n    def acos(self):\n        return self.no_params_func(\"acos\", return_response=True)\n\n    def acos_(self):\n        return self.no_params_func(\"acos_\")\n\n    def asin(self):\n        return self.no_params_func(\"asin\", return_response=True)\n\n    def asin_(self):\n        return self.no_params_func(\"asin_\")\n\n    def atan(self):\n        return self.no_params_func(\"atan\", return_response=True)\n\n    def atan_(self):\n        return self.no_params_func(\"atan_\")\n\n    def addmm_(self, x, y):\n        return self.params_func(\"addmm_\", [x.id, y.id])\n\n    def addmm(self, x, y):\n        copy = self.copy()\n        copy.params_func(\"addmm_\", [x.id, y.id])\n        return copy\n\n    def addmv_(self, x, y):\n        return self.params_func(\"addmv_\", [x.id, y.id])\n\n    def addmv(self, x, y):\n        copy = self.copy()\n        copy.params_func(\"addmv_\", [x.id, y.id])\n        return copy\n\n    def __add__(self, x):\n        return self.arithmetic_operation(x, \"add\", False)\n\n    def __iadd__(self, x):\n        return self.arithmetic_operation(x, \"add\", True)\n\n    def copy(self):\n        return self.no_params_func(\"copy\", return_response=True)\n\n    def cos(self):\n        return self.no_params_func(\"cos\", return_response=True)\n\n    def cos_(self):\n        return self.no_params_func(\"cos_\")\n\n    def cosh(self):\n        return self.no_params_func(\"cosh\", return_response=True)\n\n    def cosh_(self):\n        return self.no_params_func(\"cosh_\")\n\n    def __truediv__(self, x):\n        return self.arithmetic_operation(x, \"div\", False)\n\n    def __itruediv__(self, x):\n        return self.arithmetic_operation(x, \"div\", True)\n\n    def floor_(self):\n        return self.no_params_func(\"floor_\")\n\n    def __mul__(self, x):\n        return self.arithmetic_operation(x, \"mul\", False)\n\n    def __imul__(self, x):\n        return self.arithmetic_operation(x, \"mul\", True)\n\n    def neg(self):\n        return self.no_params_func(\"neg\", return_response=True)\n\n    def sigmoid_(self):\n        return self.no_params_func(\"sigmoid_\")\n\n    def sign(self):\n        return self.no_params_func(\"sign\", return_response=True)\n\n    def sin(self):\n        return self.no_params_func(\"sin\", return_response=True)\n\n    def sin_(self):\n        return self.no_params_func(\"sin_\")\n\n    def size(self):\n        \"\"\"\n        Returns the size of the self tensor as a FloatTensor.\n\n        Note:\n            The returned value currently is a FloatTensor because it leverages\n            the messaging mechanism with Unity.\n        \"\"\"\n        return self.no_params_func(\"size\", return_response=True)\n\n    def sqrt(self):\n        return self.no_params_func(\"sqrt\", return_response=True)\n\n    def trunc(self):\n        return self.no_params_func(\"trunc\", return_response=True)\n\n    def __sub__(self, x):\n        return self.arithmetic_operation(x, \"sub\", False)\n\n    def __isub__(self,x):\n        return self.arithmetic_operation(x,\"sub\",True)\n\n    def sum(self,dim):\n        assert type(dim) == int\n        return self.arithmetic_operation(dim, \"sum\", False)\n\n    def view(self, *args):\n        new_dim = list(args)\n        assert type(new_dim) == list\n        assert type(new_dim[0]) == int\n        return self.params_func(\"view\", new_dim, return_response=True)\n\n    def view_(self, *args):\n        new_dim = list(args)\n        assert type(new_dim) == list\n        assert type(new_dim[0]) == int\n        self.params_func(\"view_\", new_dim, return_response=False)\n        return self\n\n    def T(self):\n        return self.no_params_func(\"transpose\", return_response=True)\n\n    def triu(self, k=0):\n        return self.params_func(\"triu\", [k], return_response=True)\n\n    def triu_(self, k=0):\n        return self.params_func(\"triu_\", [k])\n\n    # Fills this tensor with zeros.\n    def zero_(self):\n        return self.no_params_func(\"zero_\")\n\n    def __repr__(self):\n        return self.no_params_func(\"print\", True, False)\n\n    def __str__(self):\n        return self.no_params_func(\"print\", True, False)\n\n    def cpu(self):\n        return self.no_params_func(\"cpu\")\n\n    def gpu(self):\n        return self.no_params_func(\"gpu\")\n\n    def cmd(self, functionCall, tensorIndexParams=[]):\n        cmd = {\n            'functionCall': functionCall,\n            'objectType': 'tensor',\n            'objectIndex': self.id,\n            'tensorIndexParams': tensorIndexParams}\n        return cmd\n\n    def params_func(self, name, params, return_response=False, return_as_tensor=True):\n        # send the command\n        self.controller.socket.send_json(\n            self.cmd(name, tensorIndexParams=params))\n        # receive output from command\n        res = self.controller.socket.recv_string()\n\n        if(self.verbose):\n            print(res)\n\n        if(return_response):\n            if(return_as_tensor):\n                if(self.verbose):\n                    print(\"FloatTensor.__init__: \" +  res)\n                return FloatTensor(self.controller,int(res),True)\n            else:\n                return res\n        return self\n\n    def no_params_func(self, name, return_response=False, return_as_tensor=True):\n        return(self.params_func(name, [], return_response, return_as_tensor))\n\n    def arithmetic_operation(self, x, name, inline=False):\n\n        operation_cmd = name\n\n        if(type(x) == FloatTensor):\n            operation_cmd += \"_elem\"\n            parameter = x.id\n        else:\n            operation_cmd += \"_scalar\"\n            parameter = str(x)\n\n        if(inline):\n            operation_cmd += \"_\"\n\n        self.controller.socket.send_json(\n            self.cmd(operation_cmd, [parameter]))  # sends the command\n        return FloatTensor(self.controller, int(self.controller.socket.recv_string()), True)\n\n    def delete_tensor(self):\n        if(self.id is not None):\n            self.no_params_func(\"delete\")\n        self.verbose = None\n        self.controller = None\n        self.id = None\n\n    def T(self):\n        return self.no_params_func(\"transpose\", return_response=True)\n\n    def is_contiguous(self):\n        return self.no_params_func(\"is_contiguous\", return_response=True, return_as_tensor=False)\n\n    def sinh(self):\n        return self.no_params_func(\"sinh\", return_response=True)\n\n    def sinh_(self):\n        return self.no_params_func(\"sinh_\")\n\n    def tan(self):\n        return self.no_params_func(\"tan\", return_response=True)\n\n    def tan_(self):\n        return self.no_params_func(\"tan_\")\n\n    def tanh(self):\n        return self.no_params_func(\"tanh\", return_response=True)\n\n\nclass SyftController():\n\n    def __init__(self,verbose=True):\n\n        self.identity = str(uuid.uuid4())\n\n        context = zmq.Context()\n        self.socket = context.socket(zmq.DEALER)\n        self.socket.setsockopt_string(zmq.IDENTITY, self.identity)\n        self.socket.connect(\"tcp://localhost:5555\")\n        self.verbose=verbose\n\n    def FloatTensor(self, data):\n        verbose = self.verbose\n        return FloatTensor(self, data,verbose=verbose)\n", "path": "syft/syft.py"}], "after_files": [{"content": "import zmq\nimport uuid\n\n\nclass FloatTensor():\n\n    def __init__(self, controller, data, data_is_pointer=False, verbose=False):\n        self.verbose = verbose\n        self.controller = controller\n        if(data is not None and not data_is_pointer):\n            data = data.astype('float')\n            controller.socket.send_json({\"objectType\": \"tensor\",\n                                         \"functionCall\": \"create\",\n                                         \"data\": list(data.flatten()),\n                                         \"shape\": data.shape})\n            self.id = int(controller.socket.recv_string())\n            if(verbose):\n                print(\"FloatTensor.__init__: \" +  str(self.id))\n\n        elif(data_is_pointer):\n            self.id = int(data)\n\n    def __del__(self):\n        self.delete_tensor()\n\n    def abs(self):\n        return self.no_params_func(\"abs\", return_response=True)\n\n    def abs_(self):\n        return self.no_params_func(\"abs_\")\n\n    def acos(self):\n        return self.no_params_func(\"acos\", return_response=True)\n\n    def acos_(self):\n        return self.no_params_func(\"acos_\")\n\n    def asin(self):\n        return self.no_params_func(\"asin\", return_response=True)\n\n    def asin_(self):\n        return self.no_params_func(\"asin_\")\n\n    def atan(self):\n        return self.no_params_func(\"atan\", return_response=True)\n\n    def atan_(self):\n        return self.no_params_func(\"atan_\")\n\n    def addmm_(self, x, y):\n        return self.params_func(\"addmm_\", [x.id, y.id])\n\n    def addmm(self, x, y):\n        copy = self.copy()\n        copy.params_func(\"addmm_\", [x.id, y.id])\n        return copy\n\n    def addmv_(self, x, y):\n        return self.params_func(\"addmv_\", [x.id, y.id])\n\n    def addmv(self, x, y):\n        copy = self.copy()\n        copy.params_func(\"addmv_\", [x.id, y.id])\n        return copy\n\n    def __add__(self, x):\n        return self.arithmetic_operation(x, \"add\", False)\n\n    def __iadd__(self, x):\n        return self.arithmetic_operation(x, \"add\", True)\n\n    def copy(self):\n        return self.no_params_func(\"copy\", return_response=True)\n\n    def cos(self):\n        return self.no_params_func(\"cos\", return_response=True)\n\n    def cos_(self):\n        return self.no_params_func(\"cos_\")\n\n    def cosh(self):\n        return self.no_params_func(\"cosh\", return_response=True)\n\n    def cosh_(self):\n        return self.no_params_func(\"cosh_\")\n\n    def __truediv__(self, x):\n        return self.arithmetic_operation(x, \"div\", False)\n\n    def __itruediv__(self, x):\n        return self.arithmetic_operation(x, \"div\", True)\n\n    def floor_(self):\n        return self.no_params_func(\"floor_\")\n\n    def __mul__(self, x):\n        return self.arithmetic_operation(x, \"mul\", False)\n\n    def __imul__(self, x):\n        return self.arithmetic_operation(x, \"mul\", True)\n\n    def neg(self):\n        return self.no_params_func(\"neg\", return_response=True)\n\n    def rsqrt(self):\n        return self.no_params_func(\"rsqrt\",return_response=True)\n\n    def sigmoid_(self):\n        return self.no_params_func(\"sigmoid_\")\n\n    def sign(self):\n        return self.no_params_func(\"sign\", return_response=True)\n\n    def sin(self):\n        return self.no_params_func(\"sin\", return_response=True)\n\n    def sin_(self):\n        return self.no_params_func(\"sin_\")\n\n    def size(self):\n        \"\"\"\n        Returns the size of the self tensor as a FloatTensor.\n\n        Note:\n            The returned value currently is a FloatTensor because it leverages\n            the messaging mechanism with Unity.\n        \"\"\"\n        return self.no_params_func(\"size\", return_response=True)\n\n    def sqrt(self):\n        return self.no_params_func(\"sqrt\", return_response=True)\n\n    def trunc(self):\n        return self.no_params_func(\"trunc\", return_response=True)\n\n    def __sub__(self, x):\n        return self.arithmetic_operation(x, \"sub\", False)\n\n    def __isub__(self,x):\n        return self.arithmetic_operation(x,\"sub\",True)\n\n    def sum(self,dim):\n        assert type(dim) == int\n        return self.arithmetic_operation(dim, \"sum\", False)\n\n    def view(self, *args):\n        new_dim = list(args)\n        assert type(new_dim) == list\n        assert type(new_dim[0]) == int\n        return self.params_func(\"view\", new_dim, return_response=True)\n\n    def view_(self, *args):\n        new_dim = list(args)\n        assert type(new_dim) == list\n        assert type(new_dim[0]) == int\n        self.params_func(\"view_\", new_dim, return_response=False)\n        return self\n\n    def T(self):\n        return self.no_params_func(\"transpose\", return_response=True)\n\n    def triu(self, k=0):\n        return self.params_func(\"triu\", [k], return_response=True)\n\n    def triu_(self, k=0):\n        return self.params_func(\"triu_\", [k])\n\n    # Fills this tensor with zeros.\n    def zero_(self):\n        return self.no_params_func(\"zero_\")\n\n    def __repr__(self):\n        return self.no_params_func(\"print\", True, False)\n\n    def __str__(self):\n        return self.no_params_func(\"print\", True, False)\n\n    def cpu(self):\n        return self.no_params_func(\"cpu\")\n\n    def gpu(self):\n        return self.no_params_func(\"gpu\")\n\n    def cmd(self, functionCall, tensorIndexParams=[]):\n        cmd = {\n            'functionCall': functionCall,\n            'objectType': 'tensor',\n            'objectIndex': self.id,\n            'tensorIndexParams': tensorIndexParams}\n        return cmd\n\n    def params_func(self, name, params, return_response=False, return_as_tensor=True):\n        # send the command\n        self.controller.socket.send_json(\n            self.cmd(name, tensorIndexParams=params))\n        # receive output from command\n        res = self.controller.socket.recv_string()\n\n        if(self.verbose):\n            print(res)\n\n        if(return_response):\n            if(return_as_tensor):\n                if(self.verbose):\n                    print(\"FloatTensor.__init__: \" +  res)\n                return FloatTensor(self.controller,int(res),True)\n            else:\n                return res\n        return self\n\n    def no_params_func(self, name, return_response=False, return_as_tensor=True):\n        return(self.params_func(name, [], return_response, return_as_tensor))\n\n    def arithmetic_operation(self, x, name, inline=False):\n\n        operation_cmd = name\n\n        if(type(x) == FloatTensor):\n            operation_cmd += \"_elem\"\n            parameter = x.id\n        else:\n            operation_cmd += \"_scalar\"\n            parameter = str(x)\n\n        if(inline):\n            operation_cmd += \"_\"\n\n        self.controller.socket.send_json(\n            self.cmd(operation_cmd, [parameter]))  # sends the command\n        return FloatTensor(self.controller, int(self.controller.socket.recv_string()), True)\n\n    def delete_tensor(self):\n        if(self.id is not None):\n            self.no_params_func(\"delete\")\n        self.verbose = None\n        self.controller = None\n        self.id = None\n\n    def T(self):\n        return self.no_params_func(\"transpose\", return_response=True)\n\n    def is_contiguous(self):\n        return self.no_params_func(\"is_contiguous\", return_response=True, return_as_tensor=False)\n\n    def sinh(self):\n        return self.no_params_func(\"sinh\", return_response=True)\n\n    def sinh_(self):\n        return self.no_params_func(\"sinh_\")\n\n    def tan(self):\n        return self.no_params_func(\"tan\", return_response=True)\n\n    def tan_(self):\n        return self.no_params_func(\"tan_\")\n\n    def tanh(self):\n        return self.no_params_func(\"tanh\", return_response=True)\n\n\nclass SyftController():\n\n    def __init__(self,verbose=True):\n\n        self.identity = str(uuid.uuid4())\n\n        context = zmq.Context()\n        self.socket = context.socket(zmq.DEALER)\n        self.socket.setsockopt_string(zmq.IDENTITY, self.identity)\n        self.socket.connect(\"tcp://localhost:5555\")\n        self.verbose=verbose\n\n    def FloatTensor(self, data):\n        verbose = self.verbose\n        return FloatTensor(self, data,verbose=verbose)\n", "path": "syft/syft.py"}]}