"AttributeError: module 'numpy' has no attribute 'asscalar'"

已查看 1,846 次
跳至第一个未读帖子

Saurav Pawar

未读,
2022年8月11日 04:26:312022/8/11
收件人 SpiNNaker Users Group
Hi,


And while doing tha I am getting the following error.

```
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Input In [5], in <cell line: 67>() 62 config.write(configfile) 64 # RUN SNN TOOLBOX # 65 ################### ---> 67 main(config_filepath) File ~/.local/lib/python3.8/site-packages/snntoolbox/bin/run.py:31, in main(filepath) 29 if filepath is not None: 30 config = update_setup(filepath) ---> 31 run_pipeline(config) 32 return 34 parser = argparse.ArgumentParser( 35 description='Run SNN toolbox to convert an analog neural network into ' 36 'a spiking neural network, and optionally simulate it.') File ~/.local/lib/python3.8/site-packages/snntoolbox/bin/utils.py:127, in run_pipeline(config, queue) 121 except FileNotFoundError: 122 print("Could not find parsed model {} in path {}. Consider " 123 "setting `parse = True` in your config file.".format( 124 config.get('paths', 'path_wd'), 125 config.get('paths', 'filename_parsed_model'))) --> 127 spiking_model.build(parsed_model, **testset) 129 # Export network in a format specific to the simulator with which it 130 # will be tested later. 131 spiking_model.save(config.get('paths', 'path_wd'), 132 config.get('paths', 'filename_snn')) File ~/.local/lib/python3.8/site-packages/snntoolbox/simulation/utils.py:438, in AbstractSNN.build(self, parsed_model, **kwargs) 435 self.preprocessing(**kwargs) 437 # Iterate over layers to create spiking neurons and connections. --> 438 self.setup_layers(batch_shape) 440 print("Compiling spiking model...\n") 441 self.compile() File ~/.local/lib/python3.8/site-packages/snntoolbox/simulation/target_simulators/spiNNaker_target_sim.py:57, in SNN.setup_layers(self, batch_shape) 55 for layer in self.parsed_model.layers[1:]: 56 print("Instantiating layer: {}".format(layer.name)) ---> 57 self.add_layer(layer) 59 layer_type = get_type(layer) 60 print("Building layer: {}".format(layer.name)) File ~/.local/lib/python3.8/site-packages/snntoolbox/simulation/target_simulators/spiNNaker_target_sim.py:96, in SNN.add_layer(self, layer) 93 if 'Reshape' in layer.__class__.__name__: 94 return 95 self.layers.append(self.sim.Population( ---> 96 np.asscalar(np.prod(layer.output_shape[1:], dtype=np.int)), 97 self.sim.IF_curr_exp, self.cellparams, label=layer.name)) 99 self.layers[-1].initialize(v=self.layers[-1].get('v_rest')) File ~/.local/lib/python3.8/site-packages/numpy/__init__.py:311, in __getattr__(attr) 308 from .testing import Tester 309 return Tester --> 311 raise AttributeError("module {!r} has no attribute " 312 "{!r}".format(__name__, attr)) AttributeError: module 'numpy' has no attribute 'asscalar'
```


Can anyone please help me on that ?

Thanks,
Saurav

Edward Jones

未读,
2022年8月11日 08:05:272022/8/11
收件人 SpiNNaker Users Group
Hi,

This looks like a bug to do with having a numpy version that is too new (https://numpy.org/doc/1.22/reference/generated/numpy.asscalar.html). I shall look into this and put in a pull request when I've sorted it.

Kind regards,

Ed

Saurav Pawar

未读,
2022年8月11日 08:45:372022/8/11
收件人 SpiNNaker Users Group
Hi,

Sure, thank you.

Kind regards,
Saurav

回复全部
回复作者
转发
0 个新帖子