mirror of
https://github.com/wassname/ray.git
synced 2026-07-17 11:32:33 +08:00
Python 2 compatibility. (#5887)
This commit is contained in:
@@ -48,7 +48,7 @@ def random_one_hot_labels(shape):
|
||||
# Use GPU wth
|
||||
# @ray.remote(num_gpus=1)
|
||||
@ray.remote
|
||||
class Network():
|
||||
class Network(object):
|
||||
def __init__(self):
|
||||
self.model = create_keras_model()
|
||||
self.dataset = np.random.random((1000, 32))
|
||||
|
||||
@@ -113,7 +113,7 @@ def dataset_creators(use_cuda):
|
||||
import torch.optim as optim
|
||||
|
||||
|
||||
class Network():
|
||||
class Network(object):
|
||||
def __init__(self, lr=0.01, momentum=0.5):
|
||||
use_cuda = torch.cuda.is_available()
|
||||
self.device = device = torch.device("cuda" if use_cuda else "cpu")
|
||||
|
||||
Reference in New Issue
Block a user