Commit d2a60097 authored by Sebastian Nickels's avatar Sebastian Nickels

Small changes to avoid endless loop when checking unresolved elements

parent e9c72ce3
Pipeline #180354 failed with stages
in 2 minutes and 32 seconds
......@@ -66,8 +66,10 @@ public abstract class ArchitectureSupportChecker {
}
private boolean hasConstant(ArchitectureElementSymbol element) {
if (element instanceof CompositeElementSymbol) {
List<ArchitectureElementSymbol> constructedElements = ((CompositeElementSymbol) element).getElements();
ArchitectureElementSymbol resolvedElement = (ArchitectureElementSymbol) element.getResolvedThis().get();
if (resolvedElement instanceof CompositeElementSymbol) {
List<ArchitectureElementSymbol> constructedElements = ((CompositeElementSymbol) resolvedElement).getElements();
for (ArchitectureElementSymbol constructedElement : constructedElements) {
if (hasConstant(constructedElement)) {
......@@ -75,7 +77,7 @@ public abstract class ArchitectureSupportChecker {
}
}
}
else if (element instanceof ConstantSymbol) {
else if (resolvedElement instanceof ConstantSymbol) {
return true;
}
......
......@@ -157,11 +157,6 @@ public abstract class CNNArchTemplateController {
for (VariableSymbol element : getArchitecture().getInputs()){
list.add(nameManager.getName(element));
}
for (UnrollSymbol unroll : getArchitecture().getUnrolls()){
for (SerialCompositeElementSymbol element: unroll.getBodiesForAllTimesteps()) {
list.add(nameManager.getName(element.getFirstAtomicElements().get(0)));
}
}
list.removeAll(Collections.singleton(null));
return list;
}
......
......@@ -17,10 +17,10 @@ public abstract class LayerSupportChecker {
protected List<String> supportedLayerList = new ArrayList<>();
private boolean isSupportedLayer(ArchitectureElementSymbol element){
List<ArchitectureElementSymbol> constructLayerElemList;
ArchitectureElementSymbol resolvedElement = (ArchitectureElementSymbol) element.getResolvedThis().get();
if (element instanceof CompositeElementSymbol) {
constructLayerElemList = ((CompositeElementSymbol) element).getElements();
if (resolvedElement instanceof CompositeElementSymbol) {
List<ArchitectureElementSymbol> constructLayerElemList = ((CompositeElementSymbol) resolvedElement).getElements();
for (ArchitectureElementSymbol constructedLayerElement : constructLayerElemList) {
if (!isSupportedLayer(constructedLayerElement)) {
return false;
......@@ -30,23 +30,23 @@ public abstract class LayerSupportChecker {
}
// Support all inputs and outputs
if (element instanceof VariableSymbol) {
if (((VariableSymbol) element).getType() == VariableSymbol.Type.LAYER) {
return isSupportedLayer(((VariableSymbol) element).getLayerVariableDeclaration().getLayer());
if (resolvedElement instanceof VariableSymbol) {
if (((VariableSymbol) resolvedElement).getType() == VariableSymbol.Type.LAYER) {
return isSupportedLayer(((VariableSymbol) resolvedElement).getLayerVariableDeclaration().getLayer());
}
else if (element.isInput() || element.isOutput()) {
else if (resolvedElement.isInput() || resolvedElement.isOutput()) {
return true;
}
}
// Support for constants is checked in ArchitectureSupportChecker
if (element instanceof ConstantSymbol) {
if (resolvedElement instanceof ConstantSymbol) {
return true;
}
// Support all layer declarations
if (element instanceof LayerSymbol) {
if (!((LayerSymbol) element).getDeclaration().isPredefined()) {
if (resolvedElement instanceof LayerSymbol) {
if (!((LayerSymbol) resolvedElement).getDeclaration().isPredefined()) {
return true;
}
}
......
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