-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
31 lines (24 loc) · 1 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from htmcl.opencl import CLContext
from htmcl.layer import Layer
from htmcl.htm import HTM
from htmcl.config import LayerConfig, RandomConnectionConfig
def main():
ctx = CLContext(interactive=False, debug=True, heap_size_megabytes=512)
ctx.run_test()
htm = HTM(ctx)\
.add_layer('i1',
LayerConfig(
is_input_layer=True,
layer_size=128,
desired_local_activity=6))\
.add_layer('l1', LayerConfig(layer_size=128, desired_local_activity=6))\
.connect_layers('i1_to_l1',
'i1', 'l1',
RandomConnectionConfig(connection_probability=0.3))
i1 = htm.get_layer('i1')
l1 = htm.get_layer('l1')
print("layer on-GPU struct size is", l1.layer_struct_size(), "bytes")
print("column on-GPU struct size is", l1.column_struct_size(), "bytes")
print("cell on-GPU struct size is", l1.cell_struct_size(), "bytes")
if __name__ == '__main__':
main()