-
-
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
Add reverse for vectors. #479
Conversation
Three things:
|
@bob-carpenter I hopefully fixed the const issue and am proceeding to the rest, I'm curious whether there are any good examples of of functions from vector to vector already in the language? I'm looking at Also: I'm intending to put a little bit of noise on this pull request. Is there a nice way to avoid triggering CI builds on intermediate pushes? |
In your commit, you should be able to include "[skip ci]", but I don't know how well that actually works as documented.
Both only build on push, so you can prevent constant builds if you push when it's actually ready to test.
Although, you really shouldn't worry about the builds that are fired off. Most of the time we're idle.
… On Jan 26, 2017, at 6:10 PM, thelseraphim ***@***.***> wrote:
@bob-carpenter I hopefully fixed the const issue and am proceeding to the rest, I'm curious whether there are any good examples of of functions from vector to vector already in the language? I'm looking at fun/sum (in prim, rev, fwd), the autodiff paper, and a few other places but if there's an idiom it'd be nice to match
Also: I'm intending to put a little bit of noise on this pull request. Is there a nice way to avoid triggering CI builds on intermediate pushes?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
[ci skip] in a commit message has always worked as advertised for me. It
definitely comes in handy.
On Thu, Jan 26, 2017 at 11:05 PM Daniel Lee <notifications@github.com>
wrote:
… In your commit, you should be able to include "[skip ci]", but I don't
know how well that actually works as documented.
Both only build on push, so you can prevent constant builds if you push
when it's actually ready to test.
Although, you really shouldn't worry about the builds that are fired off.
Most of the time we're idle.
> On Jan 26, 2017, at 6:10 PM, thelseraphim ***@***.***>
wrote:
>
> @bob-carpenter I hopefully fixed the const issue and am proceeding to
the rest, I'm curious whether there are any good examples of of functions
from vector to vector already in the language? I'm looking at fun/sum (in
prim, rev, fwd), the autodiff paper, and a few other places but if there's
an idiom it'd be nice to match
>
> Also: I'm intending to put a little bit of noise on this pull request.
Is there a nice way to avoid triggering CI builds on intermediate pushes?
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub, or mute the thread.
>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#479 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHb4Q2MJ5709ZIiKziA7rNFNWjst0M0pks5rWWzxgaJpZM4Ls-lr>
.
|
I've just been killing off the builds that I know I've triggered if I have updates to the PR that makes running those tests obsolete. |
You also don't need to create a pull request until it's
ready to go. We can review branches until then. But
sometimes it's easier with pull requests.
- Bob
… On Jan 26, 2017, at 11:05 PM, Daniel Lee ***@***.***> wrote:
In your commit, you should be able to include "[skip ci]", but I don't know how well that actually works as documented.
Both only build on push, so you can prevent constant builds if you push when it's actually ready to test.
Although, you really shouldn't worry about the builds that are fired off. Most of the time we're idle.
> On Jan 26, 2017, at 6:10 PM, thelseraphim ***@***.***> wrote:
>
> @bob-carpenter I hopefully fixed the const issue and am proceeding to the rest, I'm curious whether there are any good examples of of functions from vector to vector already in the language? I'm looking at fun/sum (in prim, rev, fwd), the autodiff paper, and a few other places but if there's an idiom it'd be nice to match
>
> Also: I'm intending to put a little bit of noise on this pull request. Is there a nice way to avoid triggering CI builds on intermediate pushes?
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub, or mute the thread.
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
You can find the signatures in the math library functions
in the index of the manual. So you're looking for something
that returns real[] or vector and takes a real[] or vector
argument. For example, cumulative_sum. But cumulative_sum
doesn't have specialized derivatives, so you're better off
looking at stan/math/rev/mat/fun/softmax.hpp
Also, we have an array allocator in memalloc_ that should've
been used in softmax. You could replace that, too
vari** alpha_vi_array
= reinterpret_cast<vari**>(ChainableStack::memalloc_
.alloc(sizeof(vari*) * alpha.size()));
should be
vari** alpha_vi_array
= ChainableStack::memalloc_.alloc_array<vari*>(alpha.size());
At least I think I have my types in a row here. The memaalloc_ object
with alloc_array method is defined in stan/math/memory/stack_alloc.hpp.
- Bob
… On Jan 26, 2017, at 6:10 PM, thelseraphim ***@***.***> wrote:
@bob-carpenter I hopefully fixed the const issue and am proceeding to the rest, I'm curious whether there are any good examples of of functions from vector to vector already in the language? I'm looking at fun/sum (in prim, rev, fwd), the autodiff paper, and a few other places but if there's an idiom it'd be nice to match
Also: I'm intending to put a little bit of noise on this pull request. Is there a nice way to avoid triggering CI builds on intermediate pushes?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
jenkins, retest this please |
I shouldn't have just kicked off retesting. Looks like the reverse file isn't including the header for |
@bob-carpenter it wasn't using it because I shouldn't have had it there. pushing a micro-change this time just to see the [ci skip] in action |
EXPECT_FLOAT_EQ(y[0], 3.3); | ||
EXPECT_FLOAT_EQ(y[1], 2.2); | ||
EXPECT_FLOAT_EQ(y[2], 9); | ||
} |
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.
The reverse function looks good now. But the pull request still needs rev and fwd autodiff tests just to make sure that everything needed by std::reverse_copy is available for the autodiff classes.
Was this all ready for final review? |
@thelseraphim Would you mind adding the autodiff tests for this? Just one for fwd, one for rev, and one for rev nested in fwd (three test files in rev, fwd, and mix directories). |
@thelseraphim mind finishing out this pull request? |
Submisison Checklist
./runTests.py test/unit
make cpplint
Summary:
Just a quick resolution of #344 adding a reverse utility for std::vectors. Like our sort functions, it mutates its argument. We ok with that?
Intended Effect:
Add a missing minor feature.
How to Verify:
Code is short and there's a unit test.
Side Effects:
None, adds a function.
Documentation:
doxygen
Reviewer Suggestions:
Copyright and Licensing
Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Columbia University
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses: