Package-level declarations

Types

Link copied to clipboard
data class OnnxAttributeValue(val name: String, val ints: List<Long> = emptyList(), val floats: List<Float> = emptyList(), val strings: List<String> = emptyList(), val tensor: TensorProto? = null)
Link copied to clipboard
class OnnxBlobParseResult(val metadata: ModelMetadata, val modelInfo: ModelInfo?, val tensors: List<TensorInfo>, val reader: StreamingOnnxReader?)

Browser-specific ONNX parsing result for WASM JS.

Link copied to clipboard
data class OnnxGraphView(val nodes: List<OnnxNodeView>, val initializers: Map<String, OnnxTensorView>, val inputs: List<OnnxValueInfoView>, val outputs: List<OnnxValueInfoView>, val valueInfos: Map<String, OnnxValueInfoView>)

Minimal, proto-agnostic view of an ONNX graph. This keeps the importer independent of the generated proto surface while we wire in pbandk-generated classes.

Link copied to clipboard
data class OnnxLoadedModel<M : Message>(val proto: M, val rawBytes: ByteArray)

Holder for the parsed ONNX model alongside its serialized form.

Link copied to clipboard
class OnnxLoader<M : Message>(readBytes: suspend () -> ByteArray, decode: (ByteArray) -> M)

Minimal pbandk-backed ONNX loader.

Link copied to clipboard
data class OnnxModelMetadata(val irVersion: Long, val producerName: String?, val producerVersion: String?, val modelVersion: Long, val domain: String?, val docString: String?, val classNames: Map<Int, String>?, val numClasses: Int?, val description: String?, val author: String?, val license: String?, val task: String?, val rawMetadata: Map<String, String>)

Parsed model metadata from an ONNX file.

Link copied to clipboard

ONNX model parser extending BaseModelParser. Provides metadata-first parsing of ONNX model files using SKaiNET's ONNX I/O capabilities.

Link copied to clipboard
Link copied to clipboard
data class OnnxNodeView(val name: String, val opType: String, val inputs: List<String>, val outputs: List<String>, val attributes: Map<String, OnnxAttributeValue>)
Link copied to clipboard
data class OnnxTensorView(val name: String, val shape: List<Long>, val dtype: String, val proto: TensorProto)
Link copied to clipboard

Stub importer that will map an ONNX graph view to a ComputeGraph. The mapping logic will be filled in as operator support lands.

Link copied to clipboard
data class OnnxValueInfoView(val name: String, val shape: List<Int>?, val dtype: String?)
Link copied to clipboard

Utility for loading ONNX model initializers (weights) into SKaiNET Module parameters.

Link copied to clipboard

Streaming ONNX reader that parses metadata without loading tensor data.

Link copied to clipboard
data class StreamingOnnxTensorInfo(val name: String, val dims: List<Long>, val dataType: Int, val dataTypeName: String, val nElements: Long, val rawDataOffset: Long, val rawDataLength: Int, val estimatedBytes: Int, val hasTypedArrayData: Boolean)

Tensor metadata for streaming access.

Functions

Link copied to clipboard

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

Link copied to clipboard
suspend fun createOnnxRandomAccessSourceFromBlob(blob: Blob, preloadSize: Int = JsBlobRandomAccessSource.DEFAULT_PRELOAD_SIZE): JsBlobRandomAccessSource

Create a RandomAccessSource from a browser Blob or File.

suspend fun createOnnxRandomAccessSourceFromBlob(blob: Blob, preloadSize: Int = JsBlobRandomAccessSource.DEFAULT_PRELOAD_SIZE): JsBlobRandomAccessSource

Create a RandomAccessSource from a browser Blob or File.

Link copied to clipboard

Load tensor data asynchronously.

Load tensor data asynchronously by name.

Load tensor data asynchronously for a specific tensor.

Load tensor data asynchronously by name.

Load tensor data asynchronously for a specific tensor.

Link copied to clipboard
suspend fun OnnxModelParser.parseMetadataFromBlob(blob: Blob, preloadSize: Int = JsBlobRandomAccessSource.DEFAULT_PRELOAD_SIZE): ModelMetadata

Parse ONNX model metadata from a browser Blob or File.

Link copied to clipboard
suspend fun parseOnnxFromBlob(blob: Blob, preloadSize: Int = JsBlobRandomAccessSource.DEFAULT_PRELOAD_SIZE): OnnxBlobParseResult

Parse ONNX model from a browser Blob/File for WASM JS.

Link copied to clipboard

Utility to build a simplified graph view from a parsed ONNX model.

Link copied to clipboard

Convert an ONNX TensorProto into an SKaiNET tensor.

Convenience to decode through the OnnxTensorView wrapper.