vendredi 2 février 2018

Duplicate Tensorflow normal distribution objects

Given the following code:

import tensorflow as tf

normal_dist = tf.contrib.distributions.Normal(.5, 1.3)
foo = normal_dist.sample()
bar = normal_dist.sample()
baz = foo + bar

sess = tf.Session()
sess.run(tf.global_variables_initializer())
writer = tf.summary.FileWriter("./logs", graph=tf.get_default_graph())

the normal distribution object is duplicated twice for a total of three objects which is bad, because as you can see they are all the same distribution (same mean,std).

Is there a way to not duplicate? Or a way to optimize? Looking for best practices.

three normal distributions




Aucun commentaire:

Enregistrer un commentaire