pub fn encode<T: FloatExt, S: Data<Elem = T>, D: Dimension, B: AutodiffBackend<FloatElem = T>>(
device: &B::Device,
data: ArrayBase<S, D>,
fourier_features: NonZeroUsize,
fourier_scale: Positive<f64>,
num_blocks: NonZeroUsize,
learning_rate: Positive<f64>,
num_epochs: usize,
mini_batch_size: Option<NonZeroUsize>,
seed: u64,
) -> Result<Array<u8, Ix1>, FourierNetworkCodecError>
Expand description
Encodes the data
by training a fourier feature neural network.
The fourier_features
are randomly sampled from a normal distribution with
zero mean and fourier_scale
standard deviation.
The neural network consists of num_blocks
blocks.
The network is trained for num_epochs
using the learning_rate
and mini-batches of mini_batch_size
if mini-batching is enabled.
All random numbers are generated using the provided seed
.
ยงErrors
Errors with
FourierNetworkCodecError::NonFiniteData
if any data element is non-finite (infinite or NaN)FourierNetworkCodecError::NeuralNetworkError
if an error occurs during the neural network computation