Commit 33adc56c authored by Evgeny Kusmenko's avatar Evgeny Kusmenko

Merge branch 'tensorflow_group' into 'master'

Tensorflow group

See merge request !21
parents 33398aa9 e32e7c81
Pipeline #187327 passed with stages
in 10 minutes and 2 seconds
#
# (c) https://github.com/MontiCore/monticore
#
# The license generally applicable for this project
# can be found under https://github.com/MontiCore/monticore.
#
# (c) https://github.com/MontiCore/monticore # (c) https://github.com/MontiCore/monticore
# #
......
#
# (c) https://github.com/MontiCore/monticore
#
# The license generally applicable for this project
# can be found under https://github.com/MontiCore/monticore.
#
# (c) https://github.com/MontiCore/monticore # (c) https://github.com/MontiCore/monticore
stages: stages:
......
<!--
(c) https://github.com/MontiCore/monticore
The license generally applicable for this project
can be found under https://github.com/MontiCore/monticore.
-->
<!-- (c) https://github.com/MontiCore/monticore --> <!-- (c) https://github.com/MontiCore/monticore -->
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!--
(c) https://github.com/MontiCore/monticore
The license generally applicable for this project
can be found under https://github.com/MontiCore/monticore.
-->
<!-- (c) https://github.com/MontiCore/monticore --> <!-- (c) https://github.com/MontiCore/monticore -->
......
...@@ -33,6 +33,7 @@ grammar CNNTrain extends de.monticore.lang.monticar.Common2, de.monticore.Number ...@@ -33,6 +33,7 @@ grammar CNNTrain extends de.monticore.lang.monticar.Common2, de.monticore.Number
TrainContextEntry implements ConfigEntry = name:"context" ":" value:TrainContextValue; TrainContextEntry implements ConfigEntry = name:"context" ":" value:TrainContextValue;
EvalMetricEntry implements ConfigEntry = name:"eval_metric" ":" value:EvalMetricValue; EvalMetricEntry implements ConfigEntry = name:"eval_metric" ":" value:EvalMetricValue;
LossEntry implements ConfigEntry = name:"loss" ":" value:LossValue; LossEntry implements ConfigEntry = name:"loss" ":" value:LossValue;
LossWeightsEntry implements ConfigEntry = name:"loss_weights" ":" value:DoubleVectorValue;
EvalMetricValue implements ConfigValue =(accuracy:"accuracy" EvalMetricValue implements ConfigValue =(accuracy:"accuracy"
| crossEntropy:"cross_entropy" | crossEntropy:"cross_entropy"
...@@ -58,6 +59,8 @@ grammar CNNTrain extends de.monticore.lang.monticar.Common2, de.monticore.Number ...@@ -58,6 +59,8 @@ grammar CNNTrain extends de.monticore.lang.monticar.Common2, de.monticore.Number
L2Loss implements LossValue = name:"l2" ("{" params:Entry* "}")?; L2Loss implements LossValue = name:"l2" ("{" params:Entry* "}")?;
EPELoss implements LossValue = name:"epe" ("{" params:Entry* "}")?;
LogCoshLoss implements LossValue = name:"log_cosh" ("{" params:Entry* "}")?; LogCoshLoss implements LossValue = name:"log_cosh" ("{" params:Entry* "}")?;
interface HuberEntry extends Entry; interface HuberEntry extends Entry;
...@@ -126,7 +129,7 @@ grammar CNNTrain extends de.monticore.lang.monticar.Common2, de.monticore.Number ...@@ -126,7 +129,7 @@ grammar CNNTrain extends de.monticore.lang.monticar.Common2, de.monticore.Number
Gamma2Entry implements RmsPropEntry = name:"gamma2" ":" value:NumberValue; Gamma2Entry implements RmsPropEntry = name:"gamma2" ":" value:NumberValue;
CenteredEntry implements RmsPropEntry = name:"centered" ":" value:BooleanValue; CenteredEntry implements RmsPropEntry = name:"centered" ":" value:BooleanValue;
ClipWeightsEntry implements RmsPropEntry = name:"clip_weights" ":" value:NumberValue; ClipWeightsEntry implements RmsPropEntry = name:"clip_weights" ":" value:NumberValue;
RhoEntry implements AdaDeltaEntry, HuberEntry = name:"rho" ":" value:NumberValue; RhoEntry implements AdaDeltaEntry,RmsPropEntry,HuberEntry = name:"rho" ":" value:NumberValue;
// Reinforcement Extensions // Reinforcement Extensions
interface MultiParamValue extends ConfigValue; interface MultiParamValue extends ConfigValue;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._ast; package de.monticore.lang.monticar.cnntrain._ast;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._ast; package de.monticore.lang.monticar.cnntrain._ast;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._ast; package de.monticore.lang.monticar.cnntrain._ast;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
*
* ******************************************************************************
* 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;
/**
*
*/
public interface CNNTrainConfigurationSymbolCoCo {
void check(ConfigurationSymbol 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;
/**
*
*/
public interface CNNTrainConfigurationSymbolCoCo {
void check(ConfigurationSymbol configurationSymbol);
}
\ No newline at end of file
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._cocos; package de.monticore.lang.monticar.cnntrain._cocos;
...@@ -35,6 +41,7 @@ class ParameterAlgorithmMapping { ...@@ -35,6 +41,7 @@ class ParameterAlgorithmMapping {
ASTNormalizeEntry.class, ASTNormalizeEntry.class,
ASTNumEpochEntry.class, ASTNumEpochEntry.class,
ASTLossEntry.class, ASTLossEntry.class,
ASTLossWeightsEntry.class,
ASTSparseLabelEntry.class, ASTSparseLabelEntry.class,
ASTFromLogitsEntry.class, ASTFromLogitsEntry.class,
ASTMarginEntry.class, ASTMarginEntry.class,
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._symboltable; package de.monticore.lang.monticar.cnntrain._symboltable;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._symboltable; package de.monticore.lang.monticar.cnntrain._symboltable;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._symboltable; package de.monticore.lang.monticar.cnntrain._symboltable;
...@@ -195,9 +201,15 @@ public class CNNTrainSymbolTableCreator extends CNNTrainSymbolTableCreatorTOP { ...@@ -195,9 +201,15 @@ public class CNNTrainSymbolTableCreator extends CNNTrainSymbolTableCreatorTOP {
param.setValue(lossParamValue); param.setValue(lossParamValue);
configuration.getLoss().getLossParamMap().put(nodeParam.getName(), param); configuration.getLoss().getLossParamMap().put(nodeParam.getName(), param);
} }
} }
@Override
public void endVisit(ASTLossWeightsEntry node) {
EntrySymbol entry = new EntrySymbol(node.getName());
entry.setValue(getValueSymbolForDoubleVector(node.getValue()));
addToScopeAndLinkWithNode(entry, node);
configuration.getEntryMap().put(node.getName(), entry);
}
@Override @Override
public void endVisit(ASTLRPolicyValue node) { public void endVisit(ASTLRPolicyValue node) {
...@@ -251,6 +263,7 @@ public class CNNTrainSymbolTableCreator extends CNNTrainSymbolTableCreatorTOP { ...@@ -251,6 +263,7 @@ public class CNNTrainSymbolTableCreator extends CNNTrainSymbolTableCreatorTOP {
addToScopeAndLinkWithNode(value, node); addToScopeAndLinkWithNode(value, node);
} }
private ValueSymbol getValueSymbolForInteger(ASTIntegerValue astIntegerValue) { private ValueSymbol getValueSymbolForInteger(ASTIntegerValue astIntegerValue) {
ValueSymbol value = new ValueSymbol(); ValueSymbol value = new ValueSymbol();
Integer value_as_int = getIntegerFromNumber(astIntegerValue); Integer value_as_int = getIntegerFromNumber(astIntegerValue);
...@@ -279,6 +292,13 @@ public class CNNTrainSymbolTableCreator extends CNNTrainSymbolTableCreatorTOP { ...@@ -279,6 +292,13 @@ public class CNNTrainSymbolTableCreator extends CNNTrainSymbolTableCreatorTOP {
return value; return value;
} }
private ValueSymbol getValueSymbolForDoubleVector(ASTDoubleVectorValue astDoubleVectorValue) {
ValueSymbol value = new ValueSymbol();
List<Double> value_as_double_list = getDoubleVectorFromList(astDoubleVectorValue);
value.setValue(value_as_double_list);
return value;
}
private ValueSymbol getValueSymbolForComponentName(ASTComponentNameValue astComponentNameValue) { private ValueSymbol getValueSymbolForComponentName(ASTComponentNameValue astComponentNameValue) {
ValueSymbol value = new ValueSymbol(); ValueSymbol value = new ValueSymbol();
List<String> valueAsList = astComponentNameValue.getNameList(); List<String> valueAsList = astComponentNameValue.getNameList();
...@@ -309,6 +329,14 @@ public class CNNTrainSymbolTableCreator extends CNNTrainSymbolTableCreatorTOP { ...@@ -309,6 +329,14 @@ public class CNNTrainSymbolTableCreator extends CNNTrainSymbolTableCreatorTOP {
return value2.isPresentTRUE(); return value2.isPresentTRUE();
} }
private List<Double> getDoubleVectorFromList(ASTDoubleVectorValue value) {
return value.getNumberList().stream()
.filter(n -> n.getNumber().isPresent())
.map(n -> n.getNumber().get())
.collect(Collectors.toList());
}
@Override @Override
public void visit(ASTLearningMethodEntry node) { public void visit(ASTLearningMethodEntry node) {
EntrySymbol entry = new EntrySymbol(node.getName()); EntrySymbol entry = new EntrySymbol(node.getName());
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._symboltable; package de.monticore.lang.monticar.cnntrain._symboltable;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnntrain._symboltable; package de.monticore.lang.monticar.cnntrain._symboltable;
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/