Closed marty1885 closed 3 years ago
The brainblocks BitArray is actually the equivalent of an etaler Tensor. The Page structure is more of a helper and interface for storing histories of BitArrays and efficient management of information between connected blocks. Both Page and BitArray structs weren't intended to be directly created by the user. As such, the best way to pass information from an etaler tensor would be to create a BlankBlock object and then pass the information into it.
Here's some pseudocode examples:
def block_to_tensor(block): # block is something like PatternPooler, SequenceLearner, PatternClassifier, etc.
bits = block.output.bits
return to_tensor(bits) # to_tensor represents whatever interop code
def tensor_to_block(tensor):
flatten(tensor) # bb info must be 1D
block = BlankBlock(num_s=len(tensor))
block.output.bits = from_tensor(tensor) # from_tensor represents whatever interop code
return block
Hope this helps. Please let me know if you have any questions or need any additional clarifications.
Ahh.. thanks for the clear explanation. It solves everything.
HI,
I'm experimenting with using both Brainblocks and Etaler and the same time. Mainly to use HGT on standard TM and Grid Cells on PatternPooler. I'm able to convert brainblock's
Page
into Etaler'sTensor
. But not the other way around due to not knowing how to construct a page_obj. May you help me this this? Thanks!The relevant PR on PyEtaler: https://github.com/etaler/PyEtaler/pull/6