When I running the following code in model.fit mode, I get error:
ValueError: ‘context_vec’ has shape (None, 512) before the loop, but shape (None, None) after one iteration. Use tf.autograph.experimental.set_loop_options to set shape invariants.
But I check the ‘context_vec’ shape while loop using context_vec.shape, I can’t see any change of shape;
I also try to us [tf.autograph.experimental.set_loop_options] , but error occurs,
Code:
mel_outputs, attn_scores, stop_outputs = [], [], []

    for t in range(0, steps, 2):
       # tf.autograph.experimental.set_loop_options(shape_invariants=[(context_vec,tf.TensorShape([None,None]))])  # Try to set options like this, but no work and also error.

        prenet_in = m[:, :, t - 1] if t > 0 else go_frame
       
        mel_frames, scores, hidden_states, cell_states, context_vec, stop_tokens = self.decoder(encoder_seq, encoder_seq_proj, prenet_in,
        hidden_states, cell_states, context_vec, t, x)
        mel_outputs.append(mel_frames)
        attn_scores.append(scores)

        stop_outputs.extend([stop_tokens] * 2)

Anyone can help me about it? How to set shape_invariants correctly under model.fit with keras?