code: def _get_logits(output, from_logits, op_type, fn_name):
      """Retrieves logits tensor from maybe-softmax or maybe-sigmoid tensor."""
      output_ = output
      from_logits_ = from_logits
  
      has_keras_logits = hasattr(output, "_keras_logits")
      if has_keras_logits:
          output_ = output._keras_logits
          from_logits_ = True
  
      from_expected_op_type = (
          hasattr(output, "op")
          and not isinstance(
              output, (tf.__internal__.EagerTensor, tf.Variable)
          )
          and output.op.type == op_type
      ) and not has_keras_logits
  
      if from_expected_op_type:
          # When softmax activation function is used for output operation, we
          # use logits from the softmax function directly to compute loss in order
          # to prevent collapsing zero when training.
          assert len(output.op.inputs) == 1
          output_ = output.op.inputs[0]
          from_logits_ = True
  
      if from_logits and (has_keras_logits or from_expected_op_type):
          warnings.warn(
              f'"`{fn_name}` received `from_logits=True`, but '
              f"the `output` argument was produced by a {op_type} "
              "activation and thus does not represent logits. "
              "Was this intended?",
              stacklevel=2,
          )
      return output_, from_logits_
  
imports: import warnings
  import tensorflow
  from keras.backend import standardize_data_format
  from keras.backend import standardize_dtype
  from keras.backend.common.backend_utils import compute_conv_transpose_output_shape
  from keras.backend.config import epsilon
  from keras.backend.tensorflow.core import cast
  from keras.backend.tensorflow.core import convert_to_tensor
label_desc: Use image node_id 28 for calling a global function with example usage: _get_logits(output, from_logits, op_type, fn_name) and returns: output_,  from_logits_