Use NNPACK with pytorch for training

Hi everyoone

I want to use nnpack with pytorch.
I have built NNPACK using cmake and installed it as well.
What are the next steps to use nnpack with pytorch to train any model? I have tried to refer to various docs but none of them are very clear.

I will appreciate any suggestions related to this issue.


NNPack from the got submodule will be compiled in if you request that during build (but I think you have to ask). It does have relatively low preference by default (less than mkldnn, but more than the THNN fallback) if you invoke the usual convolution functions.
The direct functions are not part of the official API (ie use at your own risk, might break between versions etc.), but grepping for nnpack in the tests will let you find how to invoke them.
Note that you’re off the beaten path with that - NNPack was removed from PyTorch at some point and I only added it back recently for the benefit of the Android port - where I only use inference).

Best regards


Thank you so much for your reply Thomas, so i assume that if it is for android then its sensible to use NNPACK other wise for intel cpus mkldnn is better than using nnpack.