Further into this problem I found that it is caused by the version of gcc is too new:
Caffe:
https://github.com/BVLC/caffe/issues/4046 37
Torch:
https://github.com/szagoruyko/imagine-nn/issues/42 12
A usual way to solve it is to add a flag as: flags=-D_FORCE_INLINES before compiling. Is there any place I could insert this command installing Pytorch ?