the problem you have @al3x is that when you compiled pytorch from master, it didn’t detect a good BLAS library (such as MKL or Accelerate and is using unoptimized code).
When you installed 0.4.0 binary, it correctly linked against MKL.
That explains the 28s versus 0.6 seconds.
In our build from source instructions 14, the critical parts that will make sure you link to MKL are this section:
export CMAKE_PREFIX_PATH=[anaconda root directory]
conda install numpy pyyaml mkl mkl-include setuptools cmake cffi typing