nengo / nengo-loihi

Run Nengo models on Intel's Loihi chip
https://www.nengo.ai/nengo-loihi/
Other
35 stars 12 forks source link

workaround for BlockShape in nengo-loihi 0.10.0 #302

Open monttj opened 3 years ago

monttj commented 3 years ago

Hello,

I am trying to follow the example in this page: https://www.nengo.ai/nengo-loihi/examples/keras-to-loihi.html

When trying to change the shape using Blockshape (*), I am facing some error message (**) below. It seems that the version of nengo-loihi 0.10.0 does not have the function of BlockShape().

I am wondering if there is any workaround.

Thank you very much,

Taejeong

(*)

conv0_shape = conv0_layer.output_shape[1:]
net.config[
    nengo_converter.layers[conv0].ensemble
].block_shape = nengo_loihi.BlockShape((16, 16, 4), conv0_shape)

conv1_shape = conv1_layer.output_shape[1:]
net.config[
    nengo_converter.layers[conv1].ensemble
].block_shape = nengo_loihi.BlockShape((8, 8, 16), conv1_shape)

dense0_shape = dense0_layer.output_shape[1:]
net.config[
    nengo_converter.layers[dense0].ensemble
].block_shape = nengo_loihi.BlockShape((50,), dense0_shape)

(**)


AttributeError Traceback (most recent call last)

in 3 net.config[ 4 nengo_converter.layers[conv0].ensemble ----> 5 ].block_shape = nengo_loihi.BlockShape((16, 16, 4), conv0_shape) 6 7 conv1_shape = conv1_layer.output_shape[1:] AttributeError: module 'nengo_loihi' has no attribute 'BlockShape'
hunse commented 3 years ago

Hi Taejeong,

Unfortunately, there's no workaround for block_shape in nengo-loihi 0.10.0. You'll have to use the development version of NengoLoihi. master branch should work with Nengo 3.0.0 and NxSDK <= 0.9.5. If you want to be bleeding-edge, you can try the nengomaster branch, which we haven't merged yet but is basically ready to go (it works with Nengo master branch and NxSDK up to 0.9.9).

Very soon we'll have a new release of Nengo (version 3.1.0), and then we'll do a release of NengoLoihi with the block_shape support.