Skip to content
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

Use of the out argument for inplace models is dangerous #14

Open
DougBurke opened this issue Sep 24, 2021 · 0 comments
Open

Use of the out argument for inplace models is dangerous #14

DougBurke opened this issue Sep 24, 2021 · 0 comments

Comments

@DougBurke
Copy link
Member

out = np.zeros(egrid.size - 1)
x.apec(energies=egrid, pars=pars, out=out)

will use the memory in out rather than creating a new array [it also returns the out array].

This only works when out has the correct datatype (np.float32 or np.float64) for the model, otherwise it will not be updated (the returned value is correct, but is not the same object as out).

This is crazy and dangerous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant