viz.renderers.ModelArchitectureRenderer
Renderer for visualizing neural network architectures.
Examples
const graph: ArchitectureGraph = {
name: 'Simple CNN',
nodes: [
{ id: 'input', type: 'input', name: 'Input', outputShape: [1, 3, 224, 224] },
{ id: 'conv1', type: 'conv2d', name: 'Conv2d', inputShape: [1, 3, 224, 224], outputShape: [1, 64, 112, 112], params: 9472 },
{ id: 'pool1', type: 'pool', name: 'MaxPool', inputShape: [1, 64, 112, 112], outputShape: [1, 64, 56, 56] },
{ id: 'fc', type: 'linear', name: 'Linear', inputShape: [1, 200704], outputShape: [1, 1000], params: 200705000 },
{ id: 'output', type: 'output', name: 'Output', inputShape: [1, 1000] },
],
edges: [
{ from: 'input', to: 'conv1' },
{ from: 'conv1', to: 'pool1' },
{ from: 'pool1', to: 'fc' },
{ from: 'fc', to: 'output' },
],
};
const renderer = new ModelArchitectureRenderer();
renderer.render(graph, { target: canvasTarget, showParams: true });