【发布时间】:2017-07-18 17:10:18
【问题描述】:
我正在尝试编写一个用于霸气的神经网络
输入是一个 8 x 8 x 3 的矩阵。我将矩阵组织如下:
第一个深度是游戏状态,第二个深度是翻转板,最后一个深度是玩家平面
输出是 8 x 8 是最好玩的游戏,也就是学习的移动(由蒙特卡洛树搜索生成)
那么网络是一个 8 x 8 张量,具有成为最佳游戏的概率, 我需要为我获取张量的最大概率的索引 (x,y)
我尝试了函数 torch.max(tensor, 2) 和 torch.max(tensor?1) 但我没有得到我需要的东西。
有人可以帮助我吗?
非常感谢!
#out = output of the neural net and output is the target output[indice][1]
# need to check if the target is the same as prediction
max, bestTarget = torch.max(output[index][1],2)
maxP, bestPrediction = torch.max(out,2)
max, indT = torch.max(max,1)
maxP, indP = torch.max(maxP,1)
【问题讨论】:
标签: matrix indexing lua max torch