Hi @zerone, I have been able from the beginning to have the model summary output and the conversion for the sequential model as I already have tf-nightly installed. However, when I build the model with functional API as you are suggesting, I get an error of the following while converting the model:
RuntimeError Traceback (most recent call last)
~/Documents/eSNN_IDS_nengoLoihi/CNN_Conv1D_based_network/DoS_attack_network.py in
----> 140 converter = nengo_dl.Converter(model)
~/anaconda3/lib/python3.7/site-packages/nengo_dl/converter.py in init(self, model, allow_fallback, inference_only, max_to_avg_pool, split_shared_weights, swap_activations, scale_firing_rates, synapse)
131
132 # convert model
→ 133 self.get_converter(model).convert(None)
134
135 if isinstance(model, tf.keras.Sequential):
~/anaconda3/lib/python3.7/site-packages/nengo_dl/converter.py in get_converter(self, layer)
338 )
339
→ 340 converter = ConverterClass(layer, self)
341
342 self._layer_converters[layer] = converter
~/anaconda3/lib/python3.7/site-packages/nengo_dl/converter.py in init(self, *args, **kwargs)
978 layer = self.layer.class.from_config(self.layer.get_config())
979 if self.layer.built:
→ 980 layer.build(self.input_shape(0, include_batch=True))
981 layer.set_weights(self.layer.get_weights())
982
~/anaconda3/lib/python3.7/site-packages/nengo_dl/converter.py in input_shape(self, node_id, include_batch)
701 if the node as multiple inputs.
702 “”"
→ 703 return self._get_shape(“input”, node_id, include_batch=include_batch)
704
705 def output_shape(self, node_id, include_batch=False):
~/anaconda3/lib/python3.7/site-packages/nengo_dl/converter.py in _get_shape(self, input_output, node_id, include_batch)
673
674 # get the shape
→ 675 shape = func(node_id)
676
677 if not include_batch:
~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in get_input_shape_at(self, node_index)
2020 “”"
2021 return self._get_node_attribute_at_index(node_index, ‘input_shapes’,
→ 2022 ‘input shape’)
2023
2024 @doc_controls.do_not_doc_inheritable
~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _get_node_attribute_at_index(self, node_index, attr, attr_name)
2613 if not self._inbound_nodes:
2614 raise RuntimeError('The layer has never been called ’
→ 2615 'and thus has no defined ’ + attr_name + ‘.’)
2616 if not len(self._inbound_nodes) > node_index:
2617 raise ValueError('Asked to get ’ + attr_name + ’ at node ’ +
RuntimeError: The layer has never been called and thus has no defined input shape.
With the above error, I decided to build the model with sequential API and the conversion of the model was successful. However, I end up with the previous error I posted above.
Regarding the model.input, it has an input layer with name ‘input_1:0’:
Model: “sequential”
Layer (type) Output Shape Param #
conv1d (Conv1D) (None, 144, 32) 256
dropout (Dropout) (None, 144, 32) 0
conv1d_1 (Conv1D) (None, 72, 16) 3600
conv1d_transpose (Conv1DTran (None, 144, 16) 1808
dropout_1 (Dropout) (None, 144, 16) 0
conv1d_transpose_1 (Conv1DTr (None, 288, 32) 3616
conv1d_transpose_2 (Conv1DTr (None, 288, 1) 225
Total params: 9,505
Trainable params: 9,505
Non-trainable params: 0
converter = nengo_dl.Converter(model)
model.input
<tf.Tensor ‘input_1:0’ shape=(None, 288, 1) dtype=float32>
converter.inputs.keys()
KeysView(<nengo_dl.converter.Converter.KerasTensorDict object at 0x7f2415f48e50>)