copyWithoutDelegates method

InterpreterOptions copyWithoutDelegates()

Creates equivalent options without hardware delegates.

Used when interpreter creation cannot apply a configured delegate. CPU fallback must retain thread tuning and custom-op registrations rather than retrying with an empty options object.

Implementation

InterpreterOptions copyWithoutDelegates() {
  checkState(!_deleted, message: 'InterpreterOptions already deleted.');
  final copy = InterpreterOptions();
  final threads = _threads;
  if (threads != null) copy.threads = threads;
  if (_hasMediaPipeCustomOps) copy.addMediaPipeCustomOps();
  for (final customOp in _customOps) {
    copy.addCustomOp(
      name: customOp.name,
      registration: customOp.registration,
      minVersion: customOp.minVersion,
      maxVersion: customOp.maxVersion,
    );
  }
  return copy;
}