Skip to main content

PyTorch Adversarial Attackers

A PyTorch-based library for evaluating model robustness against adversarial attacks: FGSM, PGD, and CW attacks. Designed to work with all PyTorch models like ResNet, VGG16, MobileNet, etc.

Installation

pip install pytorch-adversarial-attackers

Usage Example

import torch
import torchvision.models as models
from adversarial_eval.attacks import FGSM, PGD, CW
from adversarial_eval.evaluate import evaluate

# Load pre-trained model
model = models.resnet18(pretrained=True).eval()

# Load image
image = torch.rand((1, 3, 224, 224))  # Example input
label = torch.tensor([0])  # Example label

# Apply attacks
fgsm_attack = FGSM(model, epsilon=0.03)
adv_image = fgsm_attack(image, label)

# Evaluate robustness
evaluate(model, image, label)

Attacks Implemented

Metadata

Release files for pytorch-adversarial-attackers 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytorch-adversarial-attackers 0.1
File Size Uploaded Provenance
pytorch_adversarial_attackers-0.1.tar.gz 1.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytorch-adversarial-attackers 0.1
File Interpreter ABI Platform
pytorch_adversarial_attackers-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 3.7 kB

Release files / pytorch_adversarial_attackers-0.1.tar.gz

Download URL pytorch_adversarial_attackers-0.1.tar.gz
Size 1.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5a7d4930d8dcb51945467b29b47314b5de7b9f6faf4f0c40e9ba30d338b82d02
BLAKE2b-256 checksum
How to use checksums
4b24e881878d2916f372cd61f7d3e57e00e4f61935c33a1bfa10060df29befc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release files / pytorch_adversarial_attackers-0.1-py3-none-any.whl

Download URL pytorch_adversarial_attackers-0.1-py3-none-any.whl
Size 1.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5b9bf6c104e4ae190ee9d0a434b3d8daef22b58de0ed43dec4dc1ece82940f8
BLAKE2b-256 checksum
How to use checksums
53fdda14ec5fd8bedbd79f12478331e023bc6b231c535077d5bba798a932a80e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Security for pytorch-adversarial-attackers 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page