code: def testFunctionHasNoSecondOrderGradient(self):
      # This test needs nn_grad imported. We could just disable the lint error,
      # but this way if the test is deleted we'll know the import isn't needed.
      _ = nn_grad
  
      v = variables.Variable(1.0)
  
      @polymorphic_function.function
      def f(labels, logits):
          return polymorphic_function.function(
              nn_ops.sparse_softmax_cross_entropy_with_logits
          )(labels=labels, logits=logits + v)
  
      @polymorphic_function.function
      def f_grad():
          with backprop.GradientTape() as tape:
              logits = constant_op.constant([1.0, 2.0])
              tape.watch(logits)
              out = f(constant_op.constant(1), logits)
          return tape.gradient(out, logits)
  
      # Mainly we want to check that the function builds despite
      # sparse_softmax_cross_entropy_with_logits not having a second-order
      # gradient defined.
      self.assertAllEqual([2], f_grad().shape)
  
imports: from absl.testing import parameterized
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import context
  from tensorflow.python.eager.polymorphic_function import polymorphic_function
  from tensorflow.python.framework import config
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import cond
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_grad
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variables
  from tensorflow.python.ops import while_loop
  from tensorflow.python.platform import test
label_desc: Use image node_id 43 for calling the FunctionGradientsTest obj's underlying member method code with example usage: obj.testFunctionHasNoSecondOrderGradient() and returns: polymorphic_function, tape