torch.get_num_interop_threads
function get_num_interop_threads(): numberReturns the number of threads used for inter-op parallelism.
Inter-op parallelism parallelizes independent operations across multiple threads. This allows PyTorch to run multiple operations concurrently when the computation graph allows it.
JavaScript lacks true multi-threading. Use async/await and Web Workers for concurrent operations at a higher level.
Returns
number– Always 1 in torch.js (no multi-threading in JavaScript)Examples
// Get inter-op thread count
const threads = torch.get_num_interop_threads();
// torch.js: always 1 (single-threaded)See Also
- PyTorch torch.get_num_interop_threads()
- get_num_threads - Get intra-op thread count