mirror of
https://github.com/wassname/ray.git
synced 2026-07-29 11:26:04 +08:00
Copy initial state of an RNN to a CPU before converting it to a NumPy array (#8097)
This commit is contained in:
@@ -333,7 +333,9 @@ class TorchPolicy(Policy):
|
||||
|
||||
@override(Policy)
|
||||
def get_initial_state(self):
|
||||
return [s.numpy() for s in self.model.get_initial_state()]
|
||||
return [
|
||||
s.cpu().detach().numpy() for s in self.model.get_initial_state()
|
||||
]
|
||||
|
||||
def extra_grad_process(self, optimizer, loss):
|
||||
"""Called after each optimizer.zero_grad() + loss.backward() call.
|
||||
|
||||
Reference in New Issue
Block a user