def gradient(self, image=None, label=None, strict=True):
assert self.has_gradient()<EOL>if image is None:<EOL><INDENT>image = self.__original_image<EOL><DEDENT>if label is None:<EOL><INDENT>label = self.__original_class<EOL><DEDENT>assert not strict or self.in_bounds(image)<EOL>self._total_gradient_calls += <NUM_LIT:1><EOL>gradient = self.__model.gradient(image, label)<EOL>assert gradient.shape == image.shape<EOL>return gradient<EOL>
Interface to model.gradient for attacks.

        Parameters
        ----------
        image : `numpy.ndarray`
            Single input with shape as expected by the model
            (without the batch dimension).
            Defaults to the original image.
        label : int
            Label used to calculate the loss that is differentiated.
            Defaults to the original label.
        strict : bool
            Controls if the bounds for the pixel values should be checked.