Commit 6e5d8673 authored by Sebastian Nickels's avatar Sebastian Nickels

Set some additional layers as network layers and added CoCo to check if...

Set some additional layers as network layers and added CoCo to check if architecture includes a network stream
parent 54643c13
Pipeline #155384 failed with stages
in 13 minutes and 29 seconds
......@@ -66,7 +66,8 @@ public class CNNArchCocos {
.addCoCo(new CheckIOType())
.addCoCo(new CheckElementInputs())
.addCoCo(new CheckIOAccessAndIOMissing())
.addCoCo(new CheckArchitectureFinished());
.addCoCo(new CheckArchitectureFinished())
.addCoCo(new CheckNetworkStreamMissing());
}
//checks cocos based on symbols before the resolve method of the ArchitectureSymbol is called
......
/**
*
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
* All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
*/
package de.monticore.lang.monticar.cnnarch._cocos;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.CompositeElementSymbol;
import de.monticore.lang.monticar.cnnarch.helper.ErrorCodes;
import de.se_rwth.commons.logging.Log;
public class CheckNetworkStreamMissing extends CNNArchSymbolCoCo {
@Override
public void check(ArchitectureSymbol architecture) {
boolean hasNetworkStream = false;
for (CompositeElementSymbol stream : architecture.getStreams()) {
hasNetworkStream |= stream.isNetwork();
}
if (!hasNetworkStream) {
Log.error("0" + ErrorCodes.MISSING_NETWORK_STREAM + " The architecture has no network stream. "
, architecture.getSourcePosition());
}
}
}
......@@ -42,5 +42,6 @@ public class ErrorCodes {
public static final String UNKNOWN_VARIABLE_NAME = "x65013";
public static final String DIFFERENT_RANGE_OPERATORS = "xA8289";
public static final String UNFINISHED_ARCHITECTURE = "x28B42";
public static final String MISSING_NETWORK_STREAM = "x04893";
}
......@@ -37,6 +37,11 @@ public class Concatenate extends PredefinedLayerDeclaration {
super(AllPredefinedLayers.CONCATENATE_NAME);
}
@Override
public boolean isNetworkLayer() {
return true;
}
@Override
public List<ArchTypeSymbol> computeOutputTypes(List<ArchTypeSymbol> inputTypes, LayerSymbol layer) {
int height = inputTypes.get(0).getHeight();
......
......@@ -32,6 +32,11 @@ public class Lrn extends PredefinedLayerDeclaration {
super(AllPredefinedLayers.LRN_NAME);
}
@Override
public boolean isNetworkLayer() {
return true;
}
@Override
public List<ArchTypeSymbol> computeOutputTypes(List<ArchTypeSymbol> inputTypes, LayerSymbol layer) {
return inputTypes;
......
......@@ -34,6 +34,11 @@ public class Softmax extends PredefinedLayerDeclaration {
super(AllPredefinedLayers.SOFTMAX_NAME);
}
@Override
public boolean isNetworkLayer() {
return true;
}
@Override
public List<ArchTypeSymbol> computeOutputTypes(List<ArchTypeSymbol> inputTypes, LayerSymbol layer) {
return Collections.singletonList(
......
......@@ -34,6 +34,11 @@ public class Split extends PredefinedLayerDeclaration {
super(AllPredefinedLayers.SPLIT_NAME);
}
@Override
public boolean isNetworkLayer() {
return true;
}
@Override
public List<ArchTypeSymbol> computeOutputTypes(List<ArchTypeSymbol> inputTypes, LayerSymbol layer) {
ArchTypeSymbol inputShape = inputTypes.get(0);
......
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