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

Region.setParameters(name, value) not available #1000

Open
HolotypeRobotics opened this issue Jun 3, 2023 · 1 comment
Open

Region.setParameters(name, value) not available #1000

HolotypeRobotics opened this issue Jun 3, 2023 · 1 comment

Comments

@HolotypeRobotics
Copy link

In the file htm.core/docs/NetworkAPI_Engine.md it says that setParameter is available to use in python, but it is not.
Expected behavior: region.setParameter("name", value)
Actual behavior: RuntimeError: Attribute setParameter not found.

@dkeeney
Copy link

dkeeney commented Jun 3, 2023

That is an error in the md. For Python the data type needs to be known because it needs to convert the python representation to the C++ representation. So, you need to call one of these to set a parameter.
py_Region.def("setParameterByte", &Region::setParameterByte)
.def("setParameterInt32", &Region::setParameterInt32)
.def("setParameterUInt32", &Region::setParameterUInt32)
.def("setParameterInt64", &Region::setParameterInt64)
.def("setParameterUInt64", &Region::setParameterUInt64)
.def("setParameterReal32", &Region::setParameterReal32)
.def("setParameterReal64", &Region::setParameterReal64)
.def("setParameterBool", &Region::setParameterBool)
.def("setParameterString", &Region::setParameterString)
.def("setParameterArray", &Region::setParameterArray)
.def("setParameterJSON", &Region::setParameterJSON);
Sorry for the confusion. I will make the change in the docs.

May I suggest an alternative. Provide your parameters in a JSON string in the addRegion() function rather than setting them individually with one of the setParameterXXX() variants.

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

2 participants