You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue appears to be because deep_copy_vars does not have an overload for tuples.
Example
Partial example given on the forums:
real partial_sum_lpmf(
dataarray[] int seq_region, dataint start, dataint end, dataint n_date_max, dataint n_call_max,
dataarray[] int n_site, dataarray[,] int n_date, dataarray[,,] int n_call, dataarray[,,] int dates, dataarray[,,] int tau, dataarray[,,] vector y,
vector eta, vector gamma, vector phi, tuple(vector, vector) lambda_mu) {
output (truncated):
^
/Users/s447341/.cmdstan/cmdstan-2.33.1/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:207:10: note: in instantiation of member function 'stan::math::internal::reduce_sum_impl<occu_ps_ms_trm_tuple_model_namespace::partial_sum_lpmf_rsfunctor__<true>, void, stan::math::var_value<double>, const std::vector<int> &, const int &, const int &, const std::vector<int> &, const std::vector<std::vector<int>> &, const std::vector<std::vector<std::vector<int>>> &, const std::vector<std::vector<std::vector<int>>> &, const std::vector<std::vector<std::vector<int>>> &, const std::vector<std::vector<std::vector<Eigen::Matrix<double, -1, 1>>>> &, Eigen::Matrix<stan::math::var_value<double>, -1, 1> &, Eigen::Matrix<stan::math::var_value<double>, -1, 1> &, Eigen::Matrix<stan::math::var_value<double>, -1, 1> &, std::tuple<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &>::operator()' requested here
return internal::reduce_sum_impl<ReduceFunction, void, return_type, Vec,
^
/var/folders/gr/hv6k6041275bm9w8vvn4ms3sz23ct8/T/Rtmp0Nghm8
/model-12c15458f3352.hpp:2235:12: note: in instantiation of function template specialization 'occu_ps_ms_trm_tuple_model_namespace::occu_ps_ms_trm_tuple_model::log_prob_impl<true, false, Eigen::Matrix<stan::math::var_value<double>, -1, 1>, Eigen::Matrix<int, -1, 1>, nullptr, nullptr, nullptr>' requested here
return log_prob_impl<propto__, jacobian__>(params_r, params_i, pstream);
^
/Users/s447341/.cmdstan/cmdstan-2.33.1/stan/src/stan/model/model_base_crtp.hpp:120:50: note: in instantiation of function template specialization 'occu_ps_ms_trm_tuple_model_namespace::occu_ps_ms_trm_tuple_model::log_prob<true, false, stan::math::var_value<double>>' requested here
return static_cast<const M*>(this)->template log_prob<true, false>(theta,
^
/var/folders/gr/hv6k6041275bm9w8vvn4ms3sz23ct8/T/Rtmp0Nghm8/model-12c15458f3352.hpp:983:3: note: in instantiation of member function 'stan::model::model_base_crtp<occu_ps_ms_trm_tuple_model_namespace::occu_ps_ms_trm_tuple_model>::log_prob_propto' requested here
~occu_ps_ms_trm_tuple_model() {}
^
/Users/s447341/.cmdstan/cmdstan-2.33.1/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:33:13: note: candidate function not viable: no known conversion from 'std::tuple<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, Eigen::Matrix<stan::math::var_value<double>, -1, 1>>' to 'const var' (aka 'const var_value<double>') for 1st argument
inline auto deep_copy_vars(const var& arg) {
^
/Users/s447341/.cmdstan/cmdstan-2.33.1/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:23:14: note: candidate template ignored: requirement 'is_arithmetic<std::tuple<Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>>>::value' was not satisfied [with Arith = std::tuple<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &]
inline
Arith deep_copy_vars(Arith&& arg) {
^
/Users/s447341/.cmdstan/cmdstan-2.33.1/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:45:13: note: candidate template ignored: requirement 'integral_constant<bool, false>::value' was not satisfied [with VarVec = std::tuple<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &]
inline auto deep_copy_vars(VarVec&& arg) {
^
/Users/s447341/.cmdstan/cmdstan-2.33.1/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:63:13: note: candidate template ignored: requirement 'integral_constant<bool, false>::value' was not satisfied [with VecContainer = std::tuple<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &]
inline auto deep_copy_vars(VecContainer&& arg) {
^
/Users/s447341/.cmdstan/cmdstan-2.33.1/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:79:13: note: candidate template ignored: requirement 'integral_constant<bool, false>::value' was not satisfied [with EigT = std::tuple<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &]
inline auto deep_copy_vars(EigT&& arg) {
^
4 errors generated.
make: *** [/var/folders/gr/hv6k6041275bm9w8vvn4ms3sz23ct8/T/Rtmp0Nghm8/model-12c15458f3352] Error 1
Error: An error occured during compilation! See the message above for more information.
Expected Output
Current Version:
v4.8.1
The text was updated successfully, but these errors were encountered:
I think this would be trivial if we had a map or something like stan::math::for_each that returned a new tuple, but unfortunately my C++-foo is not sufficient to write such a function
Yes I'm pretty sure I know how to fix this. Ben Bales and I did a thing for the ode solvers that should be able to be ported over pretty smoothly and fix everything
Description
First reported on the forums
The issue appears to be because
deep_copy_vars
does not have an overload for tuples.Example
Partial example given on the forums:
output (truncated):
Expected Output
Current Version:
v4.8.1
The text was updated successfully, but these errors were encountered: