invalid index of a 0-dim tensor

You might have to changeloss.data[0]toloss.item()as indicated in the error message.

你可能感兴趣的:(invalid index of a 0-dim tensor)