TorchVista

Sample code (Not editable)
import torch
import torch.nn as nn
from torchvista import trace_model

class CompressionTest4(nn.Module):
    def __init__(self):
        super().__init__()
        block = nn.Sequential(*[nn.Linear(64, 64) for _ in range(4)])
        self.layers = nn.ModuleList([block] * 4)

    def forward(self, x):
        for seq in self.layers:
            x = seq(x)
        return x

model = CompressionTest4()
example_input = torch.randn(2, 64)

trace_model(model, example_input, show_compressed_view=True)

Error Output (if any)
Visualized Interactive Graph