You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
感谢作者提出了这个框架!
我想构建一个基于Spikingjelly的SAC框架,SNN模型定义为:
self.network1 = nn.Sequential( layer.Linear(num_inputs + num_actions, hidden_dim), neuron.IFNode(), layer.Linear(hidden_dim, hidden_dim), neuron.IFNode(), layer.Linear(hidden_dim, 1) )
在运行时报错:
spikingjelly Trying to backward through the graph a second time, but the buffers have already been freed. Specify retain_graph=True when calling backward the first time.
参考了这个链接在SAC的update_parameters函数中增加了functional.reset_net函数,但是还是没有解决这个问题:
`def update_parameters(self, memory: Any,batch_size: int,updates: Any) -> Tuple[float, float,float, float, float]:
state_batch, action_batch, reward_batch, next_state_batch, mask_batch = memory.sample(batch_size=batch_size)
state_batch = torch.FloatTensor(state_batch).to(self.device)
next_state_batch = torch.FloatTensor(next_state_batch).to(self.device)
action_batch = torch.FloatTensor(action_batch).to(self.device)
reward_batch = torch.FloatTensor(reward_batch).to(self.device).unsqueeze(1)
mask_batch = torch.FloatTensor(mask_batch).to(self.device).unsqueeze(1)
卡住很久了,求大神指点functional.reset_net加的错在哪里!感谢!!
Beta Was this translation helpful? Give feedback.
All reactions