Aufgrund einer Wartung wird GitLab am 19.10. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 19.10. between 8:00 and 9:00 am.

Commit 7ff494bf authored by Nicola Gatto's avatar Nicola Gatto
Browse files

Add check critic network

parent 37e759d3
......@@ -22,6 +22,7 @@ package de.monticore.lang.monticar.cnntrain._cocos;
import de.monticore.lang.monticar.cnntrain._ast.ASTCNNTrainNode;
import de.monticore.lang.monticar.cnntrain._symboltable.CNNTrainCompilationUnitSymbol;
import de.monticore.lang.monticar.cnntrain._symboltable.ConfigurationSymbol;
import de.se_rwth.commons.logging.Log;
public class CNNTrainCocos {
......@@ -46,4 +47,11 @@ public class CNNTrainCocos {
int findings = Log.getFindings().size();
createChecker().checkAll(node);
}
public static void checkCriticCocos(final ConfigurationSymbol configurationSymbol) {
CNNTrainConfigurationSymbolChecker checker = new CNNTrainConfigurationSymbolChecker()
.addCoCo(new CheckCriticNetworkHasExactlyAOneDimensionalOutput());
int findings = Log.getFindings().size();
checker.checkAll(configurationSymbol);
}
}
\ No newline at end of file
/**
*
* ******************************************************************************
* 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.cnntrain._cocos;
import de.monticore.lang.monticar.cnntrain._symboltable.ConfigurationSymbol;
import de.monticore.lang.monticar.cnntrain._symboltable.NNArchitectureSymbol;
import de.monticore.lang.monticar.cnntrain.helper.ErrorCodes;
import de.se_rwth.commons.logging.Log;
import java.util.List;
/**
*
*/
public class CheckCriticNetworkHasExactlyAOneDimensionalOutput implements CNNTrainConfigurationSymbolCoCo {
@Override
public void check(ConfigurationSymbol configurationSymbol) {
if (configurationSymbol.getCriticNetwork().isPresent()) {
NNArchitectureSymbol criticNetwork = configurationSymbol.getCriticNetwork().get();
if (criticNetwork.getOutputs().size() > 1) {
Log.error("0" + ErrorCodes.CRITIC_NETWORK_ERROR
+ " The critic network has more than one outputs", criticNetwork.getSourcePosition());
}
final String outputName = criticNetwork.getOutputs().get(0);
List<Integer> dimensions = criticNetwork.getDimensions().get(outputName);
if (dimensions.size() != 1 || dimensions.get(0) != 1) {
Log.error("0" + ErrorCodes.CRITIC_NETWORK_ERROR + " The output " + outputName
+ " of critic network is not a one-dimensional vector", configurationSymbol.getSourcePosition());
}
}
}
}
......@@ -31,4 +31,5 @@ public class ErrorCodes {
public static final String REQUIRED_PARAMETER_MISSING = "xC8856";
public static final String STRATEGY_NOT_APPLICABLE = "xC8857";
public static final String CONTRADICTING_PARAMETERS = "xC8858";
public static final String CRITIC_NETWORK_ERROR = "xC7100";
}
\ No newline at end of file
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