tflitecpu

package
v0.3.0-rc0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: AGPL-3.0 Imports: 13 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, input map[string]interface{}) (map[string]interface{}, 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 {
	resource.TriviallyValidateConfig
	// 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) Walk added in v0.2.36

func (cfg *TFLiteConfig) Walk(visitor utils.Visitor) (interface{}, error)

Walk implements the Walker interface and correctly replaces model and label paths.

Jump to

Keyboard shortcuts

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