TorchLean API

NN.Runtime.Autograd.IRExec.Lowering.Elementwise

Elementwise and Activation IR Lowering #

Checked lowering for pointwise arithmetic, unary functions, and activation operations.

Each operation has its own small lower* definition. lowerElementwise only dispatches on the operation kind, and the lowerElementwise_* equation lemmas let correctness proofs reduce a dispatch to the branch they care about without unfolding the whole dispatcher.

The .log closure applies Tensor.logSpec to every input. The IR evaluator additionally rejects nonpositive inputs, so the end-to-end semantic equivalence theorem carries the NoRawLog side condition; the lowered closure itself is total and never panics.

Checked lowering for .add.

Instances For

    Checked lowering for .sub.

    Instances For

      Checked lowering for .mulElem.

      Instances For

        Checked lowering for .abs.

        Instances For

          Checked lowering for .sqrt.

          Instances For

            Checked lowering for .inv.

            Instances For

              Checked lowering for .maxElem.

              Instances For

                Checked lowering for .minElem.

                Instances For

                  Checked lowering for .relu.

                  Instances For

                    Checked lowering for .tanh.

                    Instances For

                      Checked lowering for .sigmoid.

                      Instances For

                        Lower stable softplus through the scalar specification.

                        Retaining its sign branch preserves both the finite positive tail and the selected computation at zero when the scalar carries first or higher derivatives.

                        Instances For

                          Checked lowering for .safeLog.

                          Instances For

                            Checked lowering for .exp.

                            Instances For

                              Checked lowering for .log.

                              The closure is total: it applies Tensor.logSpec to the parent value. The IR evaluator rejects nonpositive inputs at runtime, which is why the end-to-end equivalence theorem excludes raw .log through NoRawLog. A positive-input construction can avoid the domain failure, but its .log node remains outside that syntactic theorem and requires a separate domain-aware argument.

                              Instances For

                                Checked lowering for .sin.

                                Instances For

                                  Checked lowering for .cos.

                                  Instances For

                                    Checked lowering for .softmax axis.

                                    Instances For

                                      Checked lowering for .hardMaskedSoftmax mask.

                                      Instances For

                                        Checked lowering for pointwise arithmetic, unary functions, and activation operations.

                                        Instances For
                                          @[simp]

                                          Dispatch equation for .softmax axis.