Struct tch::jit::CModule [−][src]
A jit PyTorch module.
These modules can be created via the TorchScript python api.
Implementations
impl CModule
[src]
pub fn load<T: AsRef<Path>>(path: T) -> Result<CModule, TchError>
[src]
Loads a PyTorch saved JIT model from a file.
pub fn load_on_device<T: AsRef<Path>>(
path: T,
device: Device
) -> Result<CModule, TchError>
[src]
path: T,
device: Device
) -> Result<CModule, TchError>
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.
pub fn load_data<T: Read>(f: &mut T) -> Result<CModule, TchError>
[src]
Loads a PyTorch saved JIT model from a read instance.
pub fn load_data_on_device<T: Read>(
f: &mut T,
device: Device
) -> Result<CModule, TchError>
[src]
f: &mut T,
device: Device
) -> Result<CModule, TchError>
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.
pub fn forward_ts<T: Borrow<Tensor>>(
&self,
ts: &[T]
) -> Result<Tensor, TchError>
[src]
&self,
ts: &[T]
) -> Result<Tensor, TchError>
Performs the forward pass for a model on some specified tensor inputs.
pub fn forward_is<T: Borrow<IValue>>(
&self,
ts: &[T]
) -> Result<IValue, TchError>
[src]
&self,
ts: &[T]
) -> Result<IValue, TchError>
Performs the forward pass for a model on some specified ivalue inputs.
pub fn method_ts<T: Borrow<Tensor>>(
&self,
method_name: &str,
ts: &[T]
) -> Result<Tensor, TchError>
[src]
&self,
method_name: &str,
ts: &[T]
) -> Result<Tensor, TchError>
Runs a specified entry point for a model on some given tensor inputs.
pub fn method_is<T: Borrow<IValue>>(
&self,
method_name: &str,
ts: &[T]
) -> Result<IValue, TchError>
[src]
&self,
method_name: &str,
ts: &[T]
) -> Result<IValue, TchError>
Runs a specified entry point for a model on some given ivalue inputs.
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.
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 to(&mut self, device: Device, kind: Kind, non_blocking: bool)
[src]
pub fn save<T: AsRef<Path>>(&self, path: T) -> Result<(), TchError>
[src]
Saves a module to a given path.
pub fn named_parameters(&self) -> Result<Vec<(String, Tensor)>, TchError>
[src]
Loads some named tensors from a module
pub fn create_by_tracing<F>(
modl_name: &str,
fn_name: &str,
inputs: &[Tensor],
closure: &mut F
) -> Result<CModule, TchError> where
F: FnMut(&[Tensor]) -> Vec<Tensor>,
[src]
modl_name: &str,
fn_name: &str,
inputs: &[Tensor],
closure: &mut F
) -> Result<CModule, TchError> where
F: FnMut(&[Tensor]) -> Vec<Tensor>,
Create a new module by tracing the application of the specified function on the given inputs.
Trait Implementations
impl Debug for CModule
[src]
impl Drop for CModule
[src]
impl Module for CModule
[src]
impl Send for CModule
[src]
impl Sync for CModule
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,