Skip to content

fast reverse mode with RSWAF basis #2

Description

@vpuri3

You can define a custom gradient rule for RSWAF basis by noting the derivative of the key operation

rswaf_core(x) = 1 - tanh(x)^2

has a lot of computation in common with the forward pass. Specifically,

rswaf_core_deriv(x) = -2 * tanh(x) * tanh_deriv(x)
tanh_deriv(x) = 1 - tanh(x)^2 # = rswaf_core(x)

A custom gradient can share work between the forward and backward pass thus improving efficiency and memory utilization. You can check my Julia implementation for reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions