tflitecpu

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package tflitecpu runs tflite model files on the host's CPU, as an implementation the ML model service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTFLiteCPUModel

func NewTFLiteCPUModel(ctx context.Context, params *TFLiteConfig, name resource.Name) (mlmodel.Service, error)

NewTFLiteCPUModel is a constructor that builds a tflite cpu implementation of the MLMS.

Types

type Model

type Model struct {
	resource.Named
	resource.AlwaysRebuild
	resource.TriviallyCloseable
	// contains filtered or unexported fields
}

Model is a struct that implements the TensorflowLite CPU implementation of the MLMS. It includes the configured parameters, model struct, and associated metadata.

func (*Model) Infer

func (m *Model) Infer(ctx context.Context, tensors ml.Tensors) (ml.Tensors, error)

Infer takes the input map and uses the inference package to return the result from the tflite cpu model as a map.

func (*Model) Metadata

func (m *Model) Metadata(ctx context.Context) (mlmodel.MLMetadata, error)

Metadata reads the metadata from your tflite cpu model into the metadata struct that we use for the mlmodel service.

type TFLiteConfig

type TFLiteConfig struct {
	// this should come from the attributes of the tflite_cpu instance of the MLMS
	ModelPath  string `json:"model_path"`
	NumThreads int    `json:"num_threads"`
	LabelPath  string `json:"label_path"`
}

TFLiteConfig contains the parameters specific to a tflite_cpu implementation of the MLMS (machine learning model service).

func (*TFLiteConfig) Validate added in v0.23.0

func (conf *TFLiteConfig) Validate(validatePath string) ([]string, error)

Validate will check if the config is valid.

Jump to

Keyboard shortcuts

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