extra info, FWIW: you will get an error in 0.5 onwards if you try tensor(0)
UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number