I ran the code on my machine and it worked. I only removed the cv2 import, rest of it was exactly same. Output:
Version:
>>> torch.__version__
'0.1.10+16a133e'

OUTPUT:
[[ 0.22190067  0.113309  ]]
[[ 0.22374019  0.17195135]]
[[ 0.24251971  0.20971343]]
[[ 0.25022674  0.23256381]]
[[ 0.25297049  0.24633361]]
[[ 0.25373745  0.2547116 ]]
[[ 0.25378832  0.25985831]]
[[ 0.25362667  0.26304504]]
[[ 0.25343812  0.26503012]]
[[ 0.2532804   0.26627228]]
done - Hoping the last value should be zero
[[  7.61594176e-01  -6.59305393e-19]]
[[  9.63655114e-01  -1.15941839e-06]]
[[  9.94877398e-01  -7.77833122e-07]]
[[  9.99219239e-01  -7.20439346e-07]]
[[  9.99815702e-01  -7.12471092e-07]]
[[  9.99897778e-01  -7.11375492e-07]]
[[  9.99909043e-01  -7.11224914e-07]]
[[  9.99910653e-01  -7.11203825e-07]]
[[  9.99910831e-01  -7.11200983e-07]]
[[  9.99910891e-01  -7.11200926e-07]]
done - Hoping the last value should be zero
[[ 0.76159418 -0.        ]]
[[  9.64020252e-01  -4.48575378e-12]]
[[  9.95050907e-01  -2.20972351e-12]]
[[  9.99326706e-01  -1.97817370e-12]]
[[  9.99906898e-01  -1.94826468e-12]]
[[  9.99985516e-01  -1.94424338e-12]]
[[  9.99996126e-01  -1.94369932e-12]]
[[  9.99997556e-01  -1.94362603e-12]]
[[  9.99997735e-01  -1.94361671e-12]]
[[  9.99997795e-01  -1.94361302e-12]]
done - Hoping the last value should be zero
[[ 0.76159418 -0.        ]]
[[  9.64026868e-01  -3.94646712e-17]]
[[  9.95054364e-01  -1.57264918e-17]]
[[  9.99329090e-01  -1.36518715e-17]]
[[  9.99909043e-01  -1.33884757e-17]]
[[  9.99987543e-01  -1.33531386e-17]]
[[  9.99998152e-01  -1.33483426e-17]]
[[  9.99999583e-01  -1.33477065e-17]]
[[  9.99999762e-01  -1.33476039e-17]]
[[  9.99999821e-01  -1.33476039e-17]]
done - Hoping the last value should be zero
[[ 0.76159418  0.        ]]
[[  9.64027464e-01  -7.70289075e-22]]
[[  9.95054662e-01  -2.58641162e-22]]
[[  9.99329209e-01  -2.18775464e-22]]
[[  9.99909163e-01  -2.13788550e-22]]
[[  9.99987662e-01  -2.13120985e-22]]
[[  9.99998271e-01  -2.13030714e-22]]
[[  9.99999702e-01  -2.13018117e-22]]
[[  9.99999881e-01  -2.13016502e-22]]
[[  9.99999940e-01  -2.13016072e-22]]
done - Hoping the last value should be zero
[[ 0.76159418  0.        ]]
[[  9.64027584e-01  -3.21531385e-26]]
[[  9.95054722e-01  -9.34462056e-27]]
[[  9.99329269e-01  -7.73195391e-27]]
[[  9.99909222e-01  -7.53276268e-27]]
[[  9.99987721e-01  -7.50614017e-27]]
[[  9.99998331e-01  -7.50253251e-27]]
[[  9.99999762e-01  -7.50207491e-27]]
[[  9.99999940e-01  -7.50200250e-27]]
[[  1.00000000e+00  -7.50200250e-27]]
done - Hoping the last value should be zero
[[ 0.76159418  0.        ]]
[[  9.64027584e-01  -2.75070681e-30]]
[[  9.95054722e-01  -7.05951502e-31]]
[[  9.99329329e-01  -5.73105970e-31]]
[[  9.99909222e-01  -5.56879258e-31]]
[[  9.99987721e-01  -5.54712352e-31]]
[[  9.99998331e-01  -5.54420359e-31]]
[[  9.99999762e-01  -5.54382320e-31]]
[[  9.99999940e-01  -5.54375925e-31]]
[[  1.00000000e+00  -5.54375925e-31]]
done - Hoping the last value should be zero