cleverhans-lab / cleverhans

An adversarial example library for constructing attacks, building defenses, and benchmarking both
MIT License
6.2k stars 1.39k forks source link

Support for high level API in tensorflow #418

Closed GuanxiongLiu closed 6 years ago

GuanxiongLiu commented 6 years ago

Hi folks, I'm a student works on adversarial examples and new to cleverhans. I spend some time on the entry level tensorflow tutorial of MNIST with FGSM. I noticed that the MLP model is using lower level APIs. I have my local copy which rewrites the MLP with high level tensorflow API like tf.layers which is more like a Keras syntax. I'm not sure if this is something useful or there are existed examples. Anyway, if it could benefit others, I'm more than happy to contribute my code.

goodfeli commented 6 years ago

The MLP model isn't part of the library itself; it's just part of the tutorials. It uses low-level APIs intentionally. The goal is to show how any TensorFlow code can be used with CleverHans without needing to use a specific high-level API for compatibility. It's intended to provide a contrast to the Keras tutorial.

GuanxiongLiu commented 6 years ago

Thanks for the reply, @goodfeli . BTW, I saw that model_train and model_loss are provided as utils. However, it didn't support complex model structure such as stack model or ensemble model and only cross entropy loss. Is it a feature to be supported in the future?