XnnpackOptions.fromMap constructor

XnnpackOptions.fromMap(
  1. Map<String, String> map
)

Creates XnnpackOptions from a provider options map.

If intra_op_num_threads is not present in the map, automatically sets it to Platform.numberOfProcessors for best performance.

Implementation

factory XnnpackOptions.fromMap(Map<String, String> map) {
  final threads = map['intra_op_num_threads'];
  if (threads != null) {
    return XnnpackOptions(numThreads: int.tryParse(threads) ?? 0);
  }
  // Auto-configure: use all available cores
  return XnnpackOptions(numThreads: Platform.numberOfProcessors);
}