predict

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2018 License: NCSA Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func NewTensor added in v0.2.18

func NewTensor(ctx context.Context, data [][]float32, shape []int64) (*tf.Tensor, error)

Types

type Graph added in v0.2.18

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

type ImagePredictor

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

func (*ImagePredictor) Close

func (p *ImagePredictor) Close() error

func (ImagePredictor) GetInputLayerName added in v0.2.18

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

func (ImagePredictor) GetOutputLayerName added in v0.2.18

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

func (*ImagePredictor) GetPreprocessOptions added in v0.2.18

func (p *ImagePredictor) GetPreprocessOptions(ctx context.Context) (common.PreprocessOptions, error)

func (*ImagePredictor) Load added in v0.2.15

func (*ImagePredictor) Predict

func (p *ImagePredictor) Predict(ctx context.Context, data [][]float32, opts ...options.Option) ([]dlframework.Features, error)

func (*ImagePredictor) Reset added in v0.2.18

func (p *ImagePredictor) Reset(ctx context.Context) error

type Operation added in v0.2.18

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

Operation that has been added to the graph.

type PartialRun added in v0.2.18

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

PartialRun enables incremental evaluation of graphs.

PartialRun allows the caller to pause the evaluation of a graph, run arbitrary code that depends on the intermediate computation of the graph, and then resume graph execution. The results of the arbitrary code can be fed into the graph when resuming execution. In contrast, Session.Run executes the graph to compute the requested fetches using the provided feeds and discards all intermediate state (e.g., value of intermediate tensors) when it returns.

For example, consider a graph for unsupervised training of a neural network model. PartialRun can be used to pause execution after the forward pass of the network, let the caller actuate the output (e.g., play a game, actuate a robot etc.), determine the error/loss and then feed this calculated loss when resuming the backward pass of the graph.

func (*PartialRun) Run added in v0.2.18

func (pr *PartialRun) Run(feeds map[tf.Output]*tf.Tensor, fetches []tf.Output, targets []*tf.Operation) ([]*tf.Tensor, error)

Run resumes execution of the graph to compute the requested fetches and targets with the provided feeds.

type Session added in v0.2.18

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 added in v0.2.18

func NewSession(graph0 *tf.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 added in v0.2.18

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) NewPartialRun added in v0.2.18

func (s *Session) NewPartialRun(feeds, fetches []tf.Output, targets []*tf.Operation) (*PartialRun, error)

NewPartialRun sets up the graph for incremental evaluation.

All values of feeds, fetches and targets that may be provided to Run calls on the returned PartialRun need to be provided to NewPartialRun.

See documentation for the PartialRun type.

func (*Session) Run added in v0.2.18

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

Run the graph with the associated session starting with the supplied feeds to compute the value of the requested fetches. Runs, but does not return Tensors for operations specified in targets.

On success, returns the fetched Tensors in the same order as supplied in the fetches argument. If fetches is set to nil, the returned Tensor fetches is empty.

type SessionOptions added in v0.2.18

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 added in v0.2.18

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

Tensor holds a multi-dimensional array of elements of a single data type.

type Trace added in v0.2.18

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

func NewTrace added in v0.2.18

func NewTrace(data *proto.StepStats) (*Trace, error)

func (*Trace) Publish added in v0.2.18

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

Jump to

Keyboard shortcuts

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