Skip to main content

Attax: adversarial attacks using JAX

Project description

Attax is python library with implementations of some common adversarial attacks using JAX. For now this is a prototype at best and I refer you my other project, Foolbox, that also supports JAX and provides a well-tested suite of adversarial attacks.

Installation

pip install attax

Example

import attax
from functools import partial

def predict(params, inputs):
    # see https://github.com/google/jax
    # ...

params = ...  # model parameters
x = ...  # input data
y = ...  # labels

f = partial(predict, params)

x_adv = attax.pgd(f, x, y, epsilon=0.3)

print((f(x).argmax(axis=-1) == y).mean())
print((f(x_adv).argmax(axis=-1) == y).mean())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

attax-0.0.2.tar.gz (2.6 kB view details)

Uploaded Source

File details

Details for the file attax-0.0.2.tar.gz.

File metadata

  • Download URL: attax-0.0.2.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for attax-0.0.2.tar.gz
Algorithm Hash digest
SHA256 558fdbe91b9bd0029a59f449c31e0258c06dfc8540cf75678e8d47fd799c9b42
MD5 6640f134886fbd9aa5732381b6a76ab0
BLAKE2b-256 50d6799f34fc7d23d4a6fe406ccfb2d3c1868ad647bc47f646f23d3b50df9d37

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page