Comments (3)
The provided code ends up trying to do the following:
ReverseDiff.gradient(f, (W, b, x, y))
This doesn't make sense for two reasons: first, f
doesn't take that many arguments. Second, f
isn't a many-to-one function, so it doesn't make sense to take its gradient - you're probably looking for its Jacobian.
Thus, this is probably closer to what you meant to do:
julia> ReverseDiff.jacobian(f, (W, b, x))
([0.297318 0.0 … 0.0 0.0; 0.0 0.297318 … 0.0 0.0; … ; 0.0 0.0 … 0.453942 0.0; 0.0 0.0 … 0.0 0.453942], [1.0 0.0 … 0.0 0.0; 0.0 1.0 … 0.0 0.0; … ; 0.0 0.0 … 1.0 0.0; 0.0 0.0 … 0.0 1.0], [0.303758 1.69983 … -0.795719 0.578096; -0.400357 1.84059 … 0.319992 0.278819; … ; -1.30959 -0.653249 … -1.82875 0.850144; -1.28831 0.189162 … 0.61426 -0.368271])
I'm going to close this as a non-issue, but feel free to keep asking questions if you'd like and I'll try to help.
from reversediff.jl.
Alternatively, maybe you meant to take the gradient of net
instead of f
:
julia> ReverseDiff.gradient(net, (W, b, x, y))
([-0.00209739 -0.00180444 … -0.00124242 -0.00320227; -0.0126851 -0.0109133 … -0.00751421 -0.0193675; … ; -0.000486484 -0.000418535 … -0.000288177 -0.000742759; 0.0188482 0.0162156 … 0.011165 0.0287772], [-0.00705436, -0.0426651, -0.0120384, -0.00163624, 0.0633941], [-0.0622508, -0.0743267, -0.110634, 0.0793246, -0.0521236, 0.0596416, 0.0740789, -0.0662119, 0.0508074, -0.0613011], [0.362657, 0.0629406, 0.00199051, 0.109986, -0.214436])
from reversediff.jl.
Apologies, I can't believe I missed that typo...
from reversediff.jl.
Related Issues (20)
- Error when using scalar vs. vector to operate on tracked inupt HOT 1
- Record `Broadcast.broadcasted` instead of `Broadcast.broadcast`
- MethodError: ReverseDiff.TrackedReal ... is ambiguous.
- double free crash with multi-threaded code only when using multiple threads
- @grad_from_chainrules macro fails when using multi-output functions HOT 2
- ReverseDiff documentation shows issue that has been fixed? Nested differentiation of a closure? HOT 1
- `MethodError: *(::Diagonal, ::ReverseDiff.TrackedArray)` is ambiguous.
- `@grad_from_chainrules` hygiene: cannot use custom types in method signature HOT 3
- Define `typemin` for tracked reals.
- ReverseDiff defines a huge number of methods. HOT 3
- Nested differentiation of closures yields incorrect results. Any news on the fix?
- Enhancement proposal: Modular tape caching HOT 16
- Bug: Derivative of transposed-vector times matrix is incorrect. HOT 5
- Strange bug when deferring to ChainRules HOT 1
- Add ChainRulesCore RuleConfig? HOT 1
- mean BigFloat precision
- MethodError: vcat(::ReverseDiff.TrackedArray{Float32, Float32, 2, Matrix{Float32}, Matrix{Float32}}, ::Matrix{Float32}) is ambiguous. HOT 4
- Method ambiguities reported by Aqua
- DiffResults objects are not re-aliased properly HOT 2
- ERROR: LoadError: Some tests did not pass: 146 passed, 0 failed, 1 errored, 0 broken. HOT 1
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 reversediff.jl.