Struct nnnoiseless::RnnModel

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

An RnnModel contains all the model parameters for the denoising algorithm. nnnoiseless has a built-in model that should work for most purposes, but if you have specific needs then you might benefit from training a custom model. Scripts for model training are available as part of RNNoise; once the model is trained, you can load it here.

Implementations§

Reads an RnnModel from an array of bytes, in the format produced by the nnnoiseless training scripts.

Reads an RnnModel from a static array of bytes, in the format produced by the nnnoiseless training scripts.

This differs from RnnModel::from_bytes in that the returned model doesn’t need to allocate its own byte buffers; it will just store references to the provided bytes array.

For example, if you have your neural network weights available at compile-time then the following code will embed them into your binary and initialize a model without allocation:

let weight_data: &'static [u8] = include_bytes!("/path/to/model/weights.rnn");
let model = RnnModel::from_static_bytes(weight_data).expect("Corrupted model file");

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a 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.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.