-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
[WIP] adds contributor guides to the docs #2350
Conversation
You can make the docs locally by running |
Nice nice! Yeah gimme bite size pieces and happy to add on. |
} | ||
``` | ||
|
||
### Holders |
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.
Tagging @t4c1 and @andrjohns can you both look this over to make sure it covers the problem and solution well?
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.
Looks fine to me.
2. If you are writing a function for reverse mode, pass values by `const&` | ||
3. In prim, if you are confident and working with larger types, use perfect forwarding to pass values that can be moved from. Otherwise simply pass values by `const&`. | ||
|
||
### Copying non-arena variables to lambdas used in the reverse pass |
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.
@bbbales2 can you add make_callback_ptr() stuff here?
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.
Done!
### Nested Stacks | ||
|
||
### Scoped Stacks | ||
|
||
As an aside, in order to get the actual vector result, Eigen defines the | ||
`.eval()` operator, so `c.eval()` would return an actual `Eigen::VectorXd`. | ||
Similarly, Math defines the `eval` function which will evaluate an Eigen | ||
expression and forward anything that is not an Eigen expression. |
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.
@wds15 would you have time to write about Stan's threading scheme for the allocators? I think that would be best to put here
TL;DR: Use Stan's `require` type trait library for limiting a function's scope to certain types. | ||
|
||
Reading from left to right, `require_not_st_var_t` requires that a signature's template does _not_ have a _scalar type_ that is Stan's `var` autodiff type. This line is exactly the same as |
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.
[todo: me] add link to requires docs
an autodiff type from the argument `x`. The function `f` is called on the | ||
reverse pass similarly to `reverse_pass_callback`. | ||
|
||
## Argument Types |
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.
Maybe everything here should go in another page?
## Reverse Mode | ||
|
||
### Values | ||
|
||
`value_of(x)` returns the values of the variable `x`. If `x` is not an | ||
autodiff type, it simply forwards `x` along. The values of `x` have | ||
the same shape as `x`. For reverse mode autodiff, values are `double` | ||
variables. For higher order autodiff (`fvar<var>`, etc.) this is not | ||
always the case. See `value_of_rec` for a different behavior. | ||
|
||
### Values and adjoint extensions to Eigen | ||
|
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.
This should probs go somewhere else as well
I'm going to try to restructure this a lil bit tmrw. I'd like to better structure this like Eigen's docs |
Question: Do we want to add which checks to run locally before submitting a PR? Also a note on clang-format and the rest? |
Yeah that would be awesome! I think that would go under the testing section |
@rok-cesnovar if you have time to write up the PR stuff that would be rad but otherwise I think this is good to go! |
Will do over the weekend. |
Obviously that weekend has long passed. Lets merge this. |
Summary
This takes @bbbales2 #192 PR and adds it to the stan math docs. I broke things up a bit into separate sections and fleshed out an example based on Ben's stuff. I like the example because it's pretty much real Stan math code and I think makes it easier to see the context on how we use the special widgets etc. we have. I'd like to add another example that's a bit more complicated for something like
multiply
but I'll do that later. This still needs some heavy editing and I'll tag people for particular sections.This also changes the settings in
doxygen.cfg
so that even if there are warnings the docs are still built. I think it's annoying that some versions of doxygen compile the docs fine while others don't. This is most entirely because of warnings likeWhich comes from us having a lot of different specializations and doxygen having trouble working out the docs for each. So I set the
WARN_AS_ERROR
flag for doxygen toNO
Release notes
Adds docs for new contributors
Checklist
Math issue #(issue number)
Copyright holder: Steve Bronder
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
./runTests.py test/unit
)make test-headers
)make test-math-dependencies
)make doxygen
)make cpplint
)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested