I don’t think mkldnn is enabled by default. At least, for my build it isn’t:
- Testing default CPU tensors:
python -m timeit --setup="import torch; net = torch.nn.Linear(1000, 2); batch = torch.rand(16, 1000)" "net(batch)"
- Testing explicit MKLDNN backend:
python -m timeit --setup="import torch; from torch.utils import mkldnn as mkldnn_utils; net = torch.nn.Linear(1000, 2); net = mkldnn_utils.to_mkldnn(net); batch = torch.rand(16, 1000); batch = batch.to_mkldnn()" "net(batch)"
I get 1.5x speedup with mkl for these parameters.
I guess you are not passing all the tests because you didn’t build PyTorch from source.