jit

package
v0.0.0-...-8e0162c Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JitModule

type JitModule struct {
	// We use an unsafe pointer so there are no weird C types in the struct.
	T *unsafe.Pointer
}

A container for a torch script module in C++.

func Load

func Load(path string, device torch.Device) (JitModule, error)

Load the trace from the given path on the filesystem. @param path A path to a model trace on the filesystem. @returns A tuple of: - The tensor that was loaded (nil if an error occurred,) and - An error that may have occurred (nil if the operation succeeds.)

func (JitModule) CastTo

func (module JitModule) CastTo(dtype torch.Dtype) JitModule

Cast the model's parameters to the given data-type in-place.

func (JitModule) CopyTo

func (module JitModule) CopyTo(device torch.Device) JitModule

Copy the model's parameters to the given compute accelerator in-place.

func (JitModule) Eval

func (module JitModule) Eval() JitModule

Set the module to evaluation (e.g., inference) mode.

func (JitModule) Forward

func (module JitModule) Forward(inputs []torch.IValue) torch.IValue

Forward pass through the module. @param inputs A list of IValue structures to propagate. @returns An IValue representation of the output from the module.

func (JitModule) IsTraining

func (module JitModule) IsTraining() bool

Return true if training features are enabled for the module, false otherwise.

func (JitModule) Save

func (module JitModule) Save(path string) error

Save the module to the given path. @param path A valid path on the file-system to save the module data to.

func (JitModule) String

func (module JitModule) String() string

Convert the module to a human-readable string representation.

func (JitModule) Train

func (module JitModule) Train(mode bool) JitModule

Enable/disable training features for the module.

Jump to

Keyboard shortcuts

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