Fix documentation.

This commit is contained in:
Robert Nishihara
2016-08-30 17:20:00 -07:00
parent fb7ccef493
commit 5cf1d60cb2
3 changed files with 2 additions and 13 deletions
-7
View File
@@ -112,13 +112,6 @@ def add(a, b):
return a + b
```
The information passed to the `@ray.remote` decorator includes type information
for the arguments and for the return values of the function. Because of the
distinction that we make between *submitting a task* and *executing the task*,
we require type information so that we can catch type errors when the remote
function is called instead of catching them when the task is actually executed
(which could be much later and could be on a different machine).
### Remote functions
Whereas in regular Python, calling `add(1, 2)` would return `3`, in Ray, calling
+1 -3
View File
@@ -88,9 +88,7 @@ def train_cnn_and_compute_accuracy(hyperparameters, train_images, train_labels,
return validation_accuracy
```
The only difference is that we added the `@ray.remote` decorator specifying a
little bit of type information (the input is a dictionary along with some numpy
arrays, and the return value is a float).
The only difference is that we added the `@ray.remote` decorator.
Now a call to `train_cnn_and_compute_accuracy` does not execute the function. It
submits the task to the scheduler and returns an object ID for the output
+1 -3
View File
@@ -102,9 +102,7 @@ def grad(theta, xs, ys):
return grad
```
The only difference is that we added the `@ray.remote` decorator specifying a
little bit of type information (the inputs consist of numpy arrays, `loss`
returns a float, and `grad` returns a numpy array).
The only difference is that we added the `@ray.remote` decorator.
Now, it is easy to speed up the computation of the full loss and the full
gradient.