Comments (7)
Oh it is arrays containing Zeros/NotImplemented?
Yeah we should probably handle that.
Though if it only contains Zero
at least, it should really be being simplified down to just Zero
somewhere. (not sure where)
from chainrules.jl.
I will try to get back to this and the PR which spawned it this weekend. IIRC doing some types of collapsing made certain Zygote tests very unhappy.
from chainrules.jl.
Maybe the correct solution is to catch this at a higher level.
Yes, this should be handled in the AD system before it calls pullback.
Because if the input to pullback is one of these types we know the output (it will be the same object) so we don't need to handle it in the rules.
from chainrules.jl.
If I'm not mistaken it'd have to be handled in ∇getindex
? That's what I meant by higher level. Otherwise the AD system would have to know a priori that this particular pullback will blow up when it encounters a NotImplemented
/is a no-op when it's passed an array of AbstractZero
.
from chainrules.jl.
Collapsing arrays of Zeros seems reasonable. Is there a rule for what happens when that array contains both ZeroTangent
and NoTangent
? Would simplify_cotangents(x::Array{<:AbstractZero}) = ZeroTangent()
(or = NoTangent()
) be sufficient?
from chainrules.jl.
Is there a rule for what happens when that array contains both ZeroTangent and NoTangent?
Technically speaking we should keep them seperate.
In practice seeing a mix should be really rare.
And noone actually treats them differently.
Simplifying them all to NoTangent()
is probably fine.
(NotIplemented dominates NoTangent dominates ZeroTangent)
from chainrules.jl.
I can't make a MWE for this, that isn't purely zeros (which should be removed before hitting the rrule)
E.g. following works
_, back3 = rrule(getindex, [10, 0, -1], :)
gs3 = back3([2.0, NoTangent(), (@not_implemented "test2")])
num, notan, not_imp = unthunk(gs3[2])
@test num isa Real
@test iszero(notan) # We don't care if this gets converted to a 0.0
@test not_imp isa NotImplemented
from chainrules.jl.
Related Issues (20)
- Rules for `kron` HOT 1
- `*(::AbstractVector, ::AbstractMatrix)` pullback triggers scalar indexing on the GPU HOT 1
- ERROR: LoadError: Some tests did not pass: 7126 passed, 7 failed, 4 errored, 0 broken. in expression starting at /home/ian/.julia/packages/ChainRules/Ipuva/test/runtests.jl:19 ERROR: Package ChainRules errored during testing
- Error differentiating composed cross product with Zygote HOT 2
- `@fastmath maximum` broken on 1.10
- Add rules for `LinRange`
- Rule for `typed_vcat`? HOT 1
- Returning `Broadcasted` cotangents for `Broadcasted` arguments? HOT 7
- `unbroadcast` fails for `Matrix{Tangent}` due to `zero(::Tangent)`
- Missing rules for Tridiagonal HOT 1
- Wrong results for forward-mode `exp!` half of the time HOT 5
- Errors for gradient and hessian of logabsdet of sparse matrix HOT 3
- Missing rrules for `spdiagm`
- Rules for `eachslice` with multiple `dims`
- Reconsider giving `zero` as the derivative of one HOT 2
- arraymath muladd frule has too loose types
- Missing frules for `copy` HOT 1
- Sparse vector to real power throws a pullback error
- `rrule` for `mean(f, x)` is not vectorized? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chainrules.jl.