I don’t understand how to use the C++ API of Pytorch to retain the graph.
How can one achieve loss.backward(retain_graph=True) with it?
inline void Tensor::backward(
    c10::optional<Tensor> gradient,
    bool keep_graph,
    bool create_graph) {
  type().backward(*this, std::move(gradient), keep_graph, create_graph);
}

This is how the backward pass is implemented, but how can one access the keep_graph variable?