samedi 4 janvier 2020

Tensorflow: How to chose a random string from a given list of strings using tensorflow operation

I have a list of strings like below & I want to do tensorflow operation. I want to pick a string randomly from list_2 for a given input string from list_1.

My function looks like this;

list_1 = ['hello', 'how are you?', 'this is just a test']
list_2 = ['helloooo', 'thanks', 'okay']

def test(string):
    if string in list_1:
        print("list: ", random.choice(list_2)) 
test("hello") 

How do I achieve this using tensorflow? because I dont find anything tf.random.choice in tensorflow.




Aucun commentaire:

Enregistrer un commentaire