# lutzroeder/netron architecture

> Architecture diagram of the GitHub repository lutzroeder/netron, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lutzroeder/netron
- Repository: https://github.com/lutzroeder/netron

## Overview

Netron lets a user open a machine-learning model and inspect its structure in a graph-oriented viewer. The documented format support spans many model ecosystems, so related readers are represented as format-family components rather than as a catalog of every adapter. The excerpts show desktop app actions reaching views and the view depending on graphing and shared model primitives. Parser-to-view dispatch is not shown in the sampled code, so those links are marked unverified; the README establishes the supported formats, not their internal routing.

Main entry points: [`source/view.js`](https://github.com/lutzroeder/netron/blob/main/source/view.js) (Model viewer), [`source/pytorch.js`](https://github.com/lutzroeder/netron/blob/main/source/pytorch.js) (PyTorch reader), [`source/app.js`](https://github.com/lutzroeder/netron/blob/main/source/app.js) (Desktop app), [`source/tf.js`](https://github.com/lutzroeder/netron/blob/main/source/tf.js) (TensorFlow readers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_desktop["Desktop app<br/>[app.js]"]
  node_viewer["Model viewer<br/>[view.js]"]
end

subgraph group_formats["Model formats"]
  node_onnx["ONNX reader<br/>[onnx.js]"]
  node_pytorch["PyTorch reader<br/>[pytorch.js]"]
  node_tensorflow["TensorFlow readers<br/>[tf.js]"]
  node_lite["TensorFlow Lite reader<br/>[tflite.js]"]
  node_coreml["Core ML reader<br/>[coreml.js]"]
  node_keras["Keras reader<br/>[keras.js]"]
  node_otherformats["Other format readers"]
end

subgraph group_runtime["Model runtime"]
  node_graphing["Graph layout<br/>[grapher.js]"]
  node_shared["Model primitives<br/>[base.js]"]
  node_dagre["Dagre layout engine<br/>[dagre.js]"]
end

subgraph group_binary["Data decoding"]
  node_protobuf["Protobuf decoder<br/>[protobuf.js]"]
  node_flatbuffers["FlatBuffers decoder<br/>[flatbuffers.js]"]
  node_hdf5["HDF5 decoder<br/>[hdf5.js]"]
  node_zip["ZIP decoder<br/>[zip.js]"]
  node_json["JSON decoder<br/>[json.js]"]
  node_xml["XML decoder<br/>[xml.js]"]
  node_text["Text decoder<br/>[text.js]"]
end

node_user(("Model user"))

node_user -->|"opens model"| node_desktop
node_desktop -->|"opens view"| node_viewer
node_viewer -->|"uses graphing"| node_graphing
node_viewer -->|"uses primitives"| node_shared
node_graphing -->|"uses layout"| node_dagre
node_viewer -.->|"dispatches to"| node_onnx
node_viewer -.->|"dispatches to"| node_pytorch
node_viewer -.->|"dispatches to"| node_tensorflow
node_viewer -.->|"dispatches to"| node_lite
node_viewer -.->|"dispatches to"| node_coreml
node_viewer -.->|"dispatches to"| node_keras
node_viewer -.->|"dispatches to"| node_otherformats
node_pytorch -->|"uses decoder"| node_protobuf
node_pytorch -->|"uses decoder"| node_flatbuffers
node_pytorch -->|"uses archive"| node_zip
node_pytorch -->|"uses primitives"| node_shared
node_tensorflow -.->|"decodes messages"| node_protobuf
node_hdf5 -->|"reads archive"| node_zip
node_json -->|"uses decoder"| node_text
node_xml -->|"uses decoder"| node_text

click node_desktop "https://github.com/lutzroeder/netron/blob/main/source/app.js"
click node_viewer "https://github.com/lutzroeder/netron/blob/main/source/view.js"
click node_graphing "https://github.com/lutzroeder/netron/blob/main/source/grapher.js"
click node_shared "https://github.com/lutzroeder/netron/blob/main/source/base.js"
click node_onnx "https://github.com/lutzroeder/netron/blob/main/source/onnx.js"
click node_pytorch "https://github.com/lutzroeder/netron/blob/main/source/pytorch.js"
click node_tensorflow "https://github.com/lutzroeder/netron/blob/main/source/tf.js"
click node_lite "https://github.com/lutzroeder/netron/blob/main/source/tflite.js"
click node_coreml "https://github.com/lutzroeder/netron/blob/main/source/coreml.js"
click node_keras "https://github.com/lutzroeder/netron/blob/main/source/keras.js"
click node_otherformats "https://github.com/lutzroeder/netron/tree/main/source"
click node_protobuf "https://github.com/lutzroeder/netron/blob/main/source/protobuf.js"
click node_flatbuffers "https://github.com/lutzroeder/netron/blob/main/source/flatbuffers.js"
click node_hdf5 "https://github.com/lutzroeder/netron/blob/main/source/hdf5.js"
click node_zip "https://github.com/lutzroeder/netron/blob/main/source/zip.js"
click node_json "https://github.com/lutzroeder/netron/blob/main/source/json.js"
click node_xml "https://github.com/lutzroeder/netron/blob/main/source/xml.js"
click node_text "https://github.com/lutzroeder/netron/blob/main/source/text.js"
click node_dagre "https://github.com/lutzroeder/netron/blob/main/source/dagre.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_desktop,node_viewer,node_user toneBlue
class node_onnx,node_pytorch,node_tensorflow,node_lite,node_coreml,node_keras,node_otherformats toneAmber
class node_graphing,node_shared,node_dagre toneMint
class node_protobuf,node_flatbuffers,node_hdf5,node_zip,node_json,node_xml,node_text toneRose
```

## Components

### User experience

- [Desktop app](https://github.com/lutzroeder/netron/blob/main/source/app.js): `source/app.js`
- [Model viewer](https://github.com/lutzroeder/netron/blob/main/source/view.js): `source/view.js`

### Model formats

- [ONNX reader](https://github.com/lutzroeder/netron/blob/main/source/onnx.js): `source/onnx.js`
- [PyTorch reader](https://github.com/lutzroeder/netron/blob/main/source/pytorch.js): `source/pytorch.js`
- [TensorFlow readers](https://github.com/lutzroeder/netron/blob/main/source/tf.js): `source/tf.js`
- [TensorFlow Lite reader](https://github.com/lutzroeder/netron/blob/main/source/tflite.js): `source/tflite.js`
- [Core ML reader](https://github.com/lutzroeder/netron/blob/main/source/coreml.js): `source/coreml.js`
- [Keras reader](https://github.com/lutzroeder/netron/blob/main/source/keras.js): `source/keras.js`
- [Other format readers](https://github.com/lutzroeder/netron/tree/main/source): `source`

### Model runtime

- [Graph layout](https://github.com/lutzroeder/netron/blob/main/source/grapher.js): `source/grapher.js`
- [Model primitives](https://github.com/lutzroeder/netron/blob/main/source/base.js): `source/base.js`
- [Dagre layout engine](https://github.com/lutzroeder/netron/blob/main/source/dagre.js): `source/dagre.js`

### Data decoding

- [Protobuf decoder](https://github.com/lutzroeder/netron/blob/main/source/protobuf.js): `source/protobuf.js`
- [FlatBuffers decoder](https://github.com/lutzroeder/netron/blob/main/source/flatbuffers.js): `source/flatbuffers.js`
- [HDF5 decoder](https://github.com/lutzroeder/netron/blob/main/source/hdf5.js): `source/hdf5.js`
- [ZIP decoder](https://github.com/lutzroeder/netron/blob/main/source/zip.js): `source/zip.js`
- [JSON decoder](https://github.com/lutzroeder/netron/blob/main/source/json.js): `source/json.js`
- [XML decoder](https://github.com/lutzroeder/netron/blob/main/source/xml.js): `source/xml.js`
- [Text decoder](https://github.com/lutzroeder/netron/blob/main/source/text.js): `source/text.js`

### Other components

- **Model user**

## Connections

- Model user → Desktop app: opens model (evidence: `source/app.js`)
- Desktop app → Model viewer: opens view (evidence: `source/app.js`)
- Model viewer → Graph layout: uses graphing (evidence: `source/view.js`)
- Model viewer → Model primitives: uses primitives (evidence: `source/view.js`)
- Graph layout → Dagre layout engine: uses layout (evidence: `source/grapher.js`)
- Model viewer → ONNX reader: dispatches to
- Model viewer → PyTorch reader: dispatches to
- Model viewer → TensorFlow readers: dispatches to
- Model viewer → TensorFlow Lite reader: dispatches to
- Model viewer → Core ML reader: dispatches to
- Model viewer → Keras reader: dispatches to
- Model viewer → Other format readers: dispatches to (evidence: `source/view.js`)
- PyTorch reader → Protobuf decoder: uses decoder (evidence: `source/pytorch.js`)
- PyTorch reader → FlatBuffers decoder: uses decoder (evidence: `source/pytorch.js`)
- PyTorch reader → ZIP decoder: uses archive (evidence: `source/pytorch.js`)
- PyTorch reader → Model primitives: uses primitives (evidence: `source/pytorch.js`)
- TensorFlow readers → Protobuf decoder: decodes messages
- HDF5 decoder → ZIP decoder: reads archive (evidence: `source/hdf5.js`)
- JSON decoder → Text decoder: uses decoder (evidence: `source/json.js`)
- XML decoder → Text decoder: uses decoder (evidence: `source/xml.js`)
