-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add PositiveDefinite
#89
base: main
Are you sure you want to change the base?
feat: add PositiveDefinite
#89
Conversation
0445dd8
to
ebf0efe
Compare
src/layers/containers.jl
Outdated
end | ||
function PositiveDefinite(model; in_dims::Integer, ψ=Base.Fix1(sum, abs2), | ||
r=Base.Fix1(sum, abs2) ∘ -) | ||
return PositiveDefinite(model, () -> zeros(in_dims), ψ, r) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass in zeros32
?
() -> copy(x0)
Here you can pass a dummy function that takes in (rng, in_dims) and ignores them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean something like the change I just made?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #89 +/- ##
==========================================
- Coverage 88.38% 84.40% -3.99%
==========================================
Files 24 25 +1
Lines 439 468 +29
==========================================
+ Hits 388 395 +7
- Misses 51 73 +22 ☔ View full report in Codecov by Sentry. |
@avik-pal What's standing in the way of merging this in? All tests are passing (except Tracker is broken, see above). I'd like to be able to make use of these features in my library once available. |
…underlying model
….,hcat,eachcol(...))` for compatibility with GPUArrays
…avor of comparing absolute difference with a small threshold
…dices to leave alone.
…e sake of `AutoTracker`
…he two calls to the underlying `model`
…ims` on an empty array. Noted broken Tracker gradient test for `PositiveDefinite`
76e0fe2
to
a5207d2
Compare
tests are failing with the latest package versions |
A
PositiveDefinite
container wraps an underlying model and results in a model that returns a postive number whenever the input is nonzero (or not equal to a different point specified when defining the container). This is useful, among other applications, in neural Lyapunov applications.