Title here
Summary here
import { parseSavedModel } from '@wetron/savedmodel';
const graph = parseSavedModel(bytes); // synchronous, returns ModelGraph
Or use the unified entry point - .pb files are routed here automatically:
import { parseModel } from '@wetron/core';
const graph = await parseModel(bytes, 'model.pb');Detected by first byte 0x0a (protobuf field 1, length-delimited). Contains a Keras layer graph serialized as JSON inside the protobuf.
Sequential, FunctionalInputLayer entries -> ModelGraph.inputs (excluded from nodes)class_name -> node opTypeattributesinbound_nodes for Functional; chained for SequentialDetected by first byte 0x08 (protobuf field 1, varint - schema version). Contains a TensorFlow GraphDef with raw TF ops.
Placeholder nodes -> ModelGraph.inputsModelGraph.nodesConst node tensor shape and dtype are folded into ModelGraph.initializers; consumers see them as initializer edges in the rendered graphStatefulPartitionedCall and PartitionedCall function bodies are inlined from the library.function table; body node names are prefixed with the call-site name to avoid collisionsVarHandleOp nodes mark variables backed by an external checkpoint - the parser sets ModelGraph.weights to { kind: "external", format: "savedmodel" }Placeholder (input)
↓
Conv2D ← Const (weight)
↓
BiasAdd ← Const (bias)
↓
Relu
↓
...
↓
Softmax (output)parseModel detects .pb by filename extension; the first-byte check then selects the variant.variables.index + variables.data-XXXXX-of-YYYYY) with loadSavedModelWeights - or loadSavedModelWeightsFromUrls(indexUrl, ...dataUrls) for remote checkpoints - and call attachCheckpointToGraph. The returned graph has weights.kind === "available" and a source re-keyed by node name. See
Weights.^) are ignored.:0, :1) are stripped from input tensor names. As a
consequence, multi-output ops (Split, TopK, …) cannot be fully
disambiguated - every consumer of split:0, split:1 is recorded as a
consumer of split. Connectivity is preserved; per-port labelling is not.warnings on the returned graph.ParseError if the file is too short or has unrecognized first byte.