|
10 | 10 | import seaborn as sb |
11 | 11 |
|
12 | 12 | from hls4ml.model.graph import ModelGraph |
13 | | -from hls4ml.model.layers import GRU, LSTM |
| 13 | +from hls4ml.model.layers import GRU, LSTM, SeparableConv1D, SeparableConv2D |
14 | 14 |
|
15 | 15 | try: |
16 | 16 | import qkeras |
@@ -184,6 +184,8 @@ def types_hlsmodel(model): |
184 | 184 | for layer in model.get_layers(): |
185 | 185 | if isinstance(layer, GRU) or isinstance(layer, LSTM): |
186 | 186 | suffix = ['w', 'rw', 'b', 'rb'] |
| 187 | + elif isinstance(layer, SeparableConv1D) or isinstance(layer, SeparableConv2D): |
| 188 | + suffix = ['dw', 'pw', 'db', 'pb'] |
187 | 189 | else: |
188 | 190 | suffix = ['w', 'b'] |
189 | 191 | for iw, weight in enumerate(layer.get_weights()): |
@@ -225,6 +227,8 @@ def weights_hlsmodel(model, fmt='longform', plot='boxplot'): |
225 | 227 | for layer in model.get_layers(): |
226 | 228 | if isinstance(layer, GRU) or isinstance(layer, LSTM): |
227 | 229 | suffix = ['w', 'rw', 'b', 'rb'] |
| 230 | + elif isinstance(layer, SeparableConv1D) or isinstance(layer, SeparableConv2D): |
| 231 | + suffix = ['dw', 'pw', 'db', 'pb'] |
228 | 232 | else: |
229 | 233 | suffix = ['w', 'b'] |
230 | 234 | name = layer.name |
@@ -346,6 +350,7 @@ def activations_keras(model, X, fmt='longform', plot='boxplot'): |
346 | 350 | outputs = _get_outputs( |
347 | 351 | [layer for layer in model.layers if not isinstance(layer, keras.layers.InputLayer)], X, model.input |
348 | 352 | ) |
| 353 | + outputs = dict(zip([layer.name for layer in model.layers if not isinstance(layer, keras.layers.InputLayer)], outputs)) |
349 | 354 | for layer_name, y in outputs.items(): |
350 | 355 | print(f" {layer_name}") |
351 | 356 | y = y.flatten() |
|
0 commit comments