Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
languages
CNNArchLang
Commits
08aeee32
Commit
08aeee32
authored
Sep 09, 2019
by
Christian Fuß
Browse files
added CoCo for ArgMax layer
parent
f39baba8
Pipeline
#181541
passed with stages
in 20 minutes and 18 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/cnnarch/_cocos/CNNArchCocos.java
View file @
08aeee32
...
...
@@ -79,6 +79,7 @@ public class CNNArchCocos {
return
new
CNNArchSymbolCoCoChecker
()
.
addCoCo
(
new
CheckVariableDeclarationName
())
.
addCoCo
(
new
CheckVariableName
())
.
addCoCo
(
new
CheckArgmaxLayer
())
.
addCoCo
(
new
CheckExpressions
());
}
...
...
src/main/java/de/monticore/lang/monticar/cnnarch/_cocos/CheckArgmaxLayer.java
0 → 100644
View file @
08aeee32
/**
*
* ******************************************************************************
* 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.*
;
import
de.monticore.lang.monticar.cnnarch.helper.ErrorCodes
;
import
de.monticore.lang.monticar.cnnarch.predefined.AllPredefinedLayers
;
import
de.se_rwth.commons.logging.Log
;
public
class
CheckArgmaxLayer
extends
CNNArchSymbolCoCo
{
@Override
public
void
check
(
ArchitectureElementSymbol
symbol
)
{
if
(
symbol
instanceof
LayerSymbol
&&
symbol
.
getName
().
equals
(
AllPredefinedLayers
.
ARG_MAX_NAME
))
{
checkArgmaxBeforeOutput
((
LayerSymbol
)
symbol
);
}
}
public
void
checkArgmaxBeforeOutput
(
LayerSymbol
layer
)
{
if
(!(
layer
.
getOutputElement
().
get
()
instanceof
VariableSymbol
&&
((
VariableSymbol
)
layer
.
getOutputElement
().
get
()).
getType
()
==
VariableSymbol
.
Type
.
IO
)){
Log
.
error
(
"0"
+
ErrorCodes
.
ILLEGAL_LAYER_USE
+
" ArgMax Layer must be applied directly before an output symbol."
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment