Skip to content

fix(eval-sde-adv): classifier not switched to eval mode (+1 more) - #31

Draft
andrewwhitecdw wants to merge 1 commit into
NVlabs:masterfrom
andrewwhitecdw:bugfix/eval-sde-adv-assorted-7eb26f5f
Draft

fix(eval-sde-adv): classifier not switched to eval mode (+1 more)#31
andrewwhitecdw wants to merge 1 commit into
NVlabs:masterfrom
andrewwhitecdw:bugfix/eval-sde-adv-assorted-7eb26f5f

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 27, 2026

Copy link
Copy Markdown

Small fixes in eval_sde_adv.py:

fix: classifier not switched to eval mode before AutoAttack

Fix: Replace:

    classifier = get_image_classifier(args.classifier_name).to(config.device)
    adversary_resnet = AutoAttack(classifier, norm=args.lp_norm, eps=args.adv_eps,

with:

    classifier = get_image_classifier(args.classifier_name).to(config.device).eval()
    adversary_resnet = AutoAttack(classifier, norm=args.lp_norm, eps=args.adv_eps,

fix: resnet baseline not in eval mode for stadv attack

Fix: Replace:

    resnet = get_image_classifier(args.classifier_name).to(config.device)

    start_time = time.time()
    init_acc = get_accuracy(resnet, x_val, y_val, bs=adv_batch_size)

with:

    resnet = get_image_classifier(args.classifier_name).to(config.device).eval()

    start_time = time.time()
    init_acc = get_accuracy(resnet, x_val, y_val, bs=adv_batch_size)

Files changed

  • eval_sde_adv.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant