I have a for loop with excerpts of try-except blocks referring to https://machinetalk.org/2019/03/29/neural-machine-translation-with-attention-mechanism/?unapproved=67&moderation-hash=ea8e5dcb97c8236f68291788fbd746a7#comment-67:-
for e in range(NUM_EPOCHS):
    en_initial_states = encoder.init_states(BATCH_SIZE)
    for batch, (source_seq, target_seq_in, target_seq_out) in enumerate(dataset.take(-1)):
        loss = train_step(source_seq, target_seq_in,
                          target_seq_out, en_initial_states)
        if batch % 100 == 0:
                print('Epoch {} Batch {} Loss {:.4f}'.format(
                    e + 1, batch, loss.numpy()))
    try:
        test_target_text,net_words = predict()
    except Exception:
      continue
    if loss <=0.0001:
       break
I want to come out of the loop and not execute the try block and leave everything and simply come out of both, the inner and outer loops as well as the entire try-except block. I don't know what is going wrong, as using the if condition in the inner/outer loop blocks doesn't work.
 
    