class_docstr: Class for importing MXNet Gluon models.
docstr: Initialize an `MXClassifier` object. Assumes the `model` passed as parameter is a Gluon model.
  
  :param model: The Gluon model. The output of the model can be logits, probabilities or anything else. Logits
         output should be preferred where possible to ensure attack efficiency.
  :param loss: The loss function for which to compute gradients for training.
  :param input_shape: The shape of one input instance.
  :param nb_classes: The number of classes of the model.
  :param optimizer: The optimizer used to train the classifier. This parameter is only required if fitting will
                    be done with method fit.
  :param ctx: The device on which the model runs (CPU or GPU). If not provided, CPU is assumed.
  :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 classifier.
  :param postprocessing_defences: Postprocessing defence(s) to be applied by the classifier.
  :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.
docstr_tok: ["Initialize","an","`","MXClassifier","`","object",".","Assumes","the","`","model","`","passed","as","parameter","is","a","Gluon","model",".",":","param","model",":","The","Gluon","model",".","The","output","of","the","model","can","be","logits",",","probabilities","or","anything","else",".","Logits","output","should","be","preferred","where","possible","to","ensure","attack","efficiency",".",":","param","loss",":","The","loss","function","for","which","to","compute","gradients","for","training",".",":","param","input_shape",":","The","shape","of","one","input","instance",".",":","param","nb_classes",":","The","number","of","classes","of","the","model",".",":","param","optimizer",":","The","optimizer","used","to","train","the","classifier",".","This","parameter","is","only","required","if","fitting","will","be","done","with","method","fit",".",":","param","ctx",":","The","device","on","which","the","model","runs","(","CPU","or","GPU",")",".","If","not","provided",",","CPU","is","assumed",".",":","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","classifier",".",":","param","postprocessing_defences",":","Postprocessing","defence","(","s",")","to","be","applied","by","the","classifier",".",":","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","."]
code: def __init__(
      self,
      model: "mx.gluon.Block",
      loss: Union["mx.nd.loss", "mx.gluon.loss"],
      input_shape: Tuple[int, ...],
      nb_classes: int,
      optimizer: Optional["mx.gluon.Trainer"] = None,
      ctx: Optional["mx.context.Context"] = None,
      channels_first: bool = True,
      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),
  ) -> None:
      """
      Initialize an `MXClassifier` object. Assumes the `model` passed as parameter is a Gluon model.
  
      :param model: The Gluon model. The output of the model can be logits, probabilities or anything else. Logits
             output should be preferred where possible to ensure attack efficiency.
      :param loss: The loss function for which to compute gradients for training.
      :param input_shape: The shape of one input instance.
      :param nb_classes: The number of classes of the model.
      :param optimizer: The optimizer used to train the classifier. This parameter is only required if fitting will
                        be done with method fit.
      :param ctx: The device on which the model runs (CPU or GPU). If not provided, CPU is assumed.
      :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 classifier.
      :param postprocessing_defences: Postprocessing defence(s) to be applied by the classifier.
      :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.
      """
      import mxnet as mx
  
      super().__init__(
          model=model,
          clip_values=clip_values,
          channels_first=channels_first,
          preprocessing_defences=preprocessing_defences,
          postprocessing_defences=postprocessing_defences,
          preprocessing=preprocessing,
      )
  
      self._loss = loss
      self.nb_classes = nb_classes
      self._input_shape = input_shape
      self._device = ctx
      self._optimizer = optimizer
  
      if ctx is None:
          self._ctx = mx.cpu()
      else:
          self._ctx = ctx
  
      # Get the internal layer
      self._layer_names = self._get_layers()
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import os
  from typing import List, Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  import six
  from art import config
  from art.estimators.mxnet import MXEstimator
  from art.estimators.classification.classifier import ClassGradientsMixin, ClassifierMixin
  from art.utils import check_and_transform_label_format
label_desc: Use image node_id 1 to create a new MXClassifier object from inherited base classes: ClassGradientsMixin, ClassifierMixin, MXEstimator with example: obj = MXClassifier(model, loss, input_shape, nb_classes, optimizer, ctx, channels_first, clip_values, preprocessing_defences, postprocessing_defences, preprocessing)