<?xml version="1.0" encoding="UTF-8"?>
<metanorma xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="3.5.0" schema-version="v2.2.0" flavor="generic">
<bibdata type="standard">
<title language="en" type="main">Open Neural Network Exchange (ONNX) — Part 3: Conformance test package</title>

<title language="en" type="part">Conformance test package</title>

<title language="en" type="title-part-prefix">Part 3</title>
<docidentifier primary="true" type="ONNX">ONNX 1-3 (unofficial draft)</docidentifier><docnumber>1</docnumber><date type="updated"><on>2026-09-20</on></date><contributor><role type="author"/><organization>
<name>ONNX Standardization Working Group</name>
<abbreviation>ONNX</abbreviation></organization></contributor><contributor><role type="author"><description>committee</description></role><organization>
<name>ONNX Standardization Working Group</name>
<subdivision type="Committee">
<name>ONNX Standardization Working Group</name>
</subdivision></organization></contributor><contributor><role type="publisher"/><organization>
<name>ONNX Standardization Working Group</name>
<abbreviation>ONNX</abbreviation></organization></contributor><edition>1</edition><version>2026-09-20</version><language>en</language><script>Latn</script><status><stage>preparatory</stage></status><copyright><from>2026</from><owner><organization>
<name>ONNX Standardization Working Group</name>
<abbreviation>ONNX</abbreviation></organization></owner></copyright><ext><doctype>standard</doctype><flavor>generic</flavor></ext></bibdata><metanorma-extension><semantic-metadata><stage-published>false</stage-published></semantic-metadata>
<presentation-metadata><toc-heading-levels>2</toc-heading-levels><html-toc-heading-levels>2</html-toc-heading-levels><doc-toc-heading-levels>2</doc-toc-heading-levels><pdf-toc-heading-levels>2</pdf-toc-heading-levels></presentation-metadata></metanorma-extension>
<preface><foreword id="_e849d0e3-9f0c-0003-e128-46fcaea7685a" obligation="informative">
<title id="_41c9fad3-d4c1-eecc-4fad-f91704acc026">Foreword</title>
<p id="_9706b36d-84b1-5428-296b-7abb126edc90">This document has been prepared by the ONNX Standardization Working Group.</p>

<p id="_9da356ec-6bb1-a5d7-bd24-77814775f69f">It is Part 3 of ONNX 1; Part 1 specifies the core and Part 2 the operator sets.</p>

<admonition id="_7f660a40-bfef-b358-18c4-ed5f04f2f23d" type="important">
<name id="_cb720aab-8e9b-cfec-6013-35be85ccb8d9">Status of this document</name>
<p id="_cf856062-c4e9-92f4-bf82-f9ce730efe35">This is an <strong>unofficial</strong> working draft. It has no standing within the ONNX project, the Linux Foundation, IEC, ISO or any other standards development organization, and it MUST NOT be cited as a normative reference.</p>
</admonition></foreword><introduction id="_2e56e790-f958-9731-2efa-7f3e52a1b5f7" obligation="informative">
<title id="_2b2e98d1-114a-3da4-8556-01ae0a724280">Introduction</title>
<p id="_1861f369-aa00-55ff-36ef-743b64028fe5">A conformance requirement that cannot be checked is not a requirement. Part 1 states what an implementation must do; this part supplies the vectors that decide whether it did.</p>

<p id="_fdec82e9-31b2-3a10-35f4-b3c0f491d805">It is a separate part because it tracks Part 2: a vector exists for an operator at an operator set version, so the package moves on the operator sets’ cadence rather than the core’s.</p>

<p id="_bb71b09d-d43d-10a6-0790-a1245efe1567">It is also the part most likely to be embedded in implementations, as test suites usually are, which may argue for a licence different from that of the prose. That question is open; see Annex C of Part 1.</p>
</introduction></preface><sections>

<clause id="_415d5430-a31b-dc31-4d8c-5bf83967d56d" type="scope" obligation="normative">
<title id="_f70b6ff6-6131-0e24-81e1-850dbe94b63d">Scope</title>
<p id="_1d004f09-f955-8c0c-0153-2d4457b763f2">This document specifies the conformance test package for the Open Neural Network Exchange (ONNX) format: the format of a test vector, the rules for selecting vectors against a claimed conformance class or profile, the application of numerical tolerances, and the form of a conformance report.</p>

<p id="_183da847-b36d-0c50-9878-8839dd007c3a">This document does not specify:</p>

<ul id="_9cfaabe9-b9d9-c3a7-6d41-64ee12a0eb27"><li><p id="_f9790c52-4e81-305e-4e29-3d9232081df1">the requirements being tested, which are in <eref type="inline" bibitemid="onnx-part-1" citeas="ONNX 1-1"/>;</p>
</li>
<li><p id="_78abd6de-4545-ecbc-155f-11e81c93a365">the operator definitions the vectors exercise, which are in <eref type="inline" bibitemid="onnx-part-2" citeas="ONNX 1-2"/>.</p>
</li>
</ul>
</clause>



<terms id="_d618c672-1bc9-5455-6b30-55b1f3d44ef2" obligation="normative">
<title id="_dfb2eab2-f980-6365-3c47-81d0eb272962">Terms and definitions</title><p id="_dcc01114-4d03-3550-1347-4ba901bda94c">For the purposes of this document, the following terms and definitions apply.</p>
<p id="_9a873627-f113-eba2-0d35-49daf0f9d8b1">The terms and definitions given in <eref type="inline" bibitemid="onnx-part-1" citeas="ONNX 1-1"/> also apply.</p>

<term id="_2780cd32-f8f1-737e-4b41-11b588603e8b" anchor="vector-outcome"><preferred><expression>
<name>outcome</name>
</expression>
</preferred>
<definition id="_bc7dfae2-f4ba-de33-383a-48bd80845930"><verbal-definition id="_62ef124a-a86e-eada-6944-528c58c2193d"><p id="_5e5143d1-2167-57bc-a91a-b9b1c50cde61">result of applying one <xref target="test-vector-t" style="short"><display-text>test vector</display-text></xref> to an implementation, being one of <em>pass</em>, <em>fail</em>, <em>unsupported</em> or <em>error</em></p></verbal-definition></definition>
 </term>

<term id="_682d9ede-ce6a-f00a-ac0d-20d264d17b22" anchor="test-vector-t"><preferred><expression>
<name>test vector</name>
</expression>
</preferred>
<definition id="_a590651d-c81a-a416-8b6a-9a1a9d8b33db"><verbal-definition id="_76b0c1b3-cf9b-86b0-c0ca-6ddc84440d55"><p id="_b61b226f-681c-ba0a-8821-2c014c0ac9dc">model, together with input values, expected output values and the tolerance against which they are compared</p></verbal-definition></definition>
 </term>
</terms>

<clause id="_47b71e60-a182-557b-8a5a-42c427d89727" anchor="vector-format" obligation="normative">
<title id="_d2e19c00-d609-c598-36b2-fef4c7c43b5c">Test vector format</title>
<clause id="_d0a04983-9f0d-56b3-2686-6ac09dda6836" obligation="normative">
<title id="_53d82e48-1024-e16a-9901-40ceda1ab9b0">General</title>
<p id="_6452d51b-6f50-b22b-fabd-8907f7d73831">A test vector consists of a model, one or more sets of input values, the corresponding expected output values, and the tolerance to be applied.</p>
</clause>

<clause id="_06fe1f5d-3994-e287-615f-dab402fee8a8" obligation="normative">
<title id="_4aebf958-bf71-79bb-3a57-688c9c8d4fa5">Model</title>
<p id="_56707a92-b401-148e-2c36-5d548e281ee8">The model of a test vector SHALL be a conforming model under <eref type="inline" bibitemid="onnx-part-1" citeas="ONNX 1-1"/> and SHALL declare the operator set version the vector exercises.</p>
</clause>

<clause id="_94857879-1b0e-fa6b-1010-88bd3a321740" obligation="normative">
<title id="_67d2a52d-cee7-d5bc-4c31-e8ccccd9d4d5">Values</title>
<admonition id="_519a9fd5-d9fe-780d-a830-9d334025693b" type="important">
<name id="_bd2020c7-6f42-525b-3adc-4b7573dd632c">Editorial note</name>
<p id="_0b7c2a0d-236d-e5b2-8952-1b2b8a11e4b3">Specify the encoding of input and expected output values. The reference implementation stores them as serialized tensor messages in a directory per test case; that is a workable choice and has the advantage of reusing the encoding the standard already specifies, but it must be stated normatively rather than inherited.</p>

<p id="_446c4d93-60f1-e18d-adfa-51f4179ee0e9">Specify also how values for the reduced-precision element types are stored, since those are the types for which Part 1 has no stated tolerance.</p>
</admonition></clause>

<clause id="_e8777076-95c6-ccf9-d5b5-e7f515ee6b75" obligation="normative">
<title id="_6904f1d4-639f-edf2-285f-ea397c0ccd4a">Identification</title>
<p id="_7cc62b39-e211-b915-e693-358680e7dbbc">Each vector SHALL be identified by domain, operator, operator set version and
a name unique within that triple.<note id="_1a291a3e-6472-0e10-6299-f701e206e17b"><p id="_67f2ffcc-3309-caee-7b12-0be393acddb8">The worked example in Clause 4 of <eref type="inline" bibitemid="onnx-part-2" citeas="ONNX 1-2"/> cites a vector in this form, as  <tt>ai.onnx/Relu/14</tt>.</p>
</note></p>


</clause>
</clause>

<clause id="_7f832470-5b8b-45f1-5cb8-356f0e8317fa" obligation="normative">
<title id="_df3bfc5a-10c0-51ef-1bc0-07bd8db02645">Test selection by profile</title>
<clause id="_f15a51de-63f5-2f94-6030-718f61a82c12" obligation="normative">
<title id="_0175f76d-716b-304d-d5e0-55b2c2c71130">General</title>
<p id="_33d15c23-f7c2-8f4e-33bb-53d0008039ad">An implementation is tested against the vectors implied by the conformance class and profile it claims under Clause 4 of  <eref type="inline" bibitemid="onnx-part-1" citeas="ONNX 1-1"/>.</p>
</clause>

<clause id="_fb70b6ba-91b7-cb53-f35a-b9450776a26e" obligation="normative">
<title id="_7c355efa-e236-f4b0-f79d-91d97391a9a3">Selection rules</title>
<admonition id="_145be0d4-3d33-3fa2-ebd2-8157e106bec5" type="important">
<name id="_e2328471-51c6-0251-a65b-4cc7afe0ec36">Editorial note</name>
<p id="_5ed4d217-ded9-36ff-0bc3-c860ad9e452d">State, for each conformance class, which vectors apply:</p>

<p id="_f8fffaf3-cb82-690a-595b-37da12d88a94">A producer is not exercised by input and output values at all; its vectors are models it emits, checked for conformance to Part 1. This may mean producer vectors are a different kind of artefact from evaluating-consumer vectors, and the format clause has to accommodate both or the classes need separate packages.</p>

<p id="_9dc6feaa-8d60-045d-9fc5-e9cd9245cc40">A validating consumer is exercised by deliberately non-conforming models, with the expected outcome being a specific diagnostic. No such corpus exists upstream; it has to be written, and it is the part of this package that would most improve the state of the art.</p>

<p id="_af7cd568-d6b2-a41c-311a-c84bb26c70aa">An evaluating consumer is exercised by the vectors of the operator sets it claims.</p>
</admonition></clause>

<clause id="_82d88170-48c3-3b48-c8f2-d33b067c6aab" obligation="normative">
<title id="_15c55da1-62b7-d2fb-734e-c40c9cc31e49">Unsupported operators</title>
<p id="_02d58ac9-8c71-83d0-b15e-5d2b626db941">A vector exercising an operator the implementation declares unsupported SHALL be recorded with the outcome  <em>unsupported</em>, and SHALL NOT be recorded as a failure.</p>
</clause>
</clause>

<clause id="_f84bd957-0b4d-6b2d-5876-5e81ef017034" obligation="normative">
<title id="_60f9a872-9566-ee6d-679a-c4e2bcfb3f4c">Application of tolerances</title>
<clause id="_8e169390-99e0-2769-f66a-49415751c13a" obligation="normative">
<title id="_24abdf30-6d12-8734-45d3-cd1948186a03">General</title>
<p id="_d2b9c901-0804-f4f6-710d-96ac78384673">A vector passes when every expected output value is reproduced within the tolerance stated for the vector.</p>
</clause>

<clause id="_57fccdc1-28b5-5abe-cd5d-8f9842ac87e2" obligation="normative">
<title id="_b6ab3be5-3a3a-0787-00a0-eefaeba15c19">Source of the tolerance</title>
<p id="_bac1b0c3-1916-53b1-171c-4730f4f0bcf2">The tolerance is that of Clause 11 of <eref type="inline" bibitemid="onnx-part-1" citeas="ONNX 1-1"/> for the element type concerned, unless the vector states a tighter one.</p>

<admonition id="_2dff8cd5-e032-c213-2e19-d83ec7c8ca4f" type="important">
<name id="_c0a0e9d3-1068-9d64-16fd-80e6003a0e75">Editorial note</name>
<p id="_aa122f37-ba54-1972-7201-b2e828c5cee8">This clause cannot be completed before Clause 11 of <eref type="inline" bibitemid="onnx-part-1" citeas="ONNX 1-1"/> states a tolerance model; Annex C of that part records the absence as the largest blocking gap in the standard, and this clause is why it blocks. Without a tolerance there is no predicate that decides pass from fail, and a test package with no predicate is a collection of examples.</p>
</admonition></clause>

<clause id="_1d59ee68-5fb4-36de-13a1-ef72cabfd7ba" obligation="normative">
<title id="_2cb70d42-679e-7800-2f1a-a3bcd5506416">Comparison</title>
<admonition id="_94a488b5-fc2a-2b16-5938-80150034ff58" type="important">
<name id="_e4f9750e-04c6-c087-13d5-5598e6c3c37b">Editorial note</name>
<p id="_5f29b4ca-974a-1a80-df17-7ecb302765f2">Specify the comparison itself: whether relative and absolute tolerances are combined conjunctively or disjunctively, how NaN compares to NaN, how the infinities compare, and whether an exact match is required for the integer and Boolean element types. These are small decisions individually and decide the outcome of vectors collectively.</p>
</admonition></clause>
</clause>

<clause id="_9f1c9c46-689b-01a8-648d-a711757a806c" obligation="normative">
<title id="_4715adf7-ccff-bf69-c718-6abfaa843ce6">Reporting</title>
<clause id="_3c4126a1-973f-8a08-c043-ea4bd1708586" obligation="normative">
<title id="_1d0a0e6e-9129-6d18-fb0a-a14109f5544f">General</title>
<p id="_19019fdb-5a89-91df-c28a-e272f57ab368">A conformance report records the outcome of every vector selected under Clause 5.</p>
</clause>

<clause id="_d929b202-8ca9-5dc3-d2fa-dd6a852ea336" obligation="normative">
<title id="_dbdda25d-3371-d62d-b62a-b009bbd559ae">Content</title>
<p id="_ab3788f3-851b-add3-46e3-a562b75f4d9e">A conformance report SHALL state:</p>

<ul id="_45371971-6bb6-187f-c84f-8b1cc3c4a091"><li><p id="_32fc24fe-9df0-dca4-7fe0-d0c2d0d93fa4">the identity and version of the implementation;</p>
</li>
<li><p id="_89903b81-c820-a652-25d0-6e40bc67f60d">the version of this package used;</p>
</li>
<li><p id="_5d5904e7-9e7d-6681-7348-ed9baaf2ad49">the conformance class and profile claimed;</p>
</li>
<li><p id="_de9cbf30-b1ed-2cb0-6f18-0fed29bccec6">for each vector, its identifier and its <xref target="vector-outcome" style="short"><display-text>outcome</display-text></xref>;</p>
</li>
<li><p id="_b5494d98-2ba3-b1b1-e017-9e17eb515070">for each vector with the outcome <em>fail</em>, the achieved deviation.</p>
</li>
</ul>
</clause>

<clause id="_d1b45983-7842-e2cf-87fd-5586d601de8a" obligation="normative">
<title id="_209330e4-2b29-55eb-2e6b-2ed3c04f9453">Relationship to the conformance statement</title>
<p id="_b0360f3c-7392-1a51-6813-35ad2dd2c3be">The conformance statement required by Annex A of <eref type="inline" bibitemid="onnx-part-1" citeas="ONNX 1-1"/> SHALL cite the report produced under this clause.</p>
</clause>
</clause>




</sections><annex id="_032d88d0-b578-93a6-3b82-1161eeab8e3c" obligation="normative">
<title id="_e922ce56-be4b-ee31-3f22-ff363cd80482">Test vectors</title>
<p id="_44a225b6-0ab4-3be3-1236-0a35841ed61a">The vectors themselves are published as a separate artefact, in the format specified in  <xref target="vector-format" style="short"/>, and are normative.</p>

<admonition id="_00e5d69b-845d-4e7d-5008-30e0f8287d79" type="important">
<name id="_ca6f4262-0a50-5a78-a5f3-1d7a33fd2e59">Editorial note</name>
<p id="_5b454c32-675e-7c4b-6d16-87ff0f25467f">The vectors are data, not prose, and are not reproduced in this document. This annex is to state where they are published, how a version of the package is identified, and what guarantees hold across versions — in particular whether a vector, once published, may change.</p>

<p id="_e7e831cc-6692-afb1-15f0-73c3716dd21b">The obvious starting corpus is the reference implementation’s backend test data, which is vendored in documentation form at <tt>upstream/onnx/docs/OnnxBackendTest.md</tt>. Adopting it means deciding what its existing tolerances mean normatively, which returns to the open question in Clause 6.</p>
</admonition></annex><bibliography><references id="_a3d203f2-27e4-3747-e49c-bee08d55c833" normative="true" obligation="informative">
<title id="_270c5ee6-077e-f285-ff95-287984a30140">Normative references</title><p id="_49996d2b-65c1-916b-9bbf-42b933aa0025">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>


<bibitem anchor="onnx-part-1" id="_3bed526e-25cb-781c-d7d6-23bcc1096c9b"><formattedref format="application/x-isodoc+xml"><em>Open Neural Network Exchange (ONNX) —- Part 1:
Core</em></formattedref><docidentifier>ONNX 1-1</docidentifier><docnumber>1-1</docnumber><language>en</language><script>Latn</script></bibitem>
<bibitem anchor="onnx-part-2" id="_fe74e4ed-7b72-f528-62a7-6494cf2d507f"><formattedref format="application/x-isodoc+xml"><em>Open Neural Network Exchange (ONNX) —- Part 2:
Operator sets</em></formattedref><docidentifier>ONNX 1-2</docidentifier><docnumber>1-2</docnumber><language>en</language><script>Latn</script></bibitem>
</references><references id="_f5bfac26-f077-b00c-695d-c9272e2187c8" normative="false" obligation="informative">
<title id="_50ceb1e1-516f-2673-d73d-4f0c58b4d023">Bibliography</title><bibitem anchor="onnxrepo" id="_59cd5a5f-6f1c-4af7-e50e-4878ff7cc389">
  <formattedref format="application/x-isodoc+xml"><em>Open Neural Network Exchange</em>, <link target="https://onnx.ai"/></formattedref>
  <docidentifier>ONNX</docidentifier>
  <language>en</language>
  <script>Latn</script>
</bibitem>

</references></bibliography>
</metanorma>
