load static method

void load(
  1. String? path, {
  2. int threads = 4,
  3. bool int8Inputs = true,
  4. bool attention = true,
})

Enables the kernels: those the package's build hook compiled, or with path the library there (for kernels built outside the package). threads native threads share each product; int8Inputs selects the sdot path; attention moves attention to C (see nativeAttention).

Implementation

static void load(
  String? path, {
  int threads = 4,
  bool int8Inputs = true,
  bool attention = true,
}) {
  if (path == null) {
    if (!isAvailable) {
      throw StateError(
        'the native kernels are not built for this platform '
        '(${Abi.current()})',
      );
    }
  } else if (Platform.isAndroid) {
    _openGlobal(path);
  } else {
    DynamicLibrary.open(path);
  }
  _instance = NativeKernels._(threads, int8Inputs, attention);
}