Commit cd828ae3 authored by Sebastian Nickels's avatar Sebastian Nickels
Browse files

Merge branch 'rnn' of git.rwth-aachen.de:monticore/EmbeddedMontiArc/languages/CNNArchLang into rnn

parents e7992cdb da864824
Pipeline #203256 passed with stages
in 18 minutes and 8 seconds
......@@ -26,6 +26,8 @@ import de.se_rwth.commons.logging.Log;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
public class CheckLayerVariableDeclarationIsUsed extends CNNArchSymbolCoCo {
......@@ -36,6 +38,9 @@ public class CheckLayerVariableDeclarationIsUsed extends CNNArchSymbolCoCo {
boolean isUsed = false;
Set<String> allowedUnusedLayers = new HashSet();
allowedUnusedLayers.add("attention");
for (NetworkInstructionSymbol networkInstruction : layerVariableDeclaration.getLayer().getArchitecture().getNetworkInstructions()) {
Collection<ArchitectureElementSymbol> elements
= networkInstruction.getBody().getSpannedScope().resolveMany(layerVariableDeclaration.getName(), ArchitectureElementSymbol.KIND);
......@@ -52,6 +57,10 @@ public class CheckLayerVariableDeclarationIsUsed extends CNNArchSymbolCoCo {
}
}
if(allowedUnusedLayers.contains(sym.getName())){
isUsed = true;
}
if (!isUsed) {
Log.error("0" + ErrorCodes.UNUSED_LAYER + " Unused layer. " +
"Declared layer variables need to be used as layer at least once.",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment