junxiaosong / AlphaZero_Gomoku

An implementation of the AlphaZero algorithm for Gomoku (also called Gobang or Five in a Row)
MIT License
3.33k stars 970 forks source link

fix index error when using higher pytorch version #83

Closed mrmitzh closed 5 years ago

mrmitzh commented 5 years ago

When pytorch version is greater than 0.5, we should use tensor.item() to convert a 0-dim tensor to a Python number. Otherwise we would not be able to train because of IndexError: invalid index of a 0-dim tensor problem.