Are you looking for: tf.gradients  |  TensorFlow Core v2.6.0 ?
@tf.function
def simple_graph_function(x):
  return x ** 2

# You must be in graph mode to use tf.gradients e.g. inside
# the context of a tf.function. tf.gradients will return the gradients of ys w.r.t x.
# You're returning that result here so the resulting computational graph will be
# the "Backward computational graph"
@tf.function
def grad_of_simple_graph_function(x):
   y = simple_graph_function(x)
   return tf.gradients([y], [x])

grad_of_simple_graph_function(tf.constant(2))

Returns:
[<tf.Tensor: shape=(), dtype=float32, numpy=4.0>]