Commit da864824 authored by Christian Fuß's avatar Christian Fuß
Browse files

added exception to one CoCo to assure that the attention layer can be used to...

added exception to one CoCo to assure that the attention layer can be used to save an attention image, even though not being used as input for a stream
parent 75ffe205
Pipeline #202116 passed with stages
in 25 minutes and 22 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