nnproto

package
v0.6.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package nnproto encodes CoreML NeuralNetwork models (specification version 1) as .mlmodel protobuf bytes. It provides the protobuf construction required to build ANE-executable models without external dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FFNReLU2

func FFNReLU2(d, f, seq int, w1, w2 []float32) ([]byte, error)

FFNReLU2 builds a Model computing out = W2·relu(W1·x)² over input [d, 1, seq] with argument validation.

Types

type Feature

type Feature struct {
	Name  string
	Shape []int64
}

Feature names a model input or output and specifies its shape.

type Layer

type Layer []byte

Layer is an encoded NeuralNetworkLayer message.

func Conv1x1

func Conv1x1(name, input, output string, inC, outC int, weights []float32) (Layer, error)

Conv1x1 encodes a 1x1 Convolution NeuralNetworkLayer with argument validation.

func Multiply

func Multiply(name string, inputs []string, output string) Layer

Multiply encodes an elementwise multiply NeuralNetworkLayer.

func ReLU

func ReLU(name, input, output string) Layer

ReLU encodes a ReLU activation NeuralNetworkLayer.

type Model

type Model struct {
	Inputs  []Feature
	Outputs []Feature
	Layers  []Layer
}

Model describes a CoreML NeuralNetwork model.

func (Model) Encode

func (m Model) Encode() ([]byte, error)

Encode serializes the Model into .mlmodel protobuf bytes with validation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL