Skip to content
Snippets Groups Projects

Implement a backward for Heaviside

Merged Jerome Hue requested to merge jeromeh/aidge_backend_cpu:heaviside-surrogate into dev

Context

Since the Heaviside function is non-differentiable, the classical approach is to use a surrogate gradient for the backward pass. The most common gradient function used is the shifted arctan function :

For the forward pass, th :

S[t] = Heaviside(U[t] - U_{\rm thr}) \approx \frac{1}{π}\text{arctan}(\pi U) \\

Thus for the backward :

\frac{\partial \tilde{S}}{\partial U} = \frac{1}{(1+(U \pi)^2)}

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Cyril Moineau requested changes

    requested changes

  • Jerome Hue added 1 commit

    added 1 commit

    • 3177f599 - Only define _USE_MATH_DEFINES on Windows platforms

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading