predictor

package
v0.3.1-0...-08454e7 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: NCSA Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ElementTypeSliceToTensor

func ElementTypeSliceToTensor(data [][]ElementType, shape []int64) (*tf.Tensor, error)

func Float32SliceToTensor

func Float32SliceToTensor(data [][]float32, shape []int64) (*tf.Tensor, error)

func Float64SliceToTensor

func Float64SliceToTensor(data [][]float64, shape []int64) (*tf.Tensor, error)

func Int16SliceToTensor

func Int16SliceToTensor(data [][]int16, shape []int64) (*tf.Tensor, error)

func Int32SliceToTensor

func Int32SliceToTensor(data [][]int32, shape []int64) (*tf.Tensor, error)

func Int64SliceToTensor

func Int64SliceToTensor(data [][]int64, shape []int64) (*tf.Tensor, error)

func Int8SliceToTensor

func Int8SliceToTensor(data [][]int8, shape []int64) (*tf.Tensor, error)

func NewImageClassificationPredictor

func NewImageClassificationPredictor(model dlframework.ModelManifest, opts ...options.Option) (common.Predictor, error)

func NewImageEnhancementPredictor

func NewImageEnhancementPredictor(model dlframework.ModelManifest, opts ...options.Option) (common.Predictor, error)

func NewInstanceSegmentationPredictor

func NewInstanceSegmentationPredictor(model dlframework.ModelManifest, opts ...options.Option) (common.Predictor, error)

func NewObjectDetectionPredictor

func NewObjectDetectionPredictor(model dlframework.ModelManifest, opts ...options.Option) (common.Predictor, error)

func NewRawPredictor

func NewRawPredictor(model dlframework.ModelManifest, opts ...options.Option) (common.Predictor, error)

func NewSemanticSegmentationPredictor

func NewSemanticSegmentationPredictor(model dlframework.ModelManifest, opts ...options.Option) (common.Predictor, error)

func Uint16SliceToTensor

func Uint16SliceToTensor(data [][]uint16, shape []int64) (*tf.Tensor, error)

func Uint32SliceToTensor

func Uint32SliceToTensor(data [][]uint32, shape []int64) (*tf.Tensor, error)

func Uint64SliceToTensor

func Uint64SliceToTensor(data [][]uint64, shape []int64) (*tf.Tensor, error)

func Uint8SliceToTensor

func Uint8SliceToTensor(data [][]uint8, shape []int64) (*tf.Tensor, error)

Types

type Device

type Device struct {
	Name, Type       string
	MemoryLimitBytes int64
}

Device structure contains information about a device associated with a session, as returned by ListDevices()

func (Device) String

func (d Device) String() string

String describes d and implements fmt.Stringer.

type ElementType

type ElementType generic.Type

type Graph

type Graph = tf.Graph

type ImageClassificationPredictor

type ImageClassificationPredictor struct {
	*ImagePredictor
	// contains filtered or unexported fields
}

func (*ImageClassificationPredictor) Load

func (ImageClassificationPredictor) Modality

func (*ImageClassificationPredictor) Predict

func (p *ImageClassificationPredictor) Predict(ctx context.Context, data interface{}, opts ...options.Option) error

Predict ...

func (*ImageClassificationPredictor) ReadPredictedFeatures

func (p *ImageClassificationPredictor) ReadPredictedFeatures(ctx context.Context) ([]dlframework.Features, error)

ReadPredictedFeatures ...

type ImageEnhancementPredictor

type ImageEnhancementPredictor struct {
	*ImagePredictor
	// contains filtered or unexported fields
}

func (*ImageEnhancementPredictor) Load

func (ImageEnhancementPredictor) Modality

func (*ImageEnhancementPredictor) Predict

func (p *ImageEnhancementPredictor) Predict(ctx context.Context, data interface{}, opts ...options.Option) error

Predict ...

func (*ImageEnhancementPredictor) ReadPredictedFeatures

func (p *ImageEnhancementPredictor) ReadPredictedFeatures(ctx context.Context) ([]dlframework.Features, error)

ReadPredictedFeatures ...

type ImagePredictor

type ImagePredictor struct {
	common.ImagePredictor
	// contains filtered or unexported fields
}

func (*ImagePredictor) Close

func (p *ImagePredictor) Close() error

func (*ImagePredictor) Download

func (p *ImagePredictor) Download(ctx context.Context, model dlframework.ModelManifest, opts ...options.Option) error

Download ...

func (*ImagePredictor) GetInputLayerName

func (p *ImagePredictor) GetInputLayerName(reader io.Reader, layer string) (string, error)

func (*ImagePredictor) GetOutputLayerName

func (p *ImagePredictor) GetOutputLayerName(reader io.Reader, layer string) (string, error)

func (*ImagePredictor) GetOutputParameter

func (p *ImagePredictor) GetOutputParameter(key string) string

func (*ImagePredictor) Load

type InstanceSegmentationPredictor

type InstanceSegmentationPredictor struct {
	*ImagePredictor
	// contains filtered or unexported fields
}

func (*InstanceSegmentationPredictor) Load

func (InstanceSegmentationPredictor) Modality

func (*InstanceSegmentationPredictor) Predict

func (p *InstanceSegmentationPredictor) Predict(ctx context.Context, data interface{}, opts ...options.Option) error

Predict ...

func (*InstanceSegmentationPredictor) ReadPredictedFeatures

func (p *InstanceSegmentationPredictor) ReadPredictedFeatures(ctx context.Context) ([]dlframework.Features, error)

ReadPredictedFeatures ...

type ObjectDetectionPredictor

type ObjectDetectionPredictor struct {
	*ImagePredictor
	// contains filtered or unexported fields
}

func (*ObjectDetectionPredictor) Load

func (ObjectDetectionPredictor) Modality

func (*ObjectDetectionPredictor) Predict

func (p *ObjectDetectionPredictor) Predict(ctx context.Context, data interface{}, opts ...options.Option) error

Predict ...

func (*ObjectDetectionPredictor) ReadPredictedFeatures

func (p *ObjectDetectionPredictor) ReadPredictedFeatures(ctx context.Context) ([]dlframework.Features, error)

ReadPredictedFeatures ...

type Operation

type Operation = tf.Operation

type Output

type Output = tf.Output

type RawPredictor

type RawPredictor struct {
	common.RawPredictor
	// contains filtered or unexported fields
}

func (*RawPredictor) Close

func (p *RawPredictor) Close() error

func (*RawPredictor) Download

func (p *RawPredictor) Download(ctx context.Context, model dlframework.ModelManifest, opts ...options.Option) error

Download ...

func (*RawPredictor) Load

func (RawPredictor) Modality

func (p RawPredictor) Modality() (dlframework.Modality, error)

func (*RawPredictor) Predict

func (p *RawPredictor) Predict(ctx context.Context, data interface{}, opts ...options.Option) error

Predict ...

type SemanticSegmentationPredictor

type SemanticSegmentationPredictor struct {
	*ImagePredictor
	// contains filtered or unexported fields
}

func (*SemanticSegmentationPredictor) Load

func (SemanticSegmentationPredictor) Modality

func (*SemanticSegmentationPredictor) Predict

func (p *SemanticSegmentationPredictor) Predict(ctx context.Context, data interface{}, opts ...options.Option) error

Predict ...

func (*SemanticSegmentationPredictor) ReadPredictedFeatures

func (p *SemanticSegmentationPredictor) ReadPredictedFeatures(ctx context.Context) ([]dlframework.Features, error)

ReadPredictedFeatures ...

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session drives a TensorFlow graph computation.

When a Session is created with a given target, a new Session object is bound to the universe of resources specified by that target. Those resources are available to this session to perform computation described in the GraphDef. After creating the session with a graph, the caller uses the Run() API to perform the computation and potentially fetch outputs as Tensors. A Session allows concurrent calls to Run().

func NewSession

func NewSession(graph *Graph, options *SessionOptions) (*Session, error)

NewSession creates a new execution session with the associated graph. options may be nil to use the default options.

func (*Session) Close

func (s *Session) Close() error

Close a session. This contacts any other processes associated with this session, if applicable. Blocks until all previous calls to Run have returned.

func (*Session) ListDevices

func (s *Session) ListDevices() ([]Device, error)

ListDevices returns the list of devices associated with a Session.

func (*Session) Run

func (s *Session) Run(ctx context.Context, feeds map[Output]*Tensor, fetches []Output, targets []*Operation, runOpts *proto.RunOptions, graphPath string) ([]*Tensor, error)

type SessionOptions

type SessionOptions struct {
	// Target indicates the TensorFlow runtime to connect to.
	//
	// If 'target' is empty or unspecified, the local TensorFlow runtime
	// implementation will be used.  Otherwise, the TensorFlow engine
	// defined by 'target' will be used to perform all computations.
	//
	// "target" can be either a single entry or a comma separated list
	// of entries. Each entry is a resolvable address of one of the
	// following formats:
	//   local
	//   ip:port
	//   host:port
	//   ... other system-specific formats to identify tasks and jobs ...
	//
	// NOTE: at the moment 'local' maps to an in-process service-based
	// runtime.
	//
	// Upon creation, a single session affines itself to one of the
	// remote processes, with possible load balancing choices when the
	// "target" resolves to a list of possible processes.
	//
	// If the session disconnects from the remote process during its
	// lifetime, session calls may fail immediately.
	Target string

	// Config is a binary-serialized representation of the
	// tensorflow.ConfigProto protocol message
	// (https://www.tensorflow.org/code/tensorflow/core/protobuf/config.proto).
	Config []byte
}

SessionOptions contains configuration information for a session.

type Tensor

type Tensor = tf.Tensor

type Trace

type Trace struct {
	// contains filtered or unexported fields
}

func (*Trace) Publish

func (t *Trace) Publish(ctx context.Context, opts ...opentracing.StartSpanOption) error

Notes about start and end time from the NodeExecStats proto: For GPU, there is no difference between op_end_rel_micros and all_end_rel_micros. All are kernel times. For CPU, op_end_rel is the kernel time, while all_end_rel_micros includes some post-processing. Besides, currently, there is no way to measure the execution time of async ops accurately.

Jump to

Keyboard shortcuts

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