-
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
…underlying model
….,hcat,eachcol(...))` for compatibility with GPUArrays
…avor of comparing absolute difference with a small threshold
0445dd8
to
ebf0efe
Compare
…dices to leave alone.
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?
…he two calls to the underlying `model`
…ims` on an empty array. Noted broken Tracker gradient test for `PositiveDefinite`
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #89 +/- ##
==========================================
- Coverage 88.38% 78.92% -9.46%
==========================================
Files 24 23 -1
Lines 439 465 +26
==========================================
- Hits 388 367 -21
- Misses 51 98 +47 ☔ View full report in Codecov by Sentry. |
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.