How can I get the upper and lower layers of a certain layer of the model

%E6%8D%95%E8%8E%B7

Hello, now I have a pytorch model, how can I get the relationship between each layer of the model as shown in the arrow above, this picture is just an example, the relationship between layers is not accurate, how can I get the correct relationship?

You could do a forward hook and display the layer names in the order of the forward.
or you should look into the forum there is a way to display a model structure like this.

Hello, have specific relevant code, in addition, can I see the link to the forum, the relevant information is too little, thank you

for the visualization : Print Autograd Graph

for the hook I let you look at the doc explaining how to use it.

Convenient to provide QQ number, can you discuss it in detail

what do you mean by “convenient to provide QQ number” ?

Is Tencent QQ, a chat tool, are you Chinese?

Ohhh I didn’t know this thing, well I don’t have it sorry. Ask your questions here if you have any concerning hooks, I am not very familiar with the visualizing tool.