class_docstr: This is a cleverhans model that wraps a robust vision benchmark model.
code: def _logits_op(self, x, name=None):
      with tf.name_scope(name, "logits", [x]) as name:
          nb_classes = self.adversarial.nb_classes()
  
          def _backward_py(gradient_y, x):
              x = np.squeeze(x, axis=0)
              gradient_y = np.squeeze(gradient_y, axis=0)
              gradient_x = self.adversarial.backward(gradient_y, x)
              gradient_x = gradient_x.astype(np.float32)
              return gradient_x[np.newaxis]
  
          def _backward_tf(op, grad):
              images = op.inputs[0]
              gradient_x = tf.py_func(
                  _backward_py, [grad, images], tf.float32
              )
              gradient_x.set_shape(images.shape)
              return gradient_x
  
          def _forward_py(x):
              predictions = self.adversarial.batch_predictions(
                  x, strict=False
              )[0]
              predictions = predictions.astype(np.float32)
              return predictions
  
          op = py_func_grad(
              _forward_py,
              [x],
              [tf.float32],
              name=name,
              grad=_backward_tf,
          )
  
          logits = op[0]
          logits.set_shape((x.shape[0], nb_classes))
  
      return logits
  
file_path: cleverhans/cleverhans_v3.1.0/examples/robust_vision_benchmark/cleverhans_attack_example/utils.py
imports: import cleverhans.model
  import tensorflow
  import numpy
label_desc: Use image node_id 3 for calling the RVBCleverhansModel obj's underlying member method code with example usage: obj._logits_op(x, name) and returns: logits, gradient_x, gradient_x, predictions