From 0c1274bf6198bcd7bc537f91b2b91ff71044d967 Mon Sep 17 00:00:00 2001 From: gospodima Date: Sun, 16 Jan 2022 16:30:53 +0000 Subject: [PATCH 1/3] Add trainable parameter for LoadNetwork --- README.md | 2 +- .../monticar/cnnarch/predefined/AllPredefinedLayers.java | 1 + .../lang/monticar/cnnarch/predefined/LoadNetwork.java | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e6139f..6ddcf88 100644 --- a/README.md +++ b/README.md @@ -860,7 +860,7 @@ All predefined methods start with a capital letter and all constructed methods h * **networkPrefix** (string, required): name of the network to load. This is a prefix of the file names, e.g. for Gluon there willl be two files (symbol and params) wich start with networkName- (the prefix would be networkName- with the -) followed by epoch number (param file) and file endings. * **numInputs** (integer > 0, required): number of inputs the loaded network expects. * **outputShape** (integer tuple > 0, reqiured): The expected shape of the output. If the network does not provide this shape, it it will be transformed with a dense layer and a reshape. - + * **trainable** (boolean, optional, default=true): whether weights of the imported model must be updated during the training. ## Predefined Unroll Types * **GreedySearch(max_length)** diff --git a/src/main/java/de/monticore/lang/monticar/cnnarch/predefined/AllPredefinedLayers.java b/src/main/java/de/monticore/lang/monticar/cnnarch/predefined/AllPredefinedLayers.java index d670086..9d6fe21 100644 --- a/src/main/java/de/monticore/lang/monticar/cnnarch/predefined/AllPredefinedLayers.java +++ b/src/main/java/de/monticore/lang/monticar/cnnarch/predefined/AllPredefinedLayers.java @@ -119,6 +119,7 @@ public class AllPredefinedLayers { public static final String NETWORK_PREFIX_NAME = "networkPrefix"; public static final String NUM_INPUTS_NAME = "numInputs"; public static final String OUTPUT_SHAPE_NAME = "outputShape"; + public static final String TRAINABLE = "trainable"; //parameters DotProductSelfAttention public static final String SCALE_FACTOR_NAME="scaleFactor"; diff --git a/src/main/java/de/monticore/lang/monticar/cnnarch/predefined/LoadNetwork.java b/src/main/java/de/monticore/lang/monticar/cnnarch/predefined/LoadNetwork.java index be47382..f471083 100644 --- a/src/main/java/de/monticore/lang/monticar/cnnarch/predefined/LoadNetwork.java +++ b/src/main/java/de/monticore/lang/monticar/cnnarch/predefined/LoadNetwork.java @@ -66,6 +66,11 @@ public class LoadNetwork extends PredefinedLayerDeclaration { new ParameterSymbol.Builder() .name(AllPredefinedLayers.OUTPUT_SHAPE_NAME) .constraints(Constraints.INTEGER_OR_INTEGER_TUPLE, Constraints.POSITIVE) + .build(), + new ParameterSymbol.Builder() + .name(AllPredefinedLayers.TRAINABLE) + .constraints(Constraints.BOOLEAN) + .defaultValue(true) .build())); declaration.setParameters(parameters); return declaration; -- GitLab From 4ae5d6644e8e1752ba0eb1bdd8c0b79337a8940c Mon Sep 17 00:00:00 2001 From: gospodima Date: Sun, 16 Jan 2022 16:43:12 +0000 Subject: [PATCH 2/3] Add empty line --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6ddcf88..6c405c7 100644 --- a/README.md +++ b/README.md @@ -862,6 +862,7 @@ All predefined methods start with a capital letter and all constructed methods h * **outputShape** (integer tuple > 0, reqiured): The expected shape of the output. If the network does not provide this shape, it it will be transformed with a dense layer and a reshape. * **trainable** (boolean, optional, default=true): whether weights of the imported model must be updated during the training. + ## Predefined Unroll Types * **GreedySearch(max_length)** -- GitLab From 20787b0b9def84d260c81e39864072bcb767c363 Mon Sep 17 00:00:00 2001 From: gospodima Date: Tue, 15 Feb 2022 13:53:51 +0000 Subject: [PATCH 3/3] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3a7d09b..a776f39 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ de.monticore.lang.monticar cnn-arch - 0.4.9-SNAPSHOT + 0.4.10-SNAPSHOT -- GitLab