Input output signatures
Quick answer
An input/output signature describes a model boundary: feature names and order, tensor dimensions, types, units, ranges, missing-value policy and output meaning. It is a contract for clients and serving systems. Examples use standard-library Python; optional ONNX execution is not tested. ByteMind execution is unverified.
Named feature ordering
row={"speed":6,"temperature":20}print([row[k] for k in ["temperature","speed"]])Expected output (locally tested): [20, 6]. The feature contract, not dictionary order, defines the vector.
How it works
A dense model expecting shape [batch, 2] cannot distinguish two swapped columns by shape alone. Map named features into a fixed ordered vector, check units and normalize using training-fitted constants. Explicitly reject booleans masquerading as integers, NaN and infinity, missing and extra fields, and incompatible schema versions. Use finite bounds to avoid resource and numerical problems. A dynamic batch dimension does not imply that every feature dimension is dynamic. The output signature must identify units and whether a value is a logit, probability, label or score. Apply postprocessing once, in the agreed place, and define the threshold boundary. Validate before inference and return a structured error instead of substituting arbitrary zeros. A signature records expected semantics, not a guarantee that every incoming measurement is correct.
Reject nonfinite values
import mathprint([type(x) in (int,float) and math.isfinite(x) for x in [3,True,float("inf"),float("nan")]])Expected output (locally tested): [True, False, False, False]. Strict types and finiteness are separate checks.
Common mistakes
Do not rely on dictionary insertion order or silently reshape arbitrary inputs. Python bool passes isinstance(x,int); JSON parsers may accept nonstandard NaN unless configured otherwise.
Practice and next steps
Create a named two-feature request with reversed key order and verify the same prediction. Reject a missing field and a wrong version.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Input output signatures — knowledge check
Apply input output signatures to small examples and debugging scenarios.
What can equal tensor shapes hide?
What should a probability output specify?
Where should validation occur?
What does a dynamic batch dimension allow?
What should an incompatible version trigger?