mirror of
https://github.com/wassname/ray.git
synced 2026-07-23 13:10:11 +08:00
change remote function invocation from func() to func.remote() (#328)
This commit is contained in:
committed by
Philipp Moritz
parent
92f1976e94
commit
0e5b858324
@@ -105,7 +105,7 @@ computation. Instead, it simply submits a number of tasks to the scheduler.
|
||||
result_refs = []
|
||||
for _ in range(100):
|
||||
params = generate_random_params()
|
||||
results.append((params, train_cnn_and_compute_accuracy(params, epochs)))
|
||||
results.append((params, train_cnn_and_compute_accuracy.remote(params, epochs)))
|
||||
```
|
||||
|
||||
If we wish to wait until the results have all been retrieved, we can retrieve
|
||||
|
||||
@@ -37,7 +37,7 @@ if __name__ == "__main__":
|
||||
dropout = np.random.uniform(0, 1)
|
||||
stddev = 10 ** np.random.uniform(-5, 5)
|
||||
params = {"learning_rate": learning_rate, "batch_size": batch_size, "dropout": dropout, "stddev": stddev}
|
||||
results.append((params, hyperopt.train_cnn_and_compute_accuracy(params, epochs, train_images, train_labels, validation_images, validation_labels)))
|
||||
results.append((params, hyperopt.train_cnn_and_compute_accuracy.remote(params, epochs, train_images, train_labels, validation_images, validation_labels)))
|
||||
|
||||
# Fetch the results of the tasks and print the results.
|
||||
for i in range(trials):
|
||||
|
||||
Reference in New Issue
Block a user