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

Small fix to check for complex synapse in create_dense #130

Merged
merged 13 commits into from
Nov 30, 2022
Merged
3 changes: 1 addition & 2 deletions src/lava/lib/dl/netx/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ def create_dense(layer_config: h5py.Group,
neuron_params = Network.get_neuron_params(layer_config['neuron'],
reset_interval=reset_interval,
reset_offset=reset_offset)
# check to see for nested weights
if isinstance(layer_config["weight"], NetDict):
if "weight/imag" in layer_config.f:
weight_real = layer_config['weight/real']
weight_imag = layer_config['weight/imag']
if weight_real.ndim == 1:
Expand Down
2 changes: 1 addition & 1 deletion src/lava/lib/dl/netx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(
self.array_keys = [
'shape', 'stride', 'padding', 'dilation', 'groups', 'delay',
'iDecay', 'refDelay', 'scaleRho', 'tauRho', 'theta', 'vDecay',
'vThMant', 'wgtExp', 'sinDecay', 'cosDecay', "complex_synapse"
'vThMant', 'wgtExp', 'sinDecay', 'cosDecay'
]
self.copy_keys = ['weight', 'bias', 'weight/real', 'weight/imag']

Expand Down
2 changes: 0 additions & 2 deletions src/lava/lib/dl/slayer/block/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@ def delay(d):
self.synapse.disable_weight_norm()

if hasattr(self.synapse, 'imag'): # complex synapse
handle.create_dataset("complex_synapse", data=np.array(True))
handle.create_dataset(
'weight/real',
data=weight(self.synapse.real)
Expand All @@ -568,7 +567,6 @@ def delay(d):
data=weight(self.synapse.imag)
)
else:
handle.create_dataset("complex_synapse", data=np.array(False))
handle.create_dataset('weight', data=weight(self.synapse))

# bias
Expand Down