model module¶
-
class
cleverhans.model.
CallableModelWrapper
(callable_fn, output_layer)[source]¶ Bases:
cleverhans.model.Model
-
class
cleverhans.model.
Model
[source]¶ Bases:
object
An abstract interface for model wrappers that exposes model symbols needed for making an attack. This abstraction removes the dependency on any specific neural network package (e.g. Keras) from the core code of CleverHans. It can also simplify exposing the hidden features of a model when a specific package does not directly expose them.
-
fprop
(x)[source]¶ Exposes all the layers of the model returned by get_layer_names. :param x: A symbolic representation of the network input :return: A dictionary mapping layer names to the symbolic
representation of their output.
-
get_layer
(x, layer)[source]¶ Expose the hidden features of a model given a layer name. :param x: A symbolic representation of the network input :param layer: The name of the hidden layer to return features at. :return: A symbolic representation of the hidden features :raise: NoSuchLayerError if layer is not in the model.
-
get_layer_names
()[source]¶ Returns: a list of names for the layers that can be exposed by this model abstraction.
-
get_logits
(x)[source]¶ Parameters: x – A symbolic representation of the network input Returns: A symbolic representation of the output logits (i.e., the values fed as inputs to the softmax layer).
-