Commit 75b5ea72 authored by lr119628's avatar lr119628
Browse files

[update]: added isPresent() check in nameAdaNetBlock in LayerNameCreator

parent 75291479
...@@ -57,12 +57,15 @@ public class LayerNameCreator { ...@@ -57,12 +57,15 @@ public class LayerNameCreator {
} }
} }
protected int nameAdaNetBlock(String target,ArchitectureElementSymbol subElement,int endStage, List<Integer> streamIndices){ protected int nameAdaNetBlock(String target,ArchitectureElementSymbol subElement,int endStage, List<Integer> streamIndices){
ArchitectureElementSymbol currentBlock = ((AdaNet) ((LayerSymbol) subElement).getDeclaration()).getBlock(target).get();
if (currentBlock.isArtificial()) { Optional<ArchitectureElementSymbol> currentBlock = ((AdaNet) ((LayerSymbol) subElement).getDeclaration()).getBlock(target);
boolean oldState = currentBlock.containsAdaNet(); if(currentBlock.isPresent()) {
currentBlock.setAdaNet(true); if (currentBlock.get().isArtificial()) {
endStage = name(currentBlock, endStage, streamIndices); boolean oldState = currentBlock.get().containsAdaNet();
currentBlock.setAdaNet(oldState); currentBlock.get().setAdaNet(true);
endStage = name(currentBlock.get(), endStage, streamIndices);
currentBlock.get().setAdaNet(oldState);
}
} }
return endStage; return endStage;
} }
...@@ -73,6 +76,7 @@ public class LayerNameCreator { ...@@ -73,6 +76,7 @@ public class LayerNameCreator {
endStage = name(subElement, endStage, streamIndices); endStage = name(subElement, endStage, streamIndices);
} else if (subElement.getName().equals(AllPredefinedLayers.AdaNet_Name)) { } else if (subElement.getName().equals(AllPredefinedLayers.AdaNet_Name)) {
// name outBlock // name outBlock
endStage = nameAdaNetBlock(AllPredefinedLayers.Out,subElement,endStage,streamIndices); endStage = nameAdaNetBlock(AllPredefinedLayers.Out,subElement,endStage,streamIndices);
// name inBlock // name inBlock
endStage = nameAdaNetBlock(AllPredefinedLayers.In,subElement,endStage,streamIndices); endStage = nameAdaNetBlock(AllPredefinedLayers.In,subElement,endStage,streamIndices);
......
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