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

Fix for netx mishandling scalar input dimension #156

Merged
merged 34 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4328af7
Merge branch 'lava-nc:main' into main
bamsumit May 18, 2022
1789ef9
Merge branch 'main' of github.com:bamsumit/lava-dl into main
bamsumit Jul 26, 2022
0174ac5
Merge branch 'main' of github.com:lava-nc/lava-dl into main
bamsumit Sep 29, 2022
c77d7b2
Merge branch 'main' of github.com:lava-nc/lava-dl into main
bamsumit Oct 5, 2022
4ae5d38
Merge branch 'main' of github.com:lava-nc/lava-dl into main
bamsumit Oct 24, 2022
45ed337
CI fix for poetry on windows error
bamsumit Oct 24, 2022
391ee3d
Merge branch 'main' of github.com:bamsumit/lava-dl into main
bamsumit Oct 24, 2022
0196460
removed a caching option
bamsumit Oct 24, 2022
8ac07b9
Reverted caching changes
bamsumit Oct 24, 2022
327392b
Reverted caching changes
bamsumit Oct 24, 2022
cd18e65
pipx intallation of poetry
bamsumit Oct 24, 2022
a506edd
removed cache in python installation
bamsumit Oct 24, 2022
19b66a6
Testing testing
bamsumit Oct 24, 2022
5d15056
Updated CI
bamsumit Oct 24, 2022
4d719c3
Change to python v4
bamsumit Oct 24, 2022
e3cb93b
Remove poetry cache
bamsumit Oct 24, 2022
982c656
comments cleanup
bamsumit Oct 24, 2022
f4beb58
Merge branch 'main' of github.com:lava-nc/lava-dl into main
bamsumit Oct 24, 2022
7dfec3e
Merge branch 'main' of github.com:lava-nc/lava-dl into main
bamsumit Nov 29, 2022
721187c
Updated Readme to point to lava-dl decolle
bamsumit Nov 29, 2022
d2b82c1
language update
bamsumit Nov 29, 2022
5c94b6a
Updated illustration image
bamsumit Nov 29, 2022
c3348b6
Updated readme
bamsumit Nov 29, 2022
6922b21
Merge branch 'main' into main
bamsumit Dec 1, 2022
f825a07
Merge branch 'main' of github.com:lava-nc/lava-dl into main
bamsumit Jan 11, 2023
d08ee6b
Merge branch 'main' of github.com:bamsumit/lava-dl into main
bamsumit Jan 11, 2023
6b752b7
Updated benchmarking notebooks to use new callback_fxs api
bamsumit Jan 11, 2023
bd40deb
Fixed netx.hdf5 to handle scale dimensions on input.
bamsumit Jan 13, 2023
24a0892
Linting fixes
bamsumit Jan 13, 2023
bb478da
Merge branch 'main' of github.com:lava-nc/lava-dl into main
bamsumit Jan 13, 2023
1b9abcf
Restore data from lfs
bamsumit Jan 13, 2023
e37c45a
Temp removing file
bamsumit Jan 13, 2023
0d2bda6
added mnist network file
bamsumit Jan 13, 2023
25ca0f1
added lfs git attributes
bamsumit Jan 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 26 additions & 5 deletions src/lava/lib/dl/netx/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,21 @@ def create_input(layer_config: h5py.Group,
'neuron_params': neuron_params,
'transform': transform}

table_entry = Network._table_str(type_str='Input',
width=shape[0],
height=shape[1],
channel=shape[2])
if len(shape) == 1:
table_entry = Network._table_str(type_str='Input',
width=1,
height=1,
channel=shape[0])
elif len(shape) == 2:
table_entry = Network._table_str(type_str='Input',
width=shape[0],
height=shape[1],
channel=1)
else:
table_entry = Network._table_str(type_str='Input',
width=shape[0],
height=shape[1],
channel=shape[2])

return Input(**params), table_entry

Expand Down Expand Up @@ -311,7 +322,17 @@ def create_dense(layer_config: h5py.Group,
"""
shape = (np.prod(layer_config['shape']),)

neuron_params = Network.get_neuron_params(layer_config['neuron'],
if 'neuron' in layer_config.keys():
neuron_config = layer_config['neuron']
else:
# Non-leaky integrator by default
neuron_config = {'type' : 'CUBA',
'iDecay' : 0,
'vDecay' : 4096,
'vThMant' : 1 << 18 - 1,
'refDelay' : 1,
'gradedSpike' : False}
neuron_params = Network.get_neuron_params(neuron_config,
reset_interval=reset_interval,
reset_offset=reset_offset)
if "weight/imag" in layer_config.f:
Expand Down
3 changes: 3 additions & 0 deletions tests/lava/lib/dl/netx/mnist.net
Git LFS file not shown
10 changes: 10 additions & 0 deletions tests/lava/lib/dl/netx/test_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ def test_input_transform(self) -> None:
f'Expected transformation weight to be 36. Found {weight}.'
)

def test_mnist(self) -> None:
"""Tests loading of MNIST MLP."""
# Just tests if the network loads correctly or not
net = netx.hdf5.Network(net_config=root + '/mnist.net')
self.assertEqual(len(net), 4)
self.assertTrue(type(net.layers[0]) == netx.blocks.process.Input)
self.assertTrue(type(net.layers[1]) == netx.blocks.process.Dense)
self.assertTrue(type(net.layers[2]) == netx.blocks.process.Dense)
self.assertTrue(type(net.layers[3]) == netx.blocks.process.Dense)

def test_tinynet(self) -> None:
"""Tests the output of three layer CNN."""
steps_per_sample = 17
Expand Down