Is there any way to create backward computational graph with gradients either in tensorflow/keras?

Can you explain a little bit more your use case?

Just wanted to check if we can build reverse graph of the actual computational group with gradient nodes?

Do you have an example?

Are you looking for: tf.gradients | TensorFlow Core v2.8.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>]
```