[Python] tensorflow - predict single row of booleans with disable_eager_execution

Discussão em 'Python' iniciado por Stack, Novembro 22, 2024.

  1. Stack

    Stack Membro Participativo

    i got a python anaconda code thats running ok, i tried to add tensorflow to my other regular python project, but it fails with the error:

    tf.data.Dataset only supports Python-style iteration in eager mode or within tf.function.

    im trying to run the code with: tf.compat.v1.disable_eager_execution() - because i need it to run fast

    my code:

    booleanList = [...]

    int_list = list(map(lambda value: 1 if value is True else 0, booleanList.values()))

    y_hat = model.predict(int_list, batch_size=1)


    but it fails in the last row. tried to use: tf.convert_to_tensor(int_list), tf.constant([int_list])

    tried to use also: tf.data.Dataset.from_tensor_slices

    but i cant seem to get it right. wasted a few hours on trying many combination .

    plz help

    Continue reading...

Compartilhe esta Página