Again working on the core_encoders_demo.py and true for many other engine relation python code. I keep getting the error:
RuntimeError: Attribute _paramTypeCache not found
I understand that the _paramTypeCache is send to nupic.core’s engine_internal module in here.
What I’s struggling with is that I have no idea what to do with it. Am I suppose to cache it in the c++ region object? If yes, where would it be stored?
I have tried to read the swig code and also nupic.core c++ code but I cannot see what is going.
Now that I’ve had a chance to look at this, I don’ think _paramTypeCache needs to be expressed in C++ at all. It looks like just a python convenience to me. If you are getting an error running examples/network/core_encoders_demo.py in python3, there may be some difference in how py3 deals with automatic setters and getters with underscore properties? I think you can ignore this property.
@scott I tried not to bother you on this, but I don’t think I can help at this point. Can you give this topic a quick read and chime in with your opinion?
The swig object is a Python class that, in this case, is storing some state. If you remove SWIG, the most analogous thing to do would be to have a Python class that plays the same role: stores the _paramTypeCache, has a reference to the C++, etc. I’m not familiar with pybind but one way to do it is take whatever the Python interface is to C++ and create a Python subclass of it that holds the _paramTypeCache.
I’m not sure if this makes sense so please let me know if I got something wrong here. The code is a bit of a mess and it isn’t clear to me why the cache is even needed (or how it avoids returning stale values) but in the sake of making progress I’d probably try to find a simple way to mimic the Python wrapper classes that SWIG generates.