From 87a26a023ec7142945f10672556ae7565c211432 Mon Sep 17 00:00:00 2001 From: ranhomri Date: Thu, 5 Dec 2024 14:08:32 +0200 Subject: [PATCH] add cleaned name and elemntwise layers --- onnx2kerastl/elementwise_layers.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/onnx2kerastl/elementwise_layers.py b/onnx2kerastl/elementwise_layers.py index 8183e3ae..efd6c239 100644 --- a/onnx2kerastl/elementwise_layers.py +++ b/onnx2kerastl/elementwise_layers.py @@ -104,13 +104,13 @@ def convert_elementwise_add(node, params, layers, lambda_func, node_name, keras_ const_val = constant_value.flat[0] layers[node_name] = keras.layers.Lambda( lambda x: x + const_val, - name=keras_name + name=params['cleaned_name'] )(variable_input) else: # Embedding the constant tensor layers[node_name] = keras.layers.Lambda( lambda x: x + constant_value, - name=keras_name + name=params['cleaned_name'] )(variable_input) elif not input_0_is_constant and input_1_is_constant: @@ -123,13 +123,13 @@ def convert_elementwise_add(node, params, layers, lambda_func, node_name, keras_ const_val = constant_value.flat[0] layers[node_name] = keras.layers.Lambda( lambda x: x + const_val, - name=keras_name + name=params['cleaned_name'] )(variable_input) else: # Embedding the constant tensor layers[node_name] = keras.layers.Lambda( lambda x: x + constant_value, - name=keras_name + name=params['cleaned_name'] )(variable_input) else: # Both inputs are constants; compute the result now @@ -179,13 +179,13 @@ def convert_elementwise_mul(node, params, layers, lambda_func, node_name, keras_ const_val = constant_value.flat[0] layers[node_name] = keras.layers.Lambda( lambda x: x * const_val, - name=keras_name + name=params['cleaned_name'] )(variable_input) else: # Cannot avoid embedding the constant tensor layers[node_name] = keras.layers.Lambda( lambda x: x * constant_value, - name=keras_name + name=params['cleaned_name'] )(variable_input) elif not input_0_is_constant and input_1_is_constant: @@ -198,13 +198,13 @@ def convert_elementwise_mul(node, params, layers, lambda_func, node_name, keras_ const_val = constant_value.flat[0] layers[node_name] = keras.layers.Lambda( lambda x: x * const_val, - name=keras_name + name=params['cleaned_name'] )(variable_input) else: # Cannot avoid embedding the constant tensor layers[node_name] = keras.layers.Lambda( lambda x: x * constant_value, - name=keras_name + name=params['cleaned_name'] )(variable_input) else: # Both inputs are constants; compute the result now @@ -253,13 +253,13 @@ def convert_elementwise_sub(node, params, layers, lambda_func, node_name, keras_ const_val = constant_value.flat[0] layers[node_name] = keras.layers.Lambda( lambda x: const_val - x, - name=keras_name + name=params['cleaned_name'] )(variable_input) else: # Cannot avoid embedding the constant tensor layers[node_name] = keras.layers.Lambda( lambda x: constant_value - x, - name=keras_name + name=params['cleaned_name'] )(variable_input) elif not input_0_is_constant and input_1_is_constant: @@ -272,13 +272,13 @@ def convert_elementwise_sub(node, params, layers, lambda_func, node_name, keras_ const_val = constant_value.flat[0] layers[node_name] = keras.layers.Lambda( lambda x: x - const_val, - name=keras_name + name=params['cleaned_name'] )(variable_input) else: # Cannot avoid embedding the constant tensor layers[node_name] = keras.layers.Lambda( lambda x: x - constant_value, - name=keras_name + name=params['cleaned_name'] )(variable_input) else: # Both inputs are constants; compute the result now