-
Notifications
You must be signed in to change notification settings - Fork 0
File Format
Marco Vasko-Klima edited this page Aug 9, 2026
·
6 revisions
Complete documentation of the .nnn file format used by Neural Network Notions.
- All multi-byte numbers use little-endian encoding.
- Each layer type's encoding includes different parameters - identified by Layer ID.
- Certain activations encode additional parameters (eg. Leaky ReLU's Tau) immediately after their ID - identified by Activation ID.
- Data appears in the file in the exact order as listed below.
- Magic Number -> int32 (4 bytes) -> 776883790 (spells .NNN in ASCII)
- Description -> string (see formatting) -> short description of the model in the file
- Parameter Count -> unsigned int64 (8 bytes) -> total number of parameter values across all parameter tensors in the model
- Layer Count -> int32 (4 bytes) -> number of layers in the model
- Layer ID -> unsigned byte -> ID of the specific layer type (see ID list)
-
- Activation ID -> unsigned byte -> ID of the layer's activation function (see ID list)
- Dropout -> float (4 bytes) -> dropout parameter of the layer
- Bias -> tensor (see formatting) -> bias parameter of the layer
-
- Neuron Count -> int32 (4 bytes) -> number of neurons in the layer
- Weights -> tensor (see formatting) -> weights parameter of the layer
- Flatten -> boolean (see formatting) -> whether the layer flattens its input prior to applying weights
-
- Filter Count -> int32 (4 bytes) -> number of filters in the layer
- Kernels -> tensor (see formatting) -> kernels parameter of the layer ([f, h, w..., c] ordering)
- PaddingType -> int32 (4 bytes) -> type of padding used by the layer
- PaddingDims -> int32 array (see formatting) -> padding dimensions applied by the layer
Found immediately after Activation ID - for activation functions with parameters
-
- Tau -> float (4 bytes) -> tau parameter of the function
- Dimensions -> int32 array (see formatting) -> dimensions of the tensor
- RequiresGrad -> boolean (see formatting) -> whether the tensor requires gradients to be calculated
- Data -> float array (see formatting) -> linear array of the tensor's data values (row-major ordering)
-
- Length -> int32 (4 bytes) -> number of characters in the string
- Characters -> byte[Length] -> UTF8 character bytes
-
- Length -> int32 (4 bytes) -> number of elements in the array
- Elements -> int32[Length] (4 bytes each) -> elements in the array
-
- Length -> int32 (4 bytes) -> number of elements in the array
- Elements -> float[Length] (4 bytes each) -> elements in the array
-
- 1 bytes -> 1 = true, 0 = false
- 0 -> Dense
- 1 -> Conv
- 0 -> Linear
- 1 -> Sigmoid
- 2 -> Tanh
- 3 -> ReLU
- 4 -> Leaky ReLU
- 5 -> Softmax