mardi 24 janvier 2017

how to generate random shuffled number in tensorflow

I want to generate numbers from 0 to a specific number and then randomly shuffle those numbers. I get some value from a tensor total = tf.Variable(BCIsize[0]+BCRsize[0]+BCOsize[0], dtype = tf.int32). For example if the value of total is 20 I want to generate numbers from 0 to 19.

I tried to generate using reqnum= tf.random_uniform([1,total],minval=0,maxval=total,tf.int32) but it Tensor("random_uniform:0", shape=(1, ?), dtype=int32).

I need to generate equal numbers and then shuffle with the value that comes as 'total' variable. I expect output randomly something like [8,14,1,3,5,11,6,9,10,19,12,13,2,15,7,16,17,4,18]




Aucun commentaire:

Enregistrer un commentaire