tml-epfl / understanding-fast-adv-training

Understanding and Improving Fast Adversarial Training [NeurIPS 2020]
https://arxiv.org/abs/2007.02617
94 stars 12 forks source link

What is the `utils.nullcontext()` #6

Closed CharlesJames13586 closed 2 years ago

CharlesJames13586 commented 2 years ago

The utils.nullcontext() appears in line 257 of the script train.py. But I can't find the definition. What is this? I would appreciate it if you could get back to me!

max-andr commented 2 years ago

Hi,

Oops, sorry, I forgot to include this function after refactoring the code. It should be like this:

from contextlib import contextmanager

@contextmanager
def nullcontext(enter_result=None):
    yield enter_result

Now it's fixed in https://github.com/tml-epfl/understanding-fast-adv-training/commit/ceed49440bfc35a676375b783eaba5940e583bcc. Thanks for letting us know about the problem!

Best, Maksym

CharlesJames13586 commented 2 years ago

Thank you and your work so much