Struct tch::CModule

source ·
pub struct CModule { /* private fields */ }
Expand description

A jit PyTorch module.

These modules can be created via the TorchScript python api.

Implementations

Loads a PyTorch saved JIT model from a file.

Loads a PyTorch saved JIT model from a file onto the given device.

This function loads the model directly on the specified device, which means it also allows loading a GPU model on the CPU without having a CUDA enabled GPU.

Loads a PyTorch saved JIT model from a read instance.

Loads a PyTorch saved JIT model from a read instance.

This function loads the model directly on the specified device, which means it also allows loading a GPU model on the CPU without having a CUDA enabled GPU.

Performs the forward pass for a model on some specified tensor inputs.

Performs the forward pass for a model on some specified ivalue inputs.

Runs a specified entry point for a model on some given tensor inputs.

Runs a specified entry point for a model on some given ivalue inputs.

Create a specified custom JIT class object with the given class name, eg: __torch__.foo.Bar

Switches the module to evaluation mode.

Switches the module to evaluation mode.

Switches the module to training mode.

Switches the module to training mode.

Saves a module to a given path.

Loads some named tensors from a module

Create a new module by tracing the application of the specified function on the given inputs.

Trait Implementations

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.