[英]Why does my Tic Tac Toe Deep Q-Learning implementation not learn to block opponent moves?
[英]Why does this error pop up while working with Deep Q learning?
我一直在 Windows 10 机器上使用 Deep Q Learning。 我有带有 NVIDA 显卡的 pytorch 0.4.1 版本。
def select_action(self, state):
probs = F.softmax(self.model(Variable(state, volatile = True))*7)
action = probs.multinomial()
return action.data[0,0]
从代码的这一部分,我不断收到此错误:
TypeError: multinomial() missing 1 required positional arguments: "num_samples"
如果需要任何其他信息,将很快提供。
根据文档,您没有指定multinomial
函数的num_samples
来绘制多项式分布。
torch.multinomial(输入,num_samples,replacement=False,out=None)
返回一个张量,其中每行包含从位于张量input的相应行中的多项式概率分布中采样的num_samples索引。
更改代码如下:
def select_action(self, state):
probs = F.softmax(self.model(Variable(state, volatile = True))*7)
action = probs.multinomial(1) # 1 is the number of samples to draw
return action.data[0,0]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.