basic implementation of variational autoencoder, sampling layer samples once