Hello @Chame_call
We just exposed conrtol on global number of threads used by pytorch android, it was landed in master 4
method org.pytorch.Module#setNumThreads(int numThreads)

(https://github.com/pytorch/pytorch/blob/master/android/pytorch_android/src/main/java/org/pytorch/Module.java#L57 1)
The latest android nightlies already include them: https://github.com/pytorch/pytorch/tree/master/android#nightly 2 (you might need gradle argument --refresh-dependencies if you already using them)
For your case when inference is slowing down UI thread - you can experiment with setting number of threads to 1 or 2, maybe depending on device num cores, smth like:
Module module = Module.load(moduleFileAbsoluteFilePath);
module.setNumThreads(1);

I think that should help with UI thread responsiveness, but check if inference time with this setting is still acceptable for your solution.
This is new functionality, please report if you find any issues with it.