I modify the code to fit the python3.6 (it works well in python2.7) with pytorch0.3.1.post2 and encounter the following error:
RuntimeError: invalid argument 1: must be strictly positive at /opt/conda/conda-bld/pytorch_1518243271935/work/torch/lib/TH/generic/THTensorMath.c:2247