pub struct ExportedModel {
pub function: ExternFn,
pub weights: Weights,
/* private fields */
}Expand description
Fields§
§function: ExternFnThe exported function.
weights: WeightsThe parameters, named by their path in the parameter tree.
Implementations§
Source§impl ExportedModel
impl ExportedModel
Sourcepub fn load(dir: impl AsRef<Path>) -> Result<Self, ModelError>
pub fn load(dir: impl AsRef<Path>) -> Result<Self, ModelError>
Reads the directory written by ruxla.export_model.
§Errors
Returns an error if a file cannot be read or does not match the others.
Sourcepub fn param_names(&self) -> &[String]
pub fn param_names(&self) -> &[String]
The names of the parameters, in the order the function takes them.
Sourcepub fn params<T: Element>(&self) -> Result<Vec<Array<Native, T>>, WeightsError>
pub fn params<T: Element>(&self) -> Result<Vec<Array<Native, T>>, WeightsError>
The parameters in the order the function takes them, as native arrays
of type T.
§Errors
Returns an error if a parameter has another type.
Sourcepub fn call<T: Element, A: Tree<Trace>, O: Tree<Native>>(
&self,
params: &[Array<Trace, T>],
args: &A,
like: &O,
) -> O::On<Trace>
pub fn call<T: Element, A: Tree<Trace>, O: Tree<Native>>( &self, params: &[Array<Trace, T>], args: &A, like: &O, ) -> O::On<Trace>
Calls the function on params (in the order of
ExportedModel::param_names) and the leaves of args, inside a
trace, returning the outputs in the structure of like (see
ExternFn::call).
§Panics
Panics if the arguments or like do not have the function’s types.
Trait Implementations§
Source§impl Clone for ExportedModel
impl Clone for ExportedModel
Auto Trait Implementations§
impl Freeze for ExportedModel
impl RefUnwindSafe for ExportedModel
impl Send for ExportedModel
impl Sync for ExportedModel
impl Unpin for ExportedModel
impl UnsafeUnpin for ExportedModel
impl UnwindSafe for ExportedModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more