I have GAN for a graph prediction task in which there are torch_geometric.nn.NNConv layers. I want to add eigenvector centrality difference between ground-truth and predicted graph to my loss function. To calculate eigenvector centrality, I intended to use eigenvector_centrality function from NetworkX library. However, this function requires input to be a NetworkX graph which also requires to convert my torch.tensor outputted from Generator network to numpy.array. So, I need to detach() the gradient which will cause PyTorch to lose all gradient tracking. Thus, how can I properly implement a eigenvector centrality for my loss function? Thanks.