+ 0 <= ki_h < kernel.w_h ==>
+ 0 <= ki_w < kernel.w_w ==>
+ (0 <= hi * attr.stride[0] + ki_h * attr.dilations[0] - attr.pads[0]) &&
+ (hi * attr.stride[0] + ki_h * attr.dilations[0] - attr.pads[0] < inp.x_h) &&
+ (0 <= wi * attr.stride[1] + ki_w * attr.dilations[1] - attr.pads[1]) &&
+ (wi * attr.stride[1] + ki_w * attr.dilations[1] - attr.pads[1] < inp.x_w) ==>
+ out.y[bi * (out.y_c * out.y_h * out.y_w) + ci * (out.y_h * out.y_w) + hi * out.y_w + wi] == inp.x[bi * (inp.x_c * inp.x_h * inp.x_w) + ci_in * (inp.x_h * inp.x_w) + (hi * attr.stride[0] + ki_h * attr.dilations[0] - attr.pads[0]) * inp.x_w + ( wi * attr.stride[1] + ki_w * attr.dilations[1] - attr.pads[1])] * kernel.w[ci * (kernel.w_c_in * kernel.w_h * kernel.w_w) + ci_in * (kernel.w_h * kernel.w_w) + ki_h * kernel.w_w + ki_w] + bias.b[ci];
+
+
+
+
+
+
+
+ */
+float* conv(input_tensor inp, convolution_kernel kernel, bias_tensor bias, attributes attr, output_tensor out) {
+
+ out.y_h = ((inp.x_h + attr.pads[0] + attr.pads[2] - (attr.dilations[0] * kernel.w_h )) / attr.stride[0]) + 1;
+ out.y_w = ( (inp.x_w + attr.pads[1] + attr.pads[3] - (attr.dilations[1] * kernel.w_w )) / attr.stride[1]) +1;
+ int y_size = out.y_b * out.y_c * out.y_h * out.y_w;
+ out.y = (float *)malloc(y_size * sizeof(float));
+
+ if (out.y == NULL) {
+ fprintf(stderr, "Memory allocation failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ // Compute padding
+ // compute_pad(attr.auto_pad, attr.pads, attr.stride, inp.x_h, inp.x_w, kernel.w_h, kernel.w_w, out.y_h, out.y_w, attr.pads);
+
+ // Initialize result tensor to bias values
+ for (int bi = 0; bi < out.y_b; ++bi) {
+ for (int ci = 0; ci < out.y_c; ++ci) {
+ for (int hi = 0; hi < out.y_h; ++hi) {
+ for (int wi = 0; wi < out.y_w; ++wi) {
+ int y_idx = bi * (out.y_c * out.y_h * out.y_w) + ci * (out.y_h * out.y_w) + hi * out.y_w + wi;
+ out.y[y_idx] = bias.b[ci];
+ }
+ }
+ }
+ }
+
+ // Convolution computation
+ for (int bi = 0; bi < out.y_b; ++bi) {
+ for (int ci = 0; ci < out.y_c; ++ci) {
+ for (int hi = 0; hi < out.y_h; ++hi) {
+ for (int wi = 0; wi < out.y_w; ++wi) {
+ int y_idx = bi * (out.y_c * out.y_h * out.y_w) + ci * (out.y_h * out.y_w) + hi * out.y_w + wi;
+
+ for (int ci_in = 0; ci_in < kernel.w_c_in; ++ci_in) {
+ for (int ki_h = 0; ki_h < kernel.w_h; ++ki_h) {
+ for (int ki_w = 0; ki_w < kernel.w_w; ++ki_w) {
+ int x_h_idx = hi * attr.stride[0] + ki_h * attr.dilations[0] - attr.pads[0];
+ int x_w_idx = wi * attr.stride[1] + ki_w * attr.dilations[1] - attr.pads[1];
+
+ if (x_h_idx >= 0 && x_h_idx < inp.x_h && x_w_idx >= 0 && x_w_idx < inp.x_w) {
+ int x_idx = bi * (inp.x_c * inp.x_h * inp.x_w) + ci_in * (inp.x_h * inp.x_w) + x_h_idx * inp.x_w + x_w_idx;
+ int w_idx = ci * (kernel.w_c_in * kernel.w_h * kernel.w_w) + ci_in * (kernel.w_h * kernel.w_w) + ki_h * kernel.w_w + ki_w;
+
+ if (x_idx < inp.x_h * inp.x_w * inp.x_c * inp.x_b && w_idx < kernel.w_h * kernel.w_w * kernel.w_c_in * kernel.w_c_out) {
+ out.y[y_idx] += inp.x[x_idx] * kernel.w[w_idx];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return out.y;
+}
+```
+
+# Graph execution semantics
+
+
+
+[NOTE:] Elements of the execution semantics is given on the [IR (Intermediate
+Representation) page](https://onnx.ai/onnx/repo-docs/IR.html) of the
+ONNX web site. In addition, a Python “reference implementation” is also
+provided (see ). The source
+code of this implementation can be found at
+.
+
+Very informally, the semantics is pretty simple: each operator (or
+function) is called according to its position in the topological sorting
+of the operators. The topological order is a partial order that ensures
+that an operator is executed only when its inputs are available. Being a
+partial order, it means that several valid orders exist for a given
+graph. Normally (?) each order should generate the same result, even in
+the presence of floating point operations.
+
+The Python code to execute a graph is given in class
+[`ReferenceEvaluator`](https://github.com/onnx/onnx/blob/main/onnx/reference/reference_evaluator.py)).
+After having processed the inputs and the initializers (i.e., fed the
+`results` dictorionary with these data), the nodes are executed in
+sequence. For each operator, the interpretor checks that its inputs are
+in the `results` dictionary. If they are not, an error is raised (if the
+operators are listed in topological order, this situation should not
+occur). Otherwise, the operator is simply executed (method `run`) with
+or without a context (composed of the current results) depending on the
+type of operators. (Check that this does not create a dependency to the
+total order of operators.)
+
+
+
+### Informal specification
+
+
+
+[NOTE:] The semantics of an ONNX model is given in Section "Model Semantics" of
+the [Intermediate
+Representation](https://github.com/onnx/onnx/blob/main/docs/IR.md) page.
+Basically, an inference-model is a stateless function (except possibly
+for some specific nodes such as a random-generation node) represented by
+an acyclic `graph` of nodes. The `graph` is mainly represented by a set
+of inputs and outputs and a topologically sorted list of nodes. Each
+node represents a call to an operator or a function. A `function` is
+itself a graph.
+
+Note that the types of inputs and outputs are not systematically
+required because they can be inferred. In our case, I guess that we will
+forbib shape inference and rely on static tensor shapes (or, at least,
+shape inference can be bone before serializing the model). The proecss
+of shape inference is described in Section [ONNX Shape
+Inference](https://onnx.ai/onnx/repo-docs/ShapeInference.html).
+
+
+
+### Formal specification
+
+*To be completed.*
+
+[^1]: At least in a first phase...
+
+[^2]: Note: in the ONNX runtime implementation, the padding value may be
+ negative, which corresponds to reducing the size of the tensor.
+
+[^3]: See [Why3 documentation](https://www.why3.org/)
+
+[^4]: See [Frama-C
+ documentation](https://www.frama-c.com/html/documentation.html)
diff --git a/safety-related-profile/documents/conv_specification_example/imgs/README.md b/safety-related-profile/documents/conv_specification_example/imgs/README.md
new file mode 100644
index 00000000..4a389a0a
--- /dev/null
+++ b/safety-related-profile/documents/conv_specification_example/imgs/README.md
@@ -0,0 +1 @@
+Images used in the CONV specification example
diff --git a/safety-related-profile/documents/conv_specification_example/imgs/autopad.png b/safety-related-profile/documents/conv_specification_example/imgs/autopad.png
new file mode 100644
index 00000000..614f6942
Binary files /dev/null and b/safety-related-profile/documents/conv_specification_example/imgs/autopad.png differ
diff --git a/safety-related-profile/documents/conv_specification_example/imgs/conv.png b/safety-related-profile/documents/conv_specification_example/imgs/conv.png
new file mode 100644
index 00000000..c9a13486
Binary files /dev/null and b/safety-related-profile/documents/conv_specification_example/imgs/conv.png differ
diff --git a/safety-related-profile/documents/conv_specification_example/imgs/conv_stride.png b/safety-related-profile/documents/conv_specification_example/imgs/conv_stride.png
new file mode 100644
index 00000000..b8172b2c
Binary files /dev/null and b/safety-related-profile/documents/conv_specification_example/imgs/conv_stride.png differ
diff --git a/safety-related-profile/documents/conv_specification_example/imgs/dilation.png b/safety-related-profile/documents/conv_specification_example/imgs/dilation.png
new file mode 100644
index 00000000..69a332c8
Binary files /dev/null and b/safety-related-profile/documents/conv_specification_example/imgs/dilation.png differ
diff --git a/safety-related-profile/documents/conv_specification_example/imgs/grouped_convolution.png b/safety-related-profile/documents/conv_specification_example/imgs/grouped_convolution.png
new file mode 100644
index 00000000..dfdf868c
Binary files /dev/null and b/safety-related-profile/documents/conv_specification_example/imgs/grouped_convolution.png differ
diff --git a/safety-related-profile/documents/conv_specification_example/imgs/pad.png b/safety-related-profile/documents/conv_specification_example/imgs/pad.png
new file mode 100644
index 00000000..6abaccb4
Binary files /dev/null and b/safety-related-profile/documents/conv_specification_example/imgs/pad.png differ
diff --git a/safety-related-profile/documents/conv_specification_example/imgs/why3_workflow.png b/safety-related-profile/documents/conv_specification_example/imgs/why3_workflow.png
new file mode 100644
index 00000000..97ceb89e
Binary files /dev/null and b/safety-related-profile/documents/conv_specification_example/imgs/why3_workflow.png differ
diff --git a/safety-related-profile/documents/issues.md b/safety-related-profile/documents/issues.md
new file mode 100644
index 00000000..efd381f6
--- /dev/null
+++ b/safety-related-profile/documents/issues.md
@@ -0,0 +1,232 @@
+# ONNX analysis
+
+## Issue #TEMPLATE: Title of the issue
+
+- CAT: category in {__OPERATOR__ , __GRAPH__ , __FORMAT__}
+- CRIT: criticality in { __LOW__ , __HIGH__ }
+- REQ: _Identification of the SONNX requirement that can't be satisfied due to this issue_
+- LOC: __Identification of the exact location in the standard, possibly using an hyperlink__
+
+### Issue
+__Description of the issue (in a synthetic way)__
+
+### Consequence
+__Brief description of the effect the issue on the development activities.__
+
+### Proposal
+__Proposal to solve the issue or mitigate the consequences__
+
+### Remarks (opt)
+__Additional remarks__
+
+
+## Issue #1: incomplete specification of CONV operator
+- CAT: Operator
+- CRI: HIGH
+- REQ: (TBC)
+- LOC: [CONV operator](https://onnx.ai/onnx/operators/onnx__Conv.html), but this issue appear in other operators
+
+### Issue
+The description of the CONV operator is very abstract: "The convolution operator consumes an input tensor and a filter, and computes the output.".
+
+The value of the padding is not defined (it is actually 0).
+
+Presentation of attributes makes it difficult to check if all dependencies are expressed.
+
+### Consequence
+Implementer needs to check the referece implementation (or other doc.) to understand what needs to be implemented. Different implementation may lead to different results.
+
+### Proposal
+See [example](https://github.com/ericjenn/working-groups/tree/ericjenn-srpwg-wg1/safety-related-profile/documents/conv_specification_example)
+
+## Issue #2: Execution order of graph nodes
+- CAT: GRAPH
+- CRI: LOW
+- REQ: (TBC)
+- LOC: [Open Neural Network Exchange Intermediate Representation (ONNX IR) Specification](https://github.com/onnx/onnx/blob/main/docs/IR.md)
+
+### Issue
+The ONNX specification states that "Each computation dataflow graph is structured as a topologically sorted list of nodes that form a graph, which MUST be free of cycles. [...] ". The topological order is a partial order.
+
+### Consequence
+Different implementations may execute nodes in different orders, leading to different results when computations are done using floating poit numbers.
+
+### Proposal
+The SONNX standard should provide a means to impose a total ordering on the nodes.
+
+### Remarks
+This constraint will prevent optimisations.
+Note that nothing prevents a model to be ill-formed. Compliance with the syntax and semantics of the ONNX standard must be checked (it is certainly checked, but nothing is said about what is checked or not and whether these checkers are complete / correct or not).
+
+Other constraints are given in the [onnx-ml.proto3](https://github.com/onnx/onnx/blob/main/onnx/onnx-ml.proto3). E.g.:
+
+ // One FunctionProto can reference other FunctionProto in the model, however, recursive reference
+ // is not allowed.
+
+## Issue #3: Overloading
+
+- CAT: (to be completed)
+- CRIT: (to be completed)
+- REQ: (to be completed)
+- LOC: ONNX file format definition ([onnx-ml.proto3](https://github.com/onnx/onnx/blob/main/onnx/onnx-ml.proto3))
+
+### Issue
+A [function in ONNX](https://onnx.ai/onnx/intro/concepts.html) is a way to reuse the same combination of operators at different locations in a model. A function may refer to operators that are in a different opset than the model itself. In that case, the standard leaves the runtimes the freedom to chose whether the local
+
+ // The (domain, name, overload) tuple must be unique across the function protos in this list.
+ // In case of any conflicts the behavior (whether the model local functions are given higher priority,
+ // or standard operator sets are given higher priotity or this is treated as error) is defined by
+ // the runtimes.
+
+### Consequence
+(TBC)
+
+### Proposal
+(TBC)
+
+### Remarks (opt)
+(TBC)
+
+
+## Issue #4: opset resolution
+
+- CAT: (to be completed)
+- CRIT: (to be completed)
+- REQ: (to be completed)
+- LOC: ONNX file format definition ([onnx-ml.proto3](https://github.com/onnx/onnx/blob/main/onnx/onnx-ml.proto3))
+
+### Issue
+A [function in ONNX](https://onnx.ai/onnx/intro/concepts.html) is a way to reuse the same combination of operators at different locations in a model. A function may refer to operators that are in a different opset than the model itself. In that case, the standard leaves the runtimes the freedom to chose whether the local
+
+ // The (domain, name, overload) tuple must be unique across the function protos in this list.
+ // In case of any conflicts the behavior (whether the model local functions are given higher priority,
+ // or standard operator sets are given higher priotity or this is treated as error) is defined by
+ // the runtimes.
+
+### Consequence
+(TBC)
+
+### Proposal
+(TBC)
+
+### Remarks
+As per the ONNX IR documentation: "each function contained in a Model (also referred to as a model-local function) serves as a default or fallback implementation of the corresponding operator. A runtime, however, may choose to use an alternative implementation of the operator (usually as an optimized kernel). As such, the unique name of a function is significant as it is implicitly associated with a semantic specification."
+
+From opset10 onwards, a function is uniquely identified by the triple (domain, name, overload).
+
+
+## Issue #4: Function polymorphism
+
+- CAT: (TBC)
+- CRI: (TBC)
+- REQ: (TBC)
+- LOC: [Shape inference in ONNX](https://onnx.ai/onnx/api/shape_inference.html), this also covers type inference.
+
+### Issue
+Function tensor input and output data type and shape are not specified by the ONNX format. Actual types are obtained using type inference.
+
+### Consequence
+The actual types and shapes are not explicit in the model: they can only be knwon once the input tensors are known.
+
+### Proposal
+Enforce that all tensor data types and shapes are explicit in the model.
+
+### Remarks (opt)
+
+## Issue #5: Shape broadcasting
+
+- CAT: (TBC)
+- CRI: (TBC)
+- REQ: (TBC)
+- LOC: [Broadcasting in ONNX](https://github.com/onnx/onnx/blob/main/docs/Broadcasting.md)
+
+### Issue
+The broadcasting logic is insufficiently specified on the ONNX documentation.
+
+### Consequence
+(TBC)
+
+### Proposal
+(TBC)
+
+### Remarks
+About broadcasting, see the [dedicated section of the NumPy manual ](https://numpy.org/doc/stable/user/basics.broadcasting.html#general-broadcasting-rules)
+
+## Issue #6: Overloading
+
+- CAT: (TBC)
+- CRI: (TBC)
+- REQ: (TBC)
+- LOC: See section on Functions in [Open Neural Network Exchange Intermediate Representation (ONNX IR) Specification](https://github.com/onnx/onnx/blob/main/docs/IR.md)
+
+### Issue
+IR version 10 introduces overloading, i.e. the capability to have several definitions for the same function, and select them using a new ‘overloading’ field.
+
+
+### Consequence
+(TBC)
+
+### Proposal
+(TBC)
+
+
+## Issue #7: Variadic inputs
+
+- CAT: (TBC)
+- CRI: (TBC)
+- REQ: (TBC)
+- LOC:
+
+### Issue
+Variadic operators can accept any number of inputs.
+
+
+### Consequence
+(TBC)
+
+### Proposal
+Introduce a maximal number of parameters.
+
+### Remarks
+
+## Issue #8: Dynamic (Node input) vs static (Node attribute)
+
+- CAT: (TBC)
+- CRI: (TBC)
+- REQ: (TBC)
+- LOC:
+
+### Issue
+The semantics is not clear that Node input is dynamic and Node attribute is static.
+As attributes can take Tensor values, these values might come from other Nodes (constant or not)
+
+
+
+### Consequence
+(TBC)
+
+### Proposal
+Introduce a maximal number of parameters.
+
+### Remarks
+
+
+## Issue #9: Data storage
+
+- CAT: (TBC)
+- CRI: LOW
+- REQ: (TBC)
+- LOC: [onnx-ml.proto3](https://github.com/onnx/onnx/blob/main/onnx/onnx-ml.proto3#L611)
+
+### Issue
+
+### Consequence
+(TBC)
+
+### Proposal
+
+### Remarks
+
+ONNX supports __typed__ and __raw__ serialization of data. When __raw_data__ are used, the standard specifies that data must be stored in as "fixed-width, little endian order" with other specific constraints for float64, complex64, etc. data.
+
+Do we need to specify our own encoding format?
diff --git a/safety-related-profile/documents/sow.md b/safety-related-profile/documents/sow.md
new file mode 100644
index 00000000..2085ad0f
--- /dev/null
+++ b/safety-related-profile/documents/sow.md
@@ -0,0 +1,396 @@
+# Introduction
+
+## Terms
+
+The following terms are used in the document:
+
+- **Trained ML model**: the conceptual structure of graphs and
+ operators that maps a set of input tensors to a set of output
+ tensors. The Trained ML Model Description (TMD) is represented using
+ the *Trained Model Description Language* (TMDL).
+
+- **Trained ML Model Description** (TMD: a concrete representation of
+ the conceptual trained ML Model that can be interpreted by a human
+ or a program.
+
+- **Trained ML Model Description** **Language** (TMDL): The language
+ used to represent a *Trained ML Model* (TMD).
+
+## Contents
+
+This document gives a first definition of the activities to be carried
+out by the ONNX safety-related profile workgroup. This "workplan" is
+aimed at being presented *and discussed* during the Workgroup kick-off
+meeting planned for the end of September.
+
+## Main objectives
+
+Provide a definition of the formalism used to represent a trained ML
+model\...
+
+- *\... that has an understandable and non ambiguous syntax and
+ semantics.*
+
+ The description of the ML model expressed using this formalism must
+ be a Low level Requirement for the implementation phase in the sense
+ that its interpretation and implementation shall not require any
+ further information that the one given by the description of the ML
+ model.
+
+- *\... that allows multiple levels of accuracy and precision for the
+ description of a given model.*
+
+ The language used to describe the model (i.e., its syntax and
+ semantics) must be non ambiguous, but a model may be ambiguous if
+ this ambiguity is acceptable or even necessary to leave some freedom
+ to the implementer (e.g., for optimization). The objective is to
+ identify, control, and possibly remove this ambiguity by an
+ appropriate refinement of the ML model description.
+
+# Workgroup Activities
+
+This section presents the different activities of the workgroup. Their
+dependencies are expressed via their inputs/outputs.
+
+### A1 - Elicitation of industrial needs and requirements
+
+#### Objectives
+
+- Elicit end-users needs related to the ONNX format, i.e., What are
+ the activities using ONNX models?, What are the evidences required
+ by certification authorities that involve the ONNX model[^1]?, How
+ do the ONNX model impact these activities?,
+
+- Elicit requirements applicable to the ONNX standard to satisfy the
+ end-users needs. Those requirements shall cover all aspects of the
+ standard, including documentation, graphs and operators semantics,
+ file format, reference implementation, etc.
+
+#### Rationales {#rationales .unnumbered}
+
+Clarify the expectation of end-users. Ensure that the requirements for
+ONNX are traceable to one or several end-users' needs.
+
+#### Inputs
+
+- Certification standards (e.g., ARP6983, ISO/DPAS 8800,
+ ECSS-E-HB-40-02A DIR1, etc.)
+
+- Company-specific requirements
+
+#### Outputs
+
+- D1.a.\: End users needs and requirements for domain \.
+
+#### Detailed activities
+
+The activities defined below are per domain.
+
+##### End-Users Needs Elicitation
+
+- UNAct1: Definition of the *Trained Model Description (TMD)* artefact
+ (e.g., the Machine Learning Model Description (MLMD) in ARP6983)
+
+- UNAct2: Description (overview) of the machine learning development
+ process
+
+- UNAct3: Description of the development process objectives and
+ activities that:
+ - Produce the TMD
+ - Take the TMD as input
+
+- UNAct4: Description of the development process verification
+ objectives and activities that apply to the TMD
+
+- UNAct5: Constraints on the TDM, that come from:
+ - the Development and verification activities
+ - the Industrial context
+
+- UNAct6: Expression of the needs
+
+##### *ONNX Requirements Expression*
+
+The activities below take the end-user needs as inputs
+
+- ORAct1: Definition of the list of the aspects to which the
+ requirements for a safety-related ONNX profile will apply, e.g.,
+ - Semantics of the operators
+ - Semantics of the graph
+ - Data types
+ - Metamodel
+ - Concrete syntax (format)
+ - Documentation
+ - Traceability
+ - Versioning
+ - etc.
+
+- ORAct2: For each aspect of the list, definition of the requirements
+ *Examples of requirements that may be expressed:*
+ - The semantics of the Trained Model Description Language (TMDL) used
+ to describe the TMD shall be defined both informally (for
+ documentation purposes) and formally using a mathematically-grounded
+ language. This covers all that is needed for tooled and/or human
+ interpretation of any valid TMD described using the TMDL (including,
+ (e.g., operators and graphs).
+ - The formal definition of the TMDL shall define precisely and
+ accurately the expected results of the interpretation of any valid
+ TMDL model. The level of precision and accuracy may be a parameter
+ of the description of the semantics.
+ - A reference implementation shall be provided for each operator. The
+ reference implementation shall be accompanied with all the necessary
+ information describing the execution environment used to validate
+ compliance with the formal specification.
+ - In the TMD, it should be possible to indicate the meaning of each
+ dimension of the tensors
+
+### A2: Consolidate Requirements for the ONNX profile
+
+#### Objectives
+
+- Consolidate, filter, and prioritize the requirements identified for
+ the different industrial domains in D1.a.\.
+
+- Discriminate requirements aimed at the preservation of the model
+ semantics from requirements aimed at facilitating / supporting other
+ development assurance activities.
+
+#### Rationale
+
+The ONNX Safety-related profile must be unique whereas the needs comes
+from different industrial domains, referring different certification
+standards. This activity is aimed at defining a consensual and
+consistent set of requirements.
+
+#### Inputs
+
+- D1.a.\: End users needs and requirements for domain \.
+
+#### Outputs
+
+- (D2.a) ONNX safety-related Profile Requirements
+
+#### Detailed activities
+
+##### Consolidation of requirements
+
+- CRAct1: Consolidation and fusion of semantically equivalent
+ requirements
+
+- CRAct2: Grouping and prioritization of requirements
+
+### A3: Definition of the Scope of the ONNX Safety related profile
+
+#### Objectives
+
+- Selection of the set of operators and constructs to be considered in
+ the Safety-related profile.
+
+#### Rationale
+
+In order to keep the effort reasonable and maximize or chance to produce
+useful results within a reasonable time frame, we propose to work on a
+restricted set of operators and constructs. This set will be defined
+according to the actual needs of the end-users (i.e., the models they
+want to implement).
+
+#### Inputs
+
+- End user use cases
+
+#### Outputs
+
+- (D3.a) Safety-related Profile Scope Definition
+
+#### Detailed activities
+
+##### Definition of the Safety-related Standard Scope
+
+- DSCAct1: Identification/definition of the Safety-related industrial
+ use case reference models
+
+- DSCAct2: Extraction of the operators and constructs from the
+ Safety-related industrial use cases reference models
+
+- DSCAct3: Consolidation of the TMDL operators and constructs for the
+ Safety-related profile, from the reference models possibly augmented
+ with necessary additional operators and constructs.
+
+### A4: Analysis of the ONNX standard
+
+#### Objectives
+
+- Identify the parts of the standard that need to be updated /
+ clarified / modified in order to comply with the Safety-related
+ Profile Requirements defined in D2.a, for the subset of the standard
+ identified in D3.a.
+
+#### Rationales
+
+Once the requirements for the format are defined, the work consists to
+find what needs to be described, improved, fixed,\... in the existing
+ONNX standard. In particular, all elements that are unclear or which
+interpretation is left to the implementer shall be spotted, analysed,
+discussed, and a proposal for clarification/correction may be proposed
+if required. These proposals may be applicable to a whole part of the
+standard e.g. a recommendation may concern the documentation of all
+operators).
+
+#### Inputs
+
+- (D2.a) Requirements applicable to the ONNX profile
+
+- (D3.a) Safety-related Profile Scope Definition
+
+#### Outputs
+
+- (D4.a) ONNX Analysis and Recommendations for the Safety-related
+ Profile
+
+#### Detailed activities
+
+##### Analysis of the ONNX standard
+
+- AnaAct1: Analysis of the compliance of the ONNX standard with
+ respect to each of the requirements and identification of
+ non-compliances.
+
+- AnaAct2: Provision of recommendations, solutions, guidance to modify
+ the ONNX standard.
+
+### A5: Elaboration of the specification guidelines
+
+#### Objectives
+
+State of the Art and proposal of guidelines for the specification of the
+graph and operators to comply with D4.a.
+
+#### Rationales
+
+Various approaches and notations may be used to specify the graph and
+operators in a formal way. This activity is aimed at proposing a
+solution acceptable with respect to the end-users needs and
+requirements.
+
+#### Inputs
+
+- (D2.a) Requirements applicable to the ONNX profile
+
+#### Outputs
+
+- (D5.a) Specification Guidelines
+
+#### Detailed activities
+
+##### Prototype guidelines
+
+- ProAct1: Elaborate a first set of (informal + formal) specification
+ guidelines and apply them on a few operators (e.g., conv) and
+ constructs in order to discussed and reviewed by the workgroup
+
+##### Elaborate guidelines
+
+- • ElaAct1: Elaborate the final set of guidelines (including
+ notation, presentation of the specification, etc. to ensure a
+ consistent presentation of the specification)
+
+### A6: Development of the ONNX Safety-related profile - semantics
+
+#### Objectives
+
+Development of the ONNX Safety-related profile semantics to address
+issues identified in (D4.a), using the formalism and approach defined in
+D5.a
+
+#### Inputs
+
+- (D4.a) ONNX Analysis and Recommendations for the Safety-related
+ Profile
+
+- (D5.a) Formal Specification Guidelines
+
+#### Outputs
+
+- (D6.a) ONNX Safety-related profile (graph execution part)
+
+- (D6.b) ONNX Safety-related profile (operators part)
+
+- (D6.c) ONNX Safety-related profile reference implementation
+
+Detailed activities *To be completed.*
+
+### A7: Development of the ONNX Satefy-related profile - format
+
+#### Objectives
+
+Development of the ONNX Safety-related exchange format in compliance
+with the recommendations given in (D4.a).
+
+#### Inputs
+
+- (D4.a) ONNX Analysis for the Safety-related Profile
+
+- ONNX standard
+
+#### Outputs
+
+- (D7.a) ONNX Safety-related profile format
+
+#### Detailed activities
+
+*To be completed.*
+
+### A8: Verification of the ONNX Safety-related profile
+
+#### Objectives
+
+Verification of the ONNX Safety-related profile vs the requirements
+expressed in (D2.a), the recommendations identified in (D4.a) and the
+guidelines defined in (D5.a)
+
+#### Inputs
+
+- (D4.a) ONNX Analysis and Recommendations for the Safety-related
+ Profile
+
+- (D5.a) Formal Specification Guidelines
+
+- (D6.a) ONNX Safety-related profile (graph execution part)
+
+- (D6.b) ONNX Safety-related profile (operators part)
+
+- (D6.c) ONNX Safety-related profile reference implementation
+
+- (D7.a) ONNX Safety-related profile format
+
+#### Outputs
+
+- (D8.a) ONNX Safety-related profile verification report
+
+Detailed activities *To be completed.*
+
+### A9: Validation of the ONNX Safety-related profile
+
+#### Objectives
+
+Validation of the ONNX Safety-related profile vs the End-users needs
+expressed in the various per domain D1.a.\ documents.
+
+#### Inputs
+
+- D1.a.\: End users needs and requirements for domain \.
+
+- (D6.a) ONNX Safety-related profile (graph execution part)
+
+- (D6.b) ONNX Safety-related profile (operators part)
+
+- (D6.c) ONNX Safety-related profile reference implementation
+
+- (D7.a) ONNX Safety-related profile format
+
+#### Outputs
+
+- (D9.a) ONNX Safety-related profile validation report
+
+Detailed activities *To be completed.*
+
+[^1]: E.g., those concerning the MLMD in the ARP6983/ED-324.
diff --git a/safety-related-profile/meetings/2024-08-21.md b/safety-related-profile/meetings/2024-08-21.md
new file mode 100644
index 00000000..24e42700
--- /dev/null
+++ b/safety-related-profile/meetings/2024-08-21.md
@@ -0,0 +1,68 @@
+# SONNX meeting (21/08)
+
+## Object
+
+- ONNX Safety-related workgroup meeting
+
+## Attendees
+
+- Mariem, Nicolas, Augustin, Eric
+
+## Minutes
+
+- Status of actions (see below)
+- Brief recap of the work done on the CONV operator (Mariem)
+ - The Why3 specification is now complete thanks to Loïc. A FrameC implementation is also available.
+
+
+ - [ ] <21/08> (Mariem) Convert the CONV operator specification to markdown.
+ - After discussion with Loïc, the appropriate solution would be first to “axiomatize” tensors (in the same way it has already been done for matrices).
+
+
+ - [ ] <21/08> (Mariem, eric, Loïc) Propose an first axiomatization of tensors (3D, 4D) and use it to specify the CONV operator.
+- Discussion of Nicolas’ comments on the SOW
+ - Four points were discussed
+ - We have introduced new terms (”TMD, TMDL) that are neither used in the ONNX community (where the term “ONNX IR” is used) nor in the ARP (where the term “MLMD” is used). We have either to stick to one of those — possibly ONNX’ — or at least explain the correspondence between them…
+ - Nicolas mentioned that we have to “address the semantic of the model storage (ONNX IR for safety critical) […]”.
+ - Yes, this should be covered by the activities concerning the semantics and the syntax of the model description language. Nicolas also raised the question about discriminating the model used during the design and the model used as the starting point of the implementation. *But it is not clear whether we really need to discriminate them: we are only concerned by the semantics of the model, whatever its used.* However, we will not consider operators used during training, so our profile will only be applicable during inference…
+ - Nicolas what not happy with the remark about “ambiguous” models (sentence “[…] ambiguous if this ambiguity is acceptable or even necessary to leave some freedom to the implementer […]): *I do not see any reason for that. The model shall be unambiguous. If the implementer chooses to implement a surrogate model (optimized), then this model is the MLMD to be specified using ONNX. ARP6983 specifies that replication criteria shall be specified*.
+ - This is an important point. The model shall actually be non ambiguous. The user may introduce derived requirements about implementation (e.g., the order in which operators have to be executed). This contingency is what was meant by the term “ambiguity”. We have to be more explicit in the SoW: the specification will not be ambiguous, but there will be some “flexibility” about the set of derived requirements applicable to a given model.
+
+ - [ ] <21/08> (Eric+Jeans) In the SoW, avoid the use of the term “ambiguity”. Be more explicit about the different types of requirements. Introduce the concept of “replication criteria” and clarify its relation to requirements.
+ - Nicolas mentioned that “All the activities consist in paper work. Is there some room for POC for formal verification, extension of the definition of the format, tools to build, review, verify a SONNX MLMD ? Who are the users/recipients of the outputs ? (I would guess that some output are for us, some others for ONNX community...).”
+ - Only the first part of the remark was discussed: we actually need some “practical” work in order to validate our proposal. We should introduce a “running example” (e.g., MobileNet) that will be specified using SONNX, implemented, compared with a reference implementation, etc. Those “practical” implementation activities have to be described in the SoW too.
+
+
+ - [ ] <21/08> (Eric+Jeans) Add to the SoW activities related to the validation of the WG results through its application to a practical use case
+- Discussion about polymorphic operators: *we have to provide a specific specification for every types supported by an operator,* i.e., there will be a specification of the CONV operator for int8, float16, etc. This is in particular necessary for ints for which saturation is necessary. We should do the exercise on the CONV operator.
+
+
+ - [ ] <21/08> (Mariem, Loïc, Eric, Augustin) Specify the CONV operator for int8 and (e.g., ) float16….
+- We have to specify the broadcasting rules (see [https://github.com/onnx/onnx/blob/main/docs/Broadcasting.md](https://github.com/onnx/onnx/blob/main/docs/Broadcasting.md)).
+- Logistics
+ - All documents should be in the same place. At the moment, some documents are on the IRT’s sharepoint while some other at in the ONNX github. Office documents where placed in the Sharepoint for they were directly editable by some users. For other (e.g., Airbus), Sharepoint documents need to be downloaded first, which make Sharepoint pointless.
+ - [X] <21/08> (Eric) Convert the SOW to markdown, move all documents to github
+ - Documents have moved [here](https://github.com/ericjenn/working-groups/tree/ericjenn-srpwg-wg1/safety-related-profile/documents).
+ - The Sharepoint has moved in order to match the new project name, which is “SONNX”. The URL is now : [https://extranet.irt-saintexupery.com/Extranet/Projets/SONNX/Pages/default.aspx](https://extranet.irt-saintexupery.com/Extranet/Projets/SONNX/Pages/default.aspx)
+ - The github repository is accessible at [https://github.com/ericjenn/working-groups/tree/ericjenn-srpwg-wg1/safety-related-profile](https://github.com/ericjenn/working-groups/tree/ericjenn-srpwg-wg1/safety-related-profile).
+
+ - [ ] <21/08> (eric+Jean) Clarifies the use of github…
+
+
+## Actions
+
+- [x] (eric) Put the examples of mails (in French and English) to be used for dissemination purposes.
+
+- [x] (eric) Propose a poll for the project’s name, (all) answer the poll
+ - (Updated 21/08) SONNX
+
+- [ ] (eric+jean) Propose an agenda for the KOM
+
+- [ ] (all) Read the SOW and provide your feedback )
+- (Updated 21/08) Comments by Nicolas, see doc.
+
+- [x] (Nicolas) Collect the analysis done so far and put it in one document (on sharepoint or on the ONNX git, it’s up to you)
+ - Done, the document is on the sharepoint ([https://extranet.irt-saintexupery.com/Extranet/Projets/SONNX/Work/_layouts/15/WopiFrame.aspx?sourcedoc=/Extranet/Projets/SONNX/Work/Documents partages/SoW/ONNX format comments v0.1.docx&action=default](https://extranet.irt-saintexupery.com/Extranet/Projets/SONNX/Work/_layouts/15/WopiFrame.aspx?sourcedoc=/Extranet/Projets/SONNX/Work/Documents%20partages/SoW/ONNX%20format%20comments%20v0.1.docx&action=default)”)
+
+- [ ] <10/07>(eric+jean) Organize some meetings as “advisory boards”
+- [x] <21/08> (Eric) Convert the SOW to markdown
diff --git a/safety-related-profile/scratchpad/onnx_arp.md b/safety-related-profile/scratchpad/onnx_arp.md
new file mode 100644
index 00000000..0b1d73dd
--- /dev/null
+++ b/safety-related-profile/scratchpad/onnx_arp.md
@@ -0,0 +1,96 @@
+
+
+
+## Glossary:
+- MLMD: Machine Learning Model Description
+- MLMID: Machine Learning model Implementation Description
+
+## Definitions:
+- ML MODEL: Model characterized by parameters determined by a data-driven training process to perform one or more
+specific functions.
+- ML constituent: An AI/ML Constituent is a collection of hardware and/or software items (including the necessary pre- and post-processing elements), and at least one specialized hardware or software item containing one (or several) ML Model(s). (see ARP, p.7).
+
+## Elements:
+- The MLDL is the input of the ML items implementation process.
+ - The (MLMD, ML constituent requirements, test dataset) are the inputs of the implementation phase (see ARP, Figure 20).
+ - The MLMD only covers processings expressed using the ML graph. (pre- and post-processing are done by non-ML contituents)
+
+_There is no clear definition of the MLMD besides the implicit one for which the MLMD is "the decription of the ML model that is necessary to implement the inference process". Note that in the glossary, the entry for MLMD is "TBD"_
+
+- Verification activities of the MLMD are listed in §6.8.1.5:
+ - ML Model Description is complete, correct, and consistent.
+ - ML Model Description is traceable to ML Model. <>
+ - ML Model additional information is complete, correct, and consistent. <>
+ - ML Model Description, ML Data processing description, and ML Model additional information are consistent.
+
+_There is no constraints about the performance "achieved by" the MLMD (i.e., the performance that would be achieved by some perfect implementation of the MLMD. The only verification objective relating the ML model and the MLMD concerns "traceability" and "consistency"._
+
+_Nothing is said about the evaluation of the performance of the ML model. This evaluation may depend on the execution target (a desktop PC, a desktop PC with a GPU, a computer in the cloud) and framework. If the actual (measured) performance of the ML model (during the design phase) is a requirement, the measurement process should be defined precisely._
+
+- The SONNX standard defines the language in which the MLMD is expressed.
+ - SONNX is an "extension" of the ONNX standard.
+ - ONNX has ** not ** been targeted towards safety critical applications.
+ - SONNX is aimed at completing the ONNX standard to address concerns of safety-related systems.
+ - SONNX shall define the constructs (operators, graph) and the semantics of those constructs.
+ - A SONNX MLMD shall give a non ambiguous functional specification of the constructs.
+ - This definition is necessary both to ensure that developper will be able to implement the model correctly, and to
+ - It may also capture derrived requirements such as the explicit ordering of operators when the ordering imposed by the dataflow semantics is not unique.
+ - The specification of operators is purely functional.
+ - For a given operator, it describes what the operator shall do.
+ - In some cases, the specification may be operational and describe how to calculate the result. But this shall normaly not preclude other implementations as long as the computed results are identical.
+ - "Identity" of results may be achievable when considering mathematical abstractions such as "exact" operations performed on Real numbers. But in most cases, this cannot be achieved, even if the operational description of the algorithm is followed scruptuously.
+ - This means that an actual implementation may produce results that are "slightly" different from those that would be produced by a mathematically strictly exact implementation.
+ - The correctness criterion must be expressed by a maximal acceptable error.
+ - This could be part of the MLMD specification (i.e., the implementer is allowed to produce an implementation that is epsilon-off to the mathematically exact value.
+ - In some cases, it may be impossible to formally estimate the actual value of epsilon. in that case, epsilon may be estimated by testing and comparing the result of the implementation with the one of the reference implementation.
+ - But the error of the reference implementation with respect to the exact implementation must itself be estimated...
+ - In some cases, the implementation may be requested to striclty follow the operational specification (not in terms of results, but in terms of oeprations).
+ - This is a derived requirement that shall be captured explicitly
+
+ - SONNX shall facilitate development and verification activities (possibly by introducing specific annotations)
+
+- "The performance of the MLMD is verified against the test dataset on the target environment" (ARP)
+ - To do this verification, we need to interpret (or "execute") the model for a given set of inputs.
+ - We have to provide everything that is necessary to do this interpretation.
+ - This includes:
+ - an ** executable specification ** of the operators, of the graph,
+ - a specification or a clear designation of the interpretation infrastructure (including the compiler, the libraries, if any, and target machine).
+ - This executable specification is what we call a "reference implementation"
+ - There is an existing ONNX reference implementation, but (as indicated by ONNX), it is incomplete.
+ - The reference implementation shall be
+ - simple enough to facilitate its implementation / verification.
+ - demonstrated to comply with the SONNX semantics
+
+- Several properties (stability, robustness,...) shall be verified during the MLDL part of the process (see §6 of the ARP).
+ - If we want to take credit of these verifications (do we?), we have to demonstrate that those properties are preserved throughout the implementation process.
+ - Are the element determining those properties captured by the MLMD? (if not, this means that the MLMD cannot carry the constraints about those properties). If not, what should be added?
+
+- A MLMD is transformed into one or several MLMIDs.
+
+- The MLMID shall be demonstrated to comply with the MLMD.
+ - This can be achieved
+ - by testing the MLMID on the test dataset and showing that the performances are the same as for the MLMD
+ - by demonstrating that the MLMID correctly implements the MLMD (by testing)
+
+- We have to demonstrate that the MLMID is traceable to the MLMD. This may be achieved by providing an MLMD to MLMID mapping.
+ - If optimizations (e.g., fusion,...) are performed during the transformation process, those transformations shall be described so as to restore traceability (i.e., prove that the preservation of the semantics).
+ - In the simplest case, each operator in the implementation can be traced directly to an operator in the MLMD. In the ARP, parts of the model to be mapped to a specific target is called a "ML model (logical) elements". Several "logical elements" may be deployed on the same HW target. Therefore, one MLMID may concern several logical elements.
+
+
+- We have to demonstrate that the "combination of MLMIDs semantics reproduces the semantic of MLMD without introducing new of unexpected behaviours".
+ - Verification will (usually) be done using testing, which means that the MLMD must be interpretale (or "executable").
+
+- Ensuring this property can be done by construction, for instance by introducing derived requirements about, e.g., the execution sequencing and verfying that these requirements are actually applied, and/or by verification.
+
+- The derived requirements for one MLMID are captured in the MLPADR.
+
+- One MLMID specifies one SW item.
+
+- Derived requirements may be added during the refinement process. We may want those requirements to be captured by the SONNX profile. For instance, the mapping of parts of the MLMD to targets may be captured thanks to dedicated annotations.
+
+
+
+
+
+
+