tfmodel

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dictionary added in v0.13.0

func Dictionary(session *tf.Session, graph *tf.Graph, signature *domain.Signature) (*common.Dictionary, error)

Dictionary uses domain.Signature to determine which inputs should have an encoding lookup from the Tensorflow graph. TODO pull out *domain.Signature, just use a slice of something.

func DiscoverDictionary added in v0.13.0

func DiscoverDictionary(session *tf.Session, graph *tf.Graph, layers []string) (*common.Dictionary, error)

DiscoverDictionary extracts vocabulary from from best guessed layer and operations.

func Export

func Export(session *tf.Session, graph *tf.Graph, name string) (interface{}, error)

Export attempts to pull the embedded lookup table from the Tensorflow graph.

func MatchOperation

func MatchOperation(graph *tf.Graph, name string) string

MatchOperation will attempt to locate an LookupTableExportV2 operation that is associated to the provided name.

func RunExport

func RunExport(session *tf.Session, exportOp *tf.Operation) (interface{}, error)

RunExport runs export

Types

type Runner added in v0.13.0

type Runner interface {
	Evaluate(context.Context, []interface{}) ([]interface{}, error)
}

type Service added in v0.13.0

type Service struct {

	// Should point to service.Service.ReloadOK
	ReloadOK *int32
	// contains filtered or unexported fields
}

Service is responsible for being the entrypoint for all Tensorflow model runs. It manages loading and reloading the model files, as well as providing metadata based off the model and configuration.

func NewService added in v0.13.0

func NewService(cfg *config.Model, fs afs.Service, metrics *gmetric.Service, sema *semaphore.Weighted,
	maxEvaluatorWait time.Duration) *Service

NewService creates an unprepared Service. This service isn't ready until ReloadIfNeeded() is called.

func (*Service) Close added in v0.13.0

func (s *Service) Close() error

func (*Service) Dictionary added in v0.13.0

func (s *Service) Dictionary() *common.Dictionary

func (*Service) Inputs added in v0.13.0

func (s *Service) Inputs() map[string]*domain.Input

func (*Service) Predict added in v0.13.0

func (s *Service) Predict(ctx context.Context, params []interface{}) ([]interface{}, error)

func (*Service) ReloadIfNeeded added in v0.13.0

func (s *Service) ReloadIfNeeded(ctx context.Context) error

Assumes that after the initial reload, there is no significant changes to the inputs and outputs from reloading the model. If a model reload results in changes to inputs or outputs, the resulting behavior is undefined. TODO restructure to easily test configuration signature merging.

func (*Service) Signature added in v0.13.0

func (s *Service) Signature() *domain.Signature

func (*Service) Stats added in v0.13.0

func (s *Service) Stats(r map[string]interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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