1

In tensorboard, it is possible to plot the computational graph of a deep learning model.

  • Is it possible to display a value for each node (for example, the norm of the output)?
  • Is it possible to do it in both pytorch and tensorflow?

Example (display computational graph with torch.norm of output of each computational graph's node in vgg11):

import torch
import torchvision

vgg11 = torchvision.models.vgg11(pretrained=True)
image = torch.randn(8, 3, 224, 224)
out = vgg11(image)

So in the output node, we want the value in the computational graph to be

torch.norm(out)

One issue in pytorch side is that, there is no explicit computational graph to visualize (e.g. in pydot).

Roy
  • 65
  • 2
  • 15
  • 40

1 Answers1

0

This is a poor question, but:

Yes is is possible.

Access the underlying internal members via the _ or __ prefix and calculate the norm...

So yes it is possible, but the same code will not work across frameworks.

  • This is a poor answer. How can I access the relationship in computational graph in pytorch? If you know, provide the answer with the code. – Roy Jan 03 '23 at 06:29
  • @Roy, Do you expect me to write code for you? This is not a coding service. I answered the question as asked. –  Jan 03 '23 at 06:42
  • @Roy, If you expect a better answer, ask a better single question with, minimally reproducible code. –  Jan 03 '23 at 06:55
  • The question is very clear, if you want specific example, I added vgg11 to question. How I can plot the computational graph with torch.norm of the outputs at that node? – Roy Jan 03 '23 at 07:17
  • The point is not calculate the norm. The issue is that in pytorch side, there is no clear computational graph to access. – Roy Jan 03 '23 at 07:22
  • @Roy, sure there is, you have not looked properly, For every python object, there is data behind it, whether or not it is in the format that you expect, the data is there. Its transform is what you are missing. –  Jan 03 '23 at 08:20