-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
Exception: In serializer: Storage capacity [763] exceeded while writing value of size [16] from position [759] #3271
Comments
Yes, I'd done something silly: if I correct to |
Declaring
The error about serializer storage capacity means the size check during assignment is skipped for some reason and the mistake is not caught until copying the data to the output (which had reserved space for a 2-by-2 matrix in accordance with the declaration) This may be a problem in an older version of Stan. Are you using the latest RStan? Do you have optimizations enabled? With optimizations the following model throws the "capacity exceeded" error: generated quantities {
matrix[2,2] Rho = lkj_corr_rng(4, 1.0);
} Optimizations are experimental but even so I don't think they should throw internal errors. |
Thanks!
> rstan::stan_version()
[1] "2.32.2" The current version is 2.34? I'll try upgrading, after checking the effect of optimization.
I think so – the invocation of stan is coming via the rethinking package's |
Correction to version given above. Both |
A more minimal and self-contained reproduction. tl;dr in stanmodelcode <- "
parameters{
cholesky_factor_corr[4] L_Rho;
}
model{
L_Rho ~ lkj_corr_cholesky( 4 );
}
generated quantities{
matrix[2,2] Rho;
Rho = multiply_lower_tri_self_transpose(L_Rho);
}
"
print("Running with O0")
stan(model_code=stanmodelcode,data=list(), iter=2, chains=1,stanc_options=list("O0"))
print("Running with Oexperimental")
stan(model_code=stanmodelcode,data=list(), iter=2, chains=1,stanc_options=list("Oexperimental"))
print("Running with O1")
stan(model_code=stanmodelcode,data=list(), iter=2, chains=1,stanc_options=list("O1")) |
Sounds like this is another example of stan-dev/stanc3#1295. One of the optimizations we currently have enabled prevents initializing a variable in Stan if it is immediately assigned to. However, this breaks the way we do bounds checking on containers. Just one of the reasons we recommend running the model at Thank you for reporting! |
Summary:
Running a model produces the error above and also says:
Description:
Running the model code quoted below, which is generated code produced via https://github.com/rmcelreath/rethinking gives the error above.
I'm just in the process of learning, so (a) may well have done something silly (b) can't provide good answers for why the code is the way it is. I'm just reporting here because the error message asked me to.
Reproducible Steps:
Raw Data: https://github.com/rmcelreath/rethinking/blob/master/data/bangladesh.csv
Data to model:
Code
Current Output:
Each chain does:
Expected Output:
Additional Information:
The
/var/...
folder with the generated code also contains some chunky csv files (7.2MB each; one per chain?) that may contain more detailed output. Can u/l somewhere if that's helpful.Current Version:
v2.34.0
The text was updated successfully, but these errors were encountered: