createOnnxRandomAccessSource

Android implementation of createOnnxRandomAccessSource.

Returns null on Android as file access patterns differ. Callers should fall back to standard ONNX loading.

Future: Could implement using Android-specific file APIs.

Platform-specific factory for creating RandomAccessSource instances for ONNX files.

Returns null on platforms that don't support random file access, allowing callers to fall back to legacy sequential loading.

Supported platforms:

  • JVM: Uses FileChannel for efficient random access

  • JS/Native: Returns null (use legacy OnnxLoader instead)

Return

A RandomAccessSource, or null if not supported on this platform

Parameters

filePath

Path to the file

JS implementation of createOnnxRandomAccessSource.

Returns null for path-based access since file paths don't work in browsers. Use createOnnxRandomAccessSourceFromBlob for browser file input.

JVM implementation of createOnnxRandomAccessSource.

Uses JvmRandomAccessSource backed by FileChannel for efficient random access to ONNX files.

Native implementation of createOnnxRandomAccessSource.

Returns null as native random file access is not yet implemented. Callers should fall back to legacy OnnxLoader which loads the full file.

Future: Could implement using POSIX pread() for efficient random access.

WASM JS implementation of createOnnxRandomAccessSource.

Returns null for path-based access since file paths don't work in browsers. Use createOnnxRandomAccessSourceFromBlob for browser file input.