class_docstr: Implementation of Hidden Trigger Backdoor Attack by Saha et al 2019.
  "Hidden Trigger Backdoor Attacks
  
  | Paper link: https://arxiv.org/abs/1910.00033
class_docstr_tok: ["Implementation","of","Hidden","Trigger","Backdoor","Attack","by","Saha","et","al","2019",".","``","Hidden","Trigger","Backdoor","Attacks","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1910.00033"]
docstr: Helper function to get the feature layer output tensor in the keras graph
  :return: Output tensor
docstr_tok: ["Helper","function","to","get","the","feature","layer","output","tensor","in","the","keras","graph",":","return",":","Output","tensor"]
code: def _get_keras_tensor(self):
      """
      Helper function to get the feature layer output tensor in the keras graph
      :return: Output tensor
      """
      if self.estimator._layer_names is None:  # pylint: disable=W0212
          raise ValueError("No layer names identified.")
  
      if isinstance(self.feature_layer, six.string_types):
          if (
              self.feature_layer not in self.estimator._layer_names
          ):  # pylint: disable=W0212
              raise ValueError(
                  f"Layer name {self.feature_layer} is not part of the graph."
              )
          layer_name = self.feature_layer
      elif isinstance(self.feature_layer, int):
          if self.feature_layer < 0 or self.feature_layer >= len(
              self.estimator._layer_names  # pylint: disable=W0212
          ):
              raise ValueError(
                  f"Layer index {self.feature_layer} is outside of range [0 to "  # pylint: disable=W0212
                  f"{len(self.estimator._layer_names) - 1}])."  # pylint: disable=W0212
              )
          layer_name = self.estimator._layer_names[
              self.feature_layer
          ]  # pylint: disable=W0212
      else:
          raise TypeError("Layer must be of type `str` or `int`.")
  
      keras_layer = self.estimator._model.get_layer(
          layer_name
      )  # pylint: disable=W0212
      num_inbound_nodes = len(
          getattr(keras_layer, "_inbound_nodes", [])
      )
      if num_inbound_nodes > 1:
          layer_output = keras_layer.get_output_at(0)
      else:
          layer_output = keras_layer.output
      return layer_output
  
file_path: adversarial-robustness-toolbox/art/attacks/poisoning/hidden_trigger_backdoor/hidden_trigger_backdoor_keras.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import List, Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  import six
  from tqdm.auto import trange
  from art.attacks.attack import PoisoningAttackWhiteBox
  from art.attacks.poisoning.backdoor_attack import PoisoningAttackBackdoor
  from art.estimators import BaseEstimator, NeuralNetworkMixin
  from art.estimators.classification.classifier import ClassifierMixin
  from art.estimators.classification.keras import KerasClassifier
  from art.attacks.poisoning.hidden_trigger_backdoor.loss_meter import LossMeter
  from art.utils import check_and_transform_label_format
label_desc: Use image node_id 3 for calling the HiddenTriggerBackdoorKeras obj's underlying member method code with example usage: obj._get_keras_tensor() and returns: layer_output