stan-dev / stan

Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.
https://mc-stan.org
BSD 3-Clause "New" or "Revised" License
2.57k stars 368 forks source link

Standalone GQ: Output NaNs when exception is caught #3173

Closed WardBrian closed 1 year ago

WardBrian commented 1 year ago

Submission Checklist

Summary

Closes https://github.com/stan-dev/cmdstan/issues/1007. Since https://github.com/stan-dev/stanc3/pull/1165 we have made sure that write_array always populates the array with NaNs, so writing it out is safe even after an exception.

Intended Effect

Standalone generate quantities behavior now matches that of sampling (nans output if write_array fails) and the number of rows in the output of standalone generated quantities is now always the number of rows in the input fitted_params.

How to Verify

The example from https://github.com/stan-dev/cmdstan/issues/1007 works well

Side Effects

Documentation

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):

Simons Foundation

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:

bob-carpenter commented 1 year ago

Thanks, and feel free to merge when tests finish.