From e15c638bfb8f3ae5124c25af3633896c1a82e373 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Fri, 25 Feb 2022 11:02:21 -0600 Subject: Old variable autoencoder that I wrote 6 weeks ago --- src/vae.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/vae.rs diff --git a/src/vae.rs b/src/vae.rs new file mode 100644 index 0000000..2fc6ae8 --- /dev/null +++ b/src/vae.rs @@ -0,0 +1,13 @@ +use tch::nn::{Module, OptimizerConfig}; +use tch::{kind, nn, Device, Tensor}; + +pub fn vae(vs: &nn::Path) -> impl Module { + nn::seq() + .add(nn::linear(vs, 100, 50, Default::default())) + .add_fn(|xs| xs.relu()) + .add(nn::linear(vs, 50, 10, Default::default())) + .add_fn(|xs| xs.relu()) + .add(nn::linear(vs, 10, 50, Default::default())) + .add_fn(|xs| xs.relu()) + .add(nn::linear(vs, 50, 100, Default::default())) +} -- cgit v1.2.3-70-g09d2