① 현재 버전에서는 모든 텐서가 자동으로 Variable의 성질을 갖기 때문에 torch.autograd.Variable을 사용할 필요가 없지만 학습/연습 및 이전 버전에서 구현된 파이토치 코드를 이해하기 위해 사용합니다.
다음은 모델의 학습 결과입니다.
Iteration: 500. Loss: 2.237457513809204. Accuracy: 21.420000076293945 Iteration: 1000. Loss: 0.8156253695487976. Accuracy: 75.58000183105469 Iteration: 1500. Loss: 0.4442233443260193. Accuracy: 89.0199966430664 Iteration: 2000. Loss: 0.2941139340400696. Accuracy: 92.5199966430664 Iteration: 2500. Loss: 0.10072824358940125. Accuracy: 94.36000061035156 Iteration: 3000. Loss: 0.07324947416782379. Accuracy: 96.41000366210938 Iteration: 3500. Loss: 0.07463668286800385. Accuracy: 96.52999877929688 Iteration: 4000. Loss: 0.02473960630595684. Accuracy: 97.38999938964844 Iteration: 4500. Loss: 0.05208646133542061. Accuracy: 97.23999786376953 Iteration: 5000. Loss: 0.08925972133874893. Accuracy: 97.2300033569336 Iteration: 5500. Loss: 0.16396191716194153. Accuracy: 96.95999908447266 Iteration: 6000. Loss: 0.03904556855559349. Accuracy: 97.61000061035156 Iteration: 6500. Loss: 0.012450279667973518. Accuracy: 97.69999694824219 Iteration: 7000. Loss: 0.01861385628581047. Accuracy: 97.91999816894531 Iteration: 7500. Loss: 0.03142683207988739. Accuracy: 97.87000274658203 Iteration: 8000. Loss: 0.041584715247154236. Accuracy: 97.87999725341797 Iteration: 8500. Loss: 0.009684142656624317. Accuracy: 98.02999877929688 Iteration: 9000. Loss: 0.03081698529422283. Accuracy: 97.87999725341797
정확도가 97%로 상당히 높은 것을 확인할 수 있습니다.