EnzymeAD / EnzymeAD/Enzyme.jl

Inactive rule not working on identity function

Open
#714 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
586
Forks
108
Avg merge
1d 5h
Merged PRs (30d)
44

Description

MWE:
```julia
using Enzyme

import .EnzymeRules: forward, reverse, augmented_primal, inactive
using .EnzymeRules

myidentity(x) = x

EnzymeRules.inactive(::typeof(myidentity), args...) = nothing

autodiff(Forward, myidentity, Duplicated(3.0, 1.0)) # gives 1.0 rather than 0.0
```

It works if `myidentity(x) = 2*x` though (i.e. output is `0.0` then)

I'm guessing `myidentity` is just optimized out before Enzyme sees it? So don't know if this really a bug or not: maybe incorrect `inactive` rules are just undefined behaviour

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.