class_docstr: Wrapper class for importing Keras regression models.
class_docstr_tok: ["Wrapper","class","for","importing","Keras","regression","models","."]
docstr: Create a `Regressor` instance from a Keras model. Assumes the `model` passed as argument is compiled.
  
  :param model: Keras model, neural network or other.
  :param channels_first: Set channels first or last.
  :param clip_values: Tuple of the form `(min, max)` of floats or `np.ndarray` representing the minimum and
         maximum values allowed for features. If floats are provided, these will be used as the range of all
         features. If arrays are provided, each value will be considered the bound for a feature, thus
         the shape of clip values needs to match the total number of features.
  :param preprocessing_defences: Preprocessing defence(s) to be applied by the regressor.
  :param postprocessing_defences: Postprocessing defence(s) to be applied by the regressor.
  :param preprocessing: Tuple of the form `(subtrahend, divisor)` of floats or `np.ndarray` of values to be
         used for data preprocessing. The first value will be subtracted from the input. The input will then
         be divided by the second one.
  :param input_layer: The index of the layer to consider as input for models with multiple input layers. The layer
                      with this index will be considered for computing gradients. For models with only one input
                      layer this values is not required.
  :param output_layer: Which layer to consider as the output when the models has multiple output layers. The layer
                       with this index will be considered for computing gradients. For models with only one output
                       layer this values is not required.
docstr_tok: ["Create","a","`","Regressor","`","instance","from","a","Keras","model",".","Assumes","the","`","model","`","passed","as","argument","is","compiled",".",":","param","model",":","Keras","model",",","neural","network","or","other",".",":","param","channels_first",":","Set","channels","first","or","last",".",":","param","clip_values",":","Tuple","of","the","form","`","(","min",",","max",")","`","of","floats","or","`","np.ndarray","`","representing","the","minimum","and","maximum","values","allowed","for","features",".","If","floats","are","provided",",","these","will","be","used","as","the","range","of","all","features",".","If","arrays","are","provided",",","each","value","will","be","considered","the","bound","for","a","feature",",","thus","the","shape","of","clip","values","needs","to","match","the","total","number","of","features",".",":","param","preprocessing_defences",":","Preprocessing","defence","(","s",")","to","be","applied","by","the","regressor",".",":","param","postprocessing_defences",":","Postprocessing","defence","(","s",")","to","be","applied","by","the","regressor",".",":","param","preprocessing",":","Tuple","of","the","form","`","(","subtrahend",",","divisor",")","`","of","floats","or","`","np.ndarray","`","of","values","to","be","used","for","data","preprocessing",".","The","first","value","will","be","subtracted","from","the","input",".","The","input","will","then","be","divided","by","the","second","one",".",":","param","input_layer",":","The","index","of","the","layer","to","consider","as","input","for","models","with","multiple","input","layers",".","The","layer","with","this","index","will","be","considered","for","computing","gradients",".","For","models","with","only","one","input","layer","this","values","is","not","required",".",":","param","output_layer",":","Which","layer","to","consider","as","the","output","when","the","models","has","multiple","output","layers",".","The","layer","with","this","index","will","be","considered","for","computing","gradients",".","For","models","with","only","one","output","layer","this","values","is","not","required","."]
code: def __init__(
      self,
      model: KERAS_MODEL_TYPE,
      channels_first: bool = False,
      clip_values: Optional["CLIP_VALUES_TYPE"] = None,
      preprocessing_defences: Union[
          "Preprocessor", List["Preprocessor"], None
      ] = None,
      postprocessing_defences: Union[
          "Postprocessor", List["Postprocessor"], None
      ] = None,
      preprocessing: "PREPROCESSING_TYPE" = (0.0, 1.0),
      input_layer: int = 0,
      output_layer: int = 0,
  ) -> None:
      """
      Create a `Regressor` instance from a Keras model. Assumes the `model` passed as argument is compiled.
  
      :param model: Keras model, neural network or other.
      :param channels_first: Set channels first or last.
      :param clip_values: Tuple of the form `(min, max)` of floats or `np.ndarray` representing the minimum and
             maximum values allowed for features. If floats are provided, these will be used as the range of all
             features. If arrays are provided, each value will be considered the bound for a feature, thus
             the shape of clip values needs to match the total number of features.
      :param preprocessing_defences: Preprocessing defence(s) to be applied by the regressor.
      :param postprocessing_defences: Postprocessing defence(s) to be applied by the regressor.
      :param preprocessing: Tuple of the form `(subtrahend, divisor)` of floats or `np.ndarray` of values to be
             used for data preprocessing. The first value will be subtracted from the input. The input will then
             be divided by the second one.
      :param input_layer: The index of the layer to consider as input for models with multiple input layers. The layer
                          with this index will be considered for computing gradients. For models with only one input
                          layer this values is not required.
      :param output_layer: Which layer to consider as the output when the models has multiple output layers. The layer
                           with this index will be considered for computing gradients. For models with only one output
                           layer this values is not required.
      """
      super().__init__(
          model=model,
          clip_values=clip_values,
          preprocessing_defences=preprocessing_defences,
          postprocessing_defences=postprocessing_defences,
          preprocessing=preprocessing,
          channels_first=channels_first,
      )
  
      self._input_layer = input_layer
      self._output_layer = output_layer
  
      if "<class 'tensorflow" in str(type(model).__mro__):
          self.is_tensorflow = True
      elif "<class 'keras" in str(type(model).__mro__):
          self.is_tensorflow = False
      else:  # pragma: no cover
          raise TypeError(
              "Type of model not recognized:" + str(type(model))
          )
  
      self._initialize_params(model, input_layer, output_layer)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import os
  import time
  from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  import six
  from art import config
  from art.estimators.keras import KerasEstimator
  from art.estimators.regression.regressor import RegressorMixin
label_desc: Use image node_id 1 to create a new KerasRegressor object from inherited base classes: RegressorMixin, KerasEstimator with example: obj = KerasRegressor(model, channels_first, clip_values, preprocessing_defences, postprocessing_defences, preprocessing, input_layer, output_layer)