There are three heterogeneous networks. At the end of the processing, I need to reconstruct the final positive and negative samples in tensor. I need to shuffle them. I use the "tf.random_shuffle" method, error hint: No gradient defined for operation'Random Shuffle'. But I need gradients. If I don't use the "tf.random_shuffle" method, I want to shuffle them artificially, how do I operate them?
Now, I use the " tf.map_fn " method to simply alternate positive and negative combinations, one positive and one negative, and then one positive and one negative, and so on. But this is still a regular combination of samples, and how to shuffle the samples?
Here's a workaround:
tf.gather(batch, tf.random.shuffle(tf.range(tf.shape(batch)[0])))
[https://github.com/tensorflow/tensorflow/issues/6269#issuecomment-465850464][1]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With