1

I have encountered a weird problem when transforming a usual seq2seq code into eager execution mode.

What I changed is very simple that after call enable_eager_execution(), I changed the following input

def get_inputs():
    inputs = tf.placeholder(tf.int32, [None, None], name='inputs')
    targets = tf.placeholder(tf.int32, [None, None], name='targets')
    learning_rate = tf.placeholder(tf.float32, name='learning_rate')

    target_sequence_length = tf.placeholder(tf.int32, (None,), name='target_sequence_length')
    max_target_sequence_length = tf.reduce_max(target_sequence_length, name='max_target_len')
    source_sequence_length = tf.placeholder(tf.int32, (None,), name='source_sequence_length')

    return inputs, targets, learning_rate, target_sequence_length, max_target_sequence_length, source_sequence_length

input_data, targets, lr, target_sequence_length, max_target_sequence_length, source_sequence_length = get_inputs()

to directly assigning values from numpy array.

Then I called

training_decoder_output, _,_ = tf.contrib.seq2seq.dynamic_decode(training_decoder,impute_finished=True,maximum_iterations=max_target_sequence_length)

where training_decoder is simply taking the encoder_state and a training helper (no error reports during the training_decoder definition step) and an error report says “ValueError: The inequality of unknown TensorShapes is undefined."

Can anyone helps me with it ?

Jack2019
  • 275
  • 2
  • 10

0 Answers0