Commit 3bfb1407 authored by Svetlana Pavlitskaya's avatar Svetlana Pavlitskaya

moved to monticore 5.0.0 and newer math, tests are not passing yet

parent 6b193247
Pipeline #67559 failed with stages
in 13 minutes and 46 seconds
#
#
# ******************************************************************************
# 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/>.
# *******************************************************************************
#
stages:
- windows
- linux
......
......@@ -37,12 +37,12 @@
<properties>
<!-- .. SE-Libraries .................................................. -->
<monticore.version>4.5.4.08.11.2017</monticore.version>
<se-commons.version>1.7.7</se-commons.version>
<monticore.version>5.0.0</monticore.version>
<se-commons.version>1.7.8</se-commons.version>
<mc.grammars.assembly.version>0.0.6</mc.grammars.assembly.version>
<SIUnit.version>0.0.10-SNAPSHOT</SIUnit.version>
<Common-MontiCar.version>0.0.12</Common-MontiCar.version>
<Math.version>0.0.11</Math.version>
<SIUnit.version>0.0.11</SIUnit.version>
<Common-MontiCar.version>0.0.14-SNAPSHOT</Common-MontiCar.version>
<Math.version>0.0.19-SNAPSHOT</Math.version>
<!-- .. Libraries .................................................. -->
<guava.version>18.0</guava.version>
......@@ -52,7 +52,7 @@
<commons-cli.version>1.4</commons-cli.version>
<!-- .. Plugins ....................................................... -->
<monticore.plugin>4.5.3.1</monticore.plugin>
<monticore.plugin>5.0.0</monticore.plugin>
<assembly.plugin>2.5.4</assembly.plugin>
<compiler.plugin>3.3</compiler.plugin>
<source.plugin>2.4</source.plugin>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
******************************************************************************
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/>.
*******************************************************************************
-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
......
package de.monticore.lang.monticar;
grammar CNNArch extends de.monticore.lang.math.Math {
grammar CNNArch extends de.monticore.lang.Math, de.monticore.lang.monticar.Common2,
de.monticore.CommonExpressions, de.monticore.SetExpressions {
token NEWLINETOKEN =
('\r' '\n' |
......@@ -113,12 +114,12 @@ grammar CNNArch extends de.monticore.lang.math.Math {
/**
Expressions for variable values.
*/
ArchSimpleExpression = (arithmeticExpression:MathArithmeticExpression
| booleanExpression:MathBooleanExpression
ArchSimpleExpression = (arithmeticExpression:Expression
| booleanExpression:Expression
| tupleExpression:TupleExpression
| string:StringLiteral);
TupleExpression = "(" expressions:MathArithmeticExpression "," expressions:(MathArithmeticExpression || ",")* ")";
TupleExpression = "(" expressions:Expression "," expressions:(Expression || ",")* ")";
/* =================================*/
......
......@@ -23,25 +23,26 @@ package de.monticore.lang.monticar.cnnarch._ast;
import de.monticore.lang.monticar.cnnarch.predefined.AllPredefinedVariables;
import java.util.List;
import java.util.Optional;
public class ASTArchSpecialArgument extends ASTArchSpecialArgumentTOP {
public ASTArchSpecialArgument() {
}
public ASTArchSpecialArgument(ASTArchExpression rhs, List<String> nEWLINETOKENs, String serial, String parallel, String conditional) {
public ASTArchSpecialArgument(ASTArchExpression rhs, List<String> nEWLINETOKENs, Optional<String> serial, Optional<String> parallel, Optional<String> conditional) {
super(rhs, nEWLINETOKENs, serial, parallel, conditional);
}
@Override
public String getName() {
if (getParallel().isPresent()){
if (isPresentParallel()){
return AllPredefinedVariables.PARALLEL_ARG_NAME;
}
else if (getSerial().isPresent()) {
else if (isPresentSerial()) {
return AllPredefinedVariables.SERIAL_ARG_NAME;
}
else if (getConditional().isPresent()){
else if (isPresentConditional()){
return AllPredefinedVariables.CONDITIONAL_ARG_NAME;
}
else {
......
......@@ -20,7 +20,7 @@
*/
package de.monticore.lang.monticar.cnnarch._cocos;
import de.monticore.lang.math.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.*;
import de.monticore.symboltable.Symbol;
......
......@@ -20,8 +20,8 @@
*/
package de.monticore.lang.monticar.cnnarch._cocos;
import de.monticore.lang.math.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math.math._symboltable.expression.MathNameExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathNameExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchSimpleExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.VariableSymbol;
......
......@@ -41,7 +41,7 @@ public class CheckIOType extends CNNArchSymbolCoCo {
public void checkIO(IODeclarationSymbol ioDeclaration) {
ArchTypeSymbol type = ioDeclaration.getType();
if (type.getDomain().isIsComplex() || type.getDomain().isIsBoolean()){
if (type.getDomain().isComplex() || type.getDomain().isBoolean()){
Log.error("0" + ErrorCodes.INVALID_IO_TYPE + " Invalid IO element type. " +
"Type has to be rational or whole number.");
}
......
......@@ -38,7 +38,7 @@ public class CheckLayer implements CNNArchASTLayerCoCo{
@Override
public void check(ASTLayer node) {
Set<String> nameSet = new HashSet<>();
for (ASTArchArgument argument : node.getArguments()){
for (ASTArchArgument argument : node.getArgumentsList()){
String name = argument.getName();
if (nameSet.contains(name)){
Log.error("0" + ErrorCodes.DUPLICATED_ARG + " Duplicated name: " + name +
......@@ -65,7 +65,7 @@ public class CheckLayer implements CNNArchASTLayerCoCo{
requiredArguments.add(param.getName());
}
}
for (ASTArchArgument argument : node.getArguments()){
for (ASTArchArgument argument : node.getArgumentsList()){
requiredArguments.remove(argument.getName());
}
......
......@@ -28,13 +28,13 @@ public class CheckRangeOperators implements CNNArchASTArchValueRangeCoCo {
@Override
public void check(ASTArchValueRange node) {
if (node.getParallel().isPresent()){
if (!node.getParallel2().isPresent()){
if (node.isPresentParallel()){
if (!node.isPresentParallel2()){
differentOperatorError(node);
}
}
else {
if (node.getParallel2().isPresent()){
if (node.isPresentParallel2()){
differentOperatorError(node);
}
}
......
......@@ -20,7 +20,7 @@
*/
package de.monticore.lang.monticar.cnnarch._symboltable;
import de.monticore.lang.math.math._symboltable.expression.*;
import de.monticore.lang.math._symboltable.expression.*;
import de.monticore.lang.monticar.cnnarch.helper.Calculator;
import de.monticore.lang.monticar.cnnarch.helper.Utils;
import de.monticore.symboltable.Scope;
......
......@@ -45,7 +45,7 @@ public class ArchTypeSymbol extends CommonSymbol {
public ArchTypeSymbol() {
super("", KIND);
ASTElementType elementType = new ASTElementType();
elementType.setTElementType(DEFAULT_ELEMENT_TYPE);
elementType.setName(DEFAULT_ELEMENT_TYPE);
setDomain(elementType);
}
......@@ -244,7 +244,7 @@ public class ArchTypeSymbol extends CommonSymbol {
}
public Builder elementType(String start, String end){
domain = new ASTElementType();
domain.setTElementType("Q(" + start + ":" + end +")");
domain.setName("Q(" + start + ":" + end +")");
return this;
}
......@@ -257,7 +257,7 @@ public class ArchTypeSymbol extends CommonSymbol {
if (domain == null){
domain = new ASTElementType();
domain.setTElementType(DEFAULT_ELEMENT_TYPE);
domain.setName(DEFAULT_ELEMENT_TYPE);
}
sym.setDomain(domain);
return sym;
......
......@@ -228,8 +228,8 @@ public class IOSymbol extends ArchitectureElementSymbol {
if (!Utils.equals(inputType, getDefinition().getType().getDomain())) {
Log.error("0" + ErrorCodes.INVALID_ELEMENT_INPUT_DOMAIN + " " +
"The declared output type of '" + name + "' does not match with the actual type. " +
"Declared type: " + getDefinition().getType().getDomain().getTElementType().get() + ". " +
"Actual type: " + inputType.getTElementType().get() + ".");
"Declared type: " + getDefinition().getType().getDomain().getName() + ". " +
"Actual type: " + inputType.getName() + ".");
}
}
......
......@@ -20,10 +20,10 @@
*/
package de.monticore.lang.monticar.cnnarch._symboltable;
import de.monticore.lang.math.math._ast.ASTMathFalseExpression;
import de.monticore.lang.math.math._ast.ASTMathTrueExpression;
import de.monticore.lang.math.math._symboltable.MathSymbolTableCreator;
import de.monticore.lang.math.math._symboltable.expression.MathNameExpressionSymbol;
import de.monticore.lang.math._ast.ASTMathFalseExpression;
import de.monticore.lang.math._ast.ASTMathTrueExpression;
import de.monticore.lang.math._symboltable.MathSymbolTableCreator;
import de.monticore.lang.math._symboltable.expression.MathNameExpressionSymbol;
import de.monticore.lang.monticar.cnnarch.predefined.AllPredefinedVariables;
import de.monticore.symboltable.MutableScope;
import de.monticore.symboltable.ResolvingConfiguration;
......
......@@ -20,6 +20,7 @@
*/
package de.monticore.lang.monticar.cnnarch._symboltable;
import com.google.gson.internal.Streams;
import de.monticore.lang.monticar.cnnarch.helper.ErrorCodes;
import de.monticore.lang.monticar.cnnarch.predefined.AllPredefinedLayers;
import de.monticore.lang.monticar.ranges._ast.ASTRange;
......@@ -29,6 +30,7 @@ import org.jscience.mathematics.number.Rational;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.function.BinaryOperator;
import java.util.stream.Stream;
......@@ -188,29 +190,35 @@ abstract public class PredefinedLayerDeclaration extends LayerDeclarationSymbol
}
protected List<String> computeStartAndEndValue(List<ArchTypeSymbol> inputTypes, BinaryOperator<Rational> startValAccumulator, BinaryOperator<Rational> endValAccumulator){
boolean noStartValues = true;
boolean noEndValues = true;
Stream.Builder<Rational> startValues = Stream.builder();
Stream.Builder<Rational> endValues = Stream.builder();
String start = null;
String end = null;
for (ArchTypeSymbol inputType : inputTypes){
ASTRange range = inputType.getDomain().getRange().get();
if (range.getStartInf().isPresent()){
start = "-oo";
}
else {
startValues.add(range.getStartValue());
}
if (range.getEndInf().isPresent()){
end = "oo";
}
else {
endValues.add(range.getEndValue());
Optional<ASTRange> range = inputType.getDomain().getRangeOpt();
if (range.isPresent()) {
if (range.get().hasNoLowerLimit()){
start = "-oo";
}
else {
noStartValues = false;
startValues.add(range.get().getStartValue());
}
if (range.get().hasNoUpperLimit()){
end = "oo";
}
else {
noEndValues = false;
endValues.add(range.get().getEndValue());
}
}
}
if (start == null){
if (start == null && !noStartValues){
start = "" + startValues.build().reduce(startValAccumulator).get().doubleValue();
}
if (end == null){
if (end == null && !noEndValues){
end = "" + endValues.build().reduce(endValAccumulator).get().doubleValue();
}
......
......@@ -20,7 +20,7 @@
*/
package de.monticore.lang.monticar.cnnarch._symboltable;
import de.monticore.lang.math.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.monticar.cnnarch.helper.Utils;
import java.util.LinkedList;
......
......@@ -20,7 +20,7 @@
*/
package de.monticore.lang.monticar.cnnarch.helper;
import de.monticore.lang.math.math._symboltable.expression.*;
import de.monticore.lang.math._symboltable.expression.*;
import de.monticore.lang.monticar.cnnarch._symboltable.TupleExpressionSymbol;
import de.monticore.lang.monticar.ranges._ast.ASTRange;
import de.monticore.lang.monticar.types2._ast.ASTElementType;
......@@ -155,40 +155,40 @@ public class Utils {
}
public static boolean equals(ASTElementType firstType, ASTElementType secondType){
if (firstType.isIsBoolean() ^ secondType.isIsBoolean()
|| firstType.isIsNatural() ^ secondType.isIsNatural()
|| firstType.isIsRational() ^ secondType.isIsRational()
|| firstType.isIsWholeNumberNumber() ^ secondType.isIsWholeNumberNumber()
|| firstType.isIsComplex() ^ secondType.isIsComplex()){
if (firstType.isBoolean() ^ secondType.isBoolean()
|| firstType.isNaturalNumber() ^ secondType.isNaturalNumber()
|| firstType.isRational() ^ secondType.isRational()
|| firstType.isWholeNumber() ^ secondType.isWholeNumber()
|| firstType.isComplex() ^ secondType.isComplex()){
return false;
}
if (firstType.getRange().isPresent()){
if (!secondType.getRange().isPresent()){
if (firstType.isPresentRange()){
if (!secondType.isPresentRange()){
return false;
}
}
else {
return !secondType.getRange().isPresent();
return !secondType.isPresentRange();
}
return equals(firstType.getRange().get(), secondType.getRange().get());
return equals(firstType.getRange(), secondType.getRange());
}
public static boolean equals(ASTRange firstRange, ASTRange secondRange){
if (firstRange.getStartInf().isPresent() ^ secondRange.getStartInf().isPresent()
|| firstRange.getEndInf().isPresent() ^ secondRange.getEndInf().isPresent()){
if (firstRange.hasNoLowerLimit() ^ secondRange.hasNoLowerLimit()
|| firstRange.hasNoUpperLimit() ^ secondRange.hasNoUpperLimit()){
return false;
}
if (!firstRange.getStartInf().isPresent() && !firstRange.getStartValue().equals(secondRange.getStartValue())){
if (!firstRange.hasNoLowerLimit() && !firstRange.getStartValue().equals(secondRange.getStartValue())){
return false;
}
if (!firstRange.getEndInf().isPresent() && !firstRange.getEndValue().equals(secondRange.getEndValue())){
if (!firstRange.hasNoUpperLimit() && !firstRange.getEndValue().equals(secondRange.getEndValue())){
return false;
}
if (firstRange.getStep().isPresent() ^ secondRange.getStep().isPresent()){
if (firstRange.isPresentStep() ^ secondRange.isPresentStep()){
return false;
}
if (firstRange.getStep().isPresent() && !firstRange.getStepValue().equals(secondRange.getStepValue())){
if (firstRange.isPresentStep() && !firstRange.getStepValue().equals(secondRange.getStepValue())){
return false;
}
......
......@@ -20,9 +20,9 @@
*/
package de.monticore.lang.monticar.cnnarch;
import de.monticore.lang.math.math._symboltable.expression.MathArithmeticExpressionSymbol;
import de.monticore.lang.math.math._symboltable.expression.MathNumberExpressionSymbol;
import de.monticore.lang.math.math._symboltable.expression.MathPreOperatorExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathArithmeticExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathNumberExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathPreOperatorExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchSimpleExpressionSymbol;
import de.monticore.lang.monticar.cnnarch.helper.Calculator;
import de.monticore.lang.numberunit.Rationals;
......
......@@ -25,6 +25,7 @@ import de.monticore.lang.monticar.cnnarch.predefined.AllPredefinedVariables;
import de.monticore.symboltable.Scope;
import de.se_rwth.commons.logging.Log;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import static de.monticore.lang.monticar.cnnarch.ParserTest.ENABLE_FAIL_QUICK;
......
......@@ -24,6 +24,7 @@ import de.monticore.lang.monticar.cnnarch._cocos.*;
import de.monticore.lang.monticar.cnnarch.helper.ErrorCodes;
import de.se_rwth.commons.logging.Log;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import static de.monticore.lang.monticar.cnnarch.ParserTest.ENABLE_FAIL_QUICK;
......
......@@ -32,4 +32,4 @@ architecture ResNet34(img_height=224, img_width=224, img_channels=3, classes=100
FullyConnected(units=classes) ->
Softmax() ->
predictions
}
}
\ No newline at end of file
......@@ -26,4 +26,4 @@ architecture SequentialAlexnet(img_height=224, img_width=224, img_channels=3, cl
FullyConnected(units=classes) ->
Softmax() ->
predictions
}
}
\ No newline at end of file
......@@ -28,4 +28,4 @@ architecture VGG16(img_height=224, img_width=224, img_channels=3, classes=1000){
FullyConnected(units=classes) ->
Softmax() ->
predictions
}
}
\ No newline at end of file
......@@ -31,4 +31,4 @@ architecture ArgumentConstraintTest1(img_height=224, img_width=224, img_channels
FullyConnected(units=classes, ->=true) ->
Softmax() ->
predictions
}
}
\ No newline at end of file
......@@ -31,4 +31,4 @@ architecture ArgumentConstraintTest2(img_height=224, img_width=224, img_channels
FullyConnected(units=classes) ->
Softmax() ->
predictions
}
}
\ No newline at end of file
......@@ -31,4 +31,4 @@ architecture ArgumentConstraintTest3(img_height=224, img_width=224, img_channels
FullyConnected(units=classes) ->
Softmax() ->
predictions
}
}
\ No newline at end of file
......@@ -31,4 +31,4 @@ architecture ArgumentConstraintTest4(img_height=224, img_width=224, img_channels
FullyConnected(units=classes) ->
Softmax() ->
predictions
}
}
\ No newline at end of file
......@@ -31,4 +31,4 @@ architecture ArgumentConstraintTest5(img_height=224, img_width=224, img_channels
FullyConnected(units=classes) ->
Softmax() ->
predictions
}
}
\ No newline at end of file
......@@ -31,4 +31,4 @@ architecture ArgumentConstraintTest6(img_height=224, img_width=224, img_channels
FullyConnected(units=classes) ->
Softmax() ->
predictions
}
}
\ No newline at end of file
......@@ -24,4 +24,4 @@ architecture InvalidArrayAccessValue(img_height=200, img_width=300, img_channels
FullyConnected(units=classes) ->
Softmax() ->
predictions
}
}
\ No newline at end of file
......@@ -37,4 +37,4 @@ architecture InvalidRecursion(img_height=224, img_width=224, img_channels=3, cla
FullyConnected(units=classes) ->
Softmax() ->
predictions
}
}
\ No newline at end of file
......@@ -29,4 +29,4 @@ architecture ThreeInputCNN_M14_alternative(img_height=200, img_width=300, img_ch
FullyConnected(units=classes) ->
Softmax() ->
predictions
}
}
\ 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