In the following example I have a random row tensor r
(which for the sake of the example is just a simple tf.random_normal
but it could be a complicated graph instead whose value is random).
It seems like that in TensorFlow the tf.tile
operation is run only after the value of r
is computed, indeed all the rows of the tiled tensor t
are the same. Is there a way to tile a tensor without loosing the randomness of each row?
import tensorflow as tf
r = tf.random_normal(shape=[1, 2])
t = tf.tile(r, tf.pack([3, 1]), name=None)
session = tf.Session()
print(session.run(t))
session.close()
Result:
[[ 0.29335016 0.11843499]
[ 0.29335016 0.11843499]
[ 0.29335016 0.11843499]]
Aucun commentaire:
Enregistrer un commentaire