This code block will not be executed
See original GitHub issueSystem Info
python 3.9
Who can help?
No response
Information
- The official example scripts
- My own modified scripts
Tasks
- An officially supported task in the
examples
folder (such as GLUE/SQuAD, …) - My own task or dataset (give details below)
Reproduction
` combined_attention_mask = None
if attention_mask is not None and combined_attention_mask is not None:
# [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len]
combined_attention_mask = combined_attention_mask + _expand_mask(
attention_mask, inputs_embeds.dtype, tgt_len=input_shape[-1]
)`
Expected behavior
The combined_attention_mask is set to None, so the if code block below it will never be executed because it will check combined_attention_mask is not None.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Does 'finally' always execute in Python? - Stack Overflow
No matter what happened previously, the final-block is executed once the code block is complete and any raised exceptions handled.
Read more >Is finally block always get executed in Java? - Tutorialspoint
Yes, the finally block is always get executed unless there is an abnormal program termination either resulting from a JVM crash or from...
Read more >Blocks and Statements - Oracle Help Center
The sequence of execution of a program is controlled by statements, which are executed for their effect and do not have values.
Read more >When Finally Block is not executed in Java - Scientech Easy
Learn possibility when finally block is not executed in Java, when finally block gets executed, statements after return in finally block is not...
Read more >try-finally - C# Reference - Microsoft Learn
If the exception is not caught, execution of the finally block depends on whether the operating system chooses to trigger an exception ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @AlfredQin, thanks for spotting that. The
combined_attention_mask
was probably taken from another model, which is not relevant for DETR.Feel free to open a PR to remove that code block!
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.