diff --git a/hls4ml/model/profiling.py b/hls4ml/model/profiling.py index be76afc588..85396f4eae 100644 --- a/hls4ml/model/profiling.py +++ b/hls4ml/model/profiling.py @@ -10,7 +10,7 @@ import seaborn as sb from hls4ml.model.graph import ModelGraph -from hls4ml.model.layers import GRU, LSTM +from hls4ml.model.layers import GRU, LSTM, SeparableConv1D, SeparableConv2D try: import qkeras @@ -184,6 +184,8 @@ def types_hlsmodel(model): for layer in model.get_layers(): if isinstance(layer, GRU) or isinstance(layer, LSTM): suffix = ['w', 'rw', 'b', 'rb'] + elif isinstance(layer, SeparableConv1D) or isinstance(layer, SeparableConv2D): + suffix = ['dw', 'pw', 'db', 'pb'] else: suffix = ['w', 'b'] for iw, weight in enumerate(layer.get_weights()): @@ -225,6 +227,8 @@ def weights_hlsmodel(model, fmt='longform', plot='boxplot'): for layer in model.get_layers(): if isinstance(layer, GRU) or isinstance(layer, LSTM): suffix = ['w', 'rw', 'b', 'rb'] + elif isinstance(layer, SeparableConv1D) or isinstance(layer, SeparableConv2D): + suffix = ['dw', 'pw', 'db', 'pb'] else: suffix = ['w', 'b'] name = layer.name @@ -346,6 +350,7 @@ def activations_keras(model, X, fmt='longform', plot='boxplot'): outputs = _get_outputs( [layer for layer in model.layers if not isinstance(layer, keras.layers.InputLayer)], X, model.input ) + outputs = dict(zip([layer.name for layer in model.layers if not isinstance(layer, keras.layers.InputLayer)], outputs)) for layer_name, y in outputs.items(): print(f" {layer_name}") y = y.flatten()