Struct tch::TrainableCModule[][src]

pub struct TrainableCModule { /* fields omitted */ }

The trainable version of a jit PyTorch module.

These modules can be created via the TorchScript python api.

Implementations

impl TrainableCModule[src]

pub fn load<T: AsRef<Path>>(
    module_path: T,
    path: Path<'_>
) -> Result<Self, TchError>
[src]

Loads a PyTorch saved JIT module from a file.

This function also adds the tensors from the JIT module to the VarStore path passed as argument so that the module can be trained.

pub fn load_data<T: Read>(
    data: &mut T,
    path: Path<'_>
) -> Result<Self, TchError>
[src]

Loads a PyTorch saved JIT model from a read instance.

This function also adds the tensors from the JIT module to the VarStore path passed as argument so that the module can be trained.

pub fn save<T: AsRef<Path>>(&self, module_path: T) -> Result<(), TchError>[src]

pub fn f_set_train(&mut self) -> Result<(), TchError>[src]

Switches the module to training mode.

pub fn set_train(&mut self)[src]

Switches the module to training mode.

pub fn f_set_eval(&mut self) -> Result<(), TchError>[src]

Switches the module to evaluation mode.

pub fn set_eval(&mut self)[src]

Switches the module to evaluation mode.

Trait Implementations

impl Debug for TrainableCModule[src]

impl ModuleT for TrainableCModule[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,