lundi 11 juin 2018

How can I feed a random generated integer to the “tf.contrib.image.translate” function in TensorFlow?

I have difficulties to understand, how I can feed a random generated integer to the “tf.contrib.image.translate” function in TensorFlow (graph), I tried to following:

horizontal = tf.random_uniform(shape = [1], minval = -5, maxval = 5, dtype = tf.int32)
vertical = tf.random_uniform(shape = [1], minval = -7, maxval =7, dtype = tf.int32)
image_op = tf.contrib.image.translate(image_op, [horizontal, vertical])

However, this gives me an error saying, that I cannot feed an tensor (output from the tf.random_uniform function) to the image.translation function. Then I tried to cast the tensor to an integer - see the following code - but this didn’t work either:

horizontal = tf.to_int32(tf.random_uniform(shape = [1], minval = -5, maxval = 5, dtype = tf.int32))

Can anyone help me to generate a uniform random integer in the graph of TensorFlow?

Thanks a lot for any help.




Aucun commentaire:

Enregistrer un commentaire