Skip to content

Ericjenn srpwg wg1#119

Open
ericjenn wants to merge 1102 commits into
onnx:mainfrom
ericjenn:ericjenn-srpwg-wg1
Open

Ericjenn srpwg wg1#119
ericjenn wants to merge 1102 commits into
onnx:mainfrom
ericjenn:ericjenn-srpwg-wg1

Conversation

@ericjenn
Copy link
Copy Markdown
Contributor

Update of the SONNX working group material (located under directory "safety-related-profile")

JeanLoupFarges and others added 30 commits January 19, 2026 15:09
Signed-off-by: JeanLoupFarges <86069696+JeanLoupFarges@users.noreply.github.com>
Signed-off-by: JeanLoupFarges <86069696+JeanLoupFarges@users.noreply.github.com>
Signed-off-by: JeanLoupFarges <86069696+JeanLoupFarges@users.noreply.github.com>
Updated Airbus' use case.

Signed-off-by: Jean Souyris <jean.souyris@airbus.com>
…thub)

Signed-off-by: HBelfy <182933819+HBelfy@users.noreply.github.com>
… github

Signed-off-by: HBelfy <182933819+HBelfy@users.noreply.github.com>
…thub

Signed-off-by: HBelfy <182933819+HBelfy@users.noreply.github.com>
…thub

Signed-off-by: HBelfy <182933819+HBelfy@users.noreply.github.com>
…thub

Signed-off-by: HBelfy <182933819+HBelfy@users.noreply.github.com>
… github

Signed-off-by: HBelfy <182933819+HBelfy@users.noreply.github.com>
Signed-off-by: HBelfy <182933819+HBelfy@users.noreply.github.com>
Signed-off-by: Eric JENN <158552155+ericjenn@users.noreply.github.com>
…ition de l'exponentiel en real et en cfloat (base de preuve OK, avec en dur 0.0 et 1.0 sans l'exponentiel)
MatMul added in Airbus' scope.

Signed-off-by: Jean Souyris <jean.souyris@airbus.com>
emanino and others added 30 commits April 12, 2026 08:27
Review by Edoardo

Signed-off-by: emanino <40175301+emanino@users.noreply.github.com>
Signed-off-by: JeanLoupFarges <86069696+JeanLoupFarges@users.noreply.github.com>
…broadcast.md

Signed-off-by: JeanLoupFarges <86069696+JeanLoupFarges@users.noreply.github.com>
Signed-off-by: JeanLoupFarges <86069696+JeanLoupFarges@users.noreply.github.com>
Signed-off-by: JeanLoupFarges <86069696+JeanLoupFarges@users.noreply.github.com>
Refactored broadcast functions to use a list of tensors as input and output.

Signed-off-by: JeanLoupFarges <86069696+JeanLoupFarges@users.noreply.github.com>
### What has been implemented

- Abstract specification (OPTanh)
  - Defined an abstract exponential function `exp_r` to model the mathematical behavior of the exponential.
  - Specified `tanh_r` using three equivalent mathematical formulations:
    - (exp(x) - exp(-x)) / (exp(x) + exp(-x))
    - (exp(2x) - 1) / (exp(2x) + 1)
    - (1 - exp(-2x)) / (1 + exp(-2x))
  - Ensured consistency with the informal ONNX specification at the mathematical level.
  - Implemented `dtanh` to apply tanh element-wise over tensor data.
  - Defined `optanh` to construct the resulting tensor while preserving shape and background.

- Concrete implementation (CTensorTanh)
  - Introduced `ctanh` as the floating-point implementation of tanh, formally linked to `tanh_r`.
  - Implemented `ctensor_tanh` as a loop over the flattened tensor memory.
  - Maintained a loop invariant ensuring correctness of partial computation.
  - Proved that the final tensor matches the abstract specification (`optanh`).

- Formal verification
  - All verification conditions are successfully discharged using Why3.
  - The implementation is formally proven to be consistent with the abstract specification.

### Correspondence with the informal specification

- Element-wise application of tanh over the tensor is fully respected.
- Shape preservation constraint is enforced (`result ~= input`).
- Mathematical definition of tanh is captured via multiple equivalent formulations.
- No error conditions are required, consistent with the informal specification.

### Limitations / Remaining work

- ⚠ The exponential function `exp_r` is abstract and not tied to a concrete implementation.
- ⚠ IEEE-754 floating-point semantics (NaN, ±inf handling) are not explicitly modeled.
- ⚠ Numerical accuracy aspects (error propagation and introduction) described in the informal spec are not formally encoded.
- ⚠ No formal link yet between `ctanh` and an actual C math library implementation (e.g., `tanh` from `<math.h>`).

Signed-off-by: HamzaSeyfu <165190579+HamzaSeyfu@users.noreply.github.com>
Recommend the use of Why3 and suggest useful links for readers.

Signed-off-by: JeanLoupFarges <86069696+JeanLoupFarges@users.noreply.github.com>
Signed-off-by: Jean Souyris <jean.souyris@airbus.com>
Add a formal Why3 specification for the Softmax operator based on the ONNX v13 behavior.

This update introduces:
- an abstract SoftmaxReal specification over real tensors;
- an abstract SoftmaxFloat specification covering finite values, NaN, +inf and -inf cases;
- the numerically stable formulation using M = max along the selected axis;
- preservation of the input tensor shape in the output tensor;
- axis validity constraints;
- a concrete C-extractible CtensorSoftmax module;
- a c_softmax kernel using the outer / axis_size / inner traversal scheme;
- a Softmax extraction driver mapping the exponential operation to C exp();
- a Makefile workflow for proving the abstract specification and generating the C code.

The abstract specification is proved successfully for SoftmaxReal and SoftmaxFloat.
The concrete C module is extractible and generates ctensorsoftmax.c/.h with the c_softmax function.
The generated C code compiles successfully.

The full proof of the concrete C kernel is not completed yet. Remaining proof obligations mainly concern integer overflow, memory bounds and offset validity in the concrete tensor traversal.

Signed-off-by: HamzaSeyfu <165190579+HamzaSeyfu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.