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
{{ message }}
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.
the compute in SP void compute(UInt input[], bool learn, UInt output[]);
unfortunately, the data are passed as UInt* (typically from vector.data() with no way of checking the correct array sizes!
The check would be quite simple: sp.getNumInputs() == input.size() && sp.getNumColumns() == out.size()
but we pass the pointer T* and cannot reconstruct the array properly, we cannot know the sizes of input parameters to compute()!
Providing a wrong size -smaller- (large is ok) crashes the program.
The text was updated successfully, but these errors were encountered:
@scottpurdy is there something we can do about this? We've discussed this long ago, a solution would be (a bigger refactor) to use vector/std::array for compute()'s params; but you've mentioned performance reasons, does it still hold, or is there a way around it? (passing &vector)?
I think it is fine to require the caller to pass the right size array as long as it is documented. It would be nice to use sparse representations everywhere rather than passing UInt32 dense arrays that just contain binary values but that would be a somewhat involved refactor that I don't think we have the stomach for right now (would really require a lot of time from @lscheinkman )
nice to use sparse representations everywhere rather than passing UInt32 dense arrays that just contain binary values ...
agreed. But it's nice to hear the notion, esp since the discussed community nupic.core fork, I think the (eigen) sparse repr. all round the codebase would be the way forward.
the compute in SP
void compute(UInt input[], bool learn, UInt output[]);
unfortunately, the data are passed as
UInt*
(typically fromvector.data()
with no way of checking the correct array sizes!The check would be quite simple:
sp.getNumInputs() == input.size() && sp.getNumColumns() == out.size()
but we pass the pointer
T*
and cannot reconstruct the array properly, we cannot know the sizes of input parameters to compute()!Providing a wrong size -smaller- (large is ok) crashes the program.
The text was updated successfully, but these errors were encountered: