import tensorflow as tf

    pre_sigma = tf.get_variable(name + "_standard_deviation",
                                         shape,
                                         initializer=std_init,
                                         dtype=dtype)

    standard_deviation = tf.nn.softplus(pre_sigma) + 1e-5

    # The famous reparametrization formula for the factorized Gaussian
    noise = tf.random_normal([num_samples] + shape, 0.0, 1.0, dtype)
    weights = mean + standard_deviation * noise
