NeuromorphicProcessorProject / snn_toolbox

Toolbox for converting analog to spiking neural networks (ANN to SNN), and running them in a spiking neuron simulator.
MIT License
361 stars 105 forks source link

NCHW format not supported in temporal_mean_rate_tensorflow.py #117

Closed Hpotato0 closed 2 years ago

Hpotato0 commented 2 years ago

Hello, I was working with snn_toolbox to convert keras models of nchw format to spiking neural networks, and I found out the function max_pool_with_argmax only accepts 'NHWC' as its data format.

at line 833 of temporal_mean_rate_tensorflow.py:

_, max_idxs = tf.nn.max_pool_with_argmax(
            self.mem_input, self.pool_size, self.strides, self.padding.upper(),
            conv_utils.convert_data_format(self.data_format, 4),
            include_batch_in_index=True)

Fetching and converting the data format here brings out an error if the data format is NCHW, and manual permutation of the axes is needed to make this work with NCHW.

rbodo commented 2 years ago

Yes, that is a known limitation from using the tensorflow maxpool function. #103