Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
C
CNNArchLang
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
monticore
EmbeddedMontiArc
languages
CNNArchLang
Commits
ac4bc0af
Commit
ac4bc0af
authored
Apr 27, 2020
by
Julian Johannes Steinsberger-Dührßen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added 2 new cocos for memory layers
parent
9dd5761f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
0 deletions
+102
-0
src/main/java/de/monticore/lang/monticar/cnnarch/_cocos/CNNArchCocos.java
.../monticore/lang/monticar/cnnarch/_cocos/CNNArchCocos.java
+2
-0
src/main/java/de/monticore/lang/monticar/cnnarch/_cocos/CheckMemoryLayer.java
...ticore/lang/monticar/cnnarch/_cocos/CheckMemoryLayer.java
+48
-0
src/main/java/de/monticore/lang/monticar/cnnarch/_cocos/CheckReplayMemoryLayer.java
.../lang/monticar/cnnarch/_cocos/CheckReplayMemoryLayer.java
+50
-0
src/main/java/de/monticore/lang/monticar/cnnarch/helper/ErrorCodes.java
...de/monticore/lang/monticar/cnnarch/helper/ErrorCodes.java
+2
-0
No files found.
src/main/java/de/monticore/lang/monticar/cnnarch/_cocos/CNNArchCocos.java
View file @
ac4bc0af
...
...
@@ -60,6 +60,7 @@ public class CNNArchCocos {
.
addCoCo
(
new
CheckLayerVariableDeclarationLayerType
())
.
addCoCo
(
new
CheckLayerVariableDeclarationIsUsed
())
.
addCoCo
(
new
CheckConstants
())
.
addCoCo
(
new
CheckMemoryLayer
())
.
addCoCo
(
new
CheckUnrollInputsOutputsTooMany
());
}
...
...
@@ -69,6 +70,7 @@ public class CNNArchCocos {
.
addCoCo
(
new
CheckVariableDeclarationName
())
.
addCoCo
(
new
CheckVariableName
())
.
addCoCo
(
new
CheckArgmaxLayer
())
.
addCoCo
(
new
CheckReplayMemoryLayer
())
.
addCoCo
(
new
CheckExpressions
());
}
...
...
src/main/java/de/monticore/lang/monticar/cnnarch/_cocos/CheckMemoryLayer.java
0 → 100644
View file @
ac4bc0af
/**
*
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
package
de.monticore.lang.monticar.cnnarch._cocos
;
import
de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureElementSymbol
;
import
de.monticore.lang.monticar.cnnarch._symboltable.LayerSymbol
;
import
de.monticore.lang.monticar.cnnarch._symboltable.ArgumentSymbol
;
import
de.monticore.lang.monticar.cnnarch.helper.ErrorCodes
;
import
de.se_rwth.commons.logging.Log
;
import
java.util.Optional
;
import
java.util.List
;
public
class
CheckMemoryLayer
extends
CNNArchSymbolCoCo
{
@Override
public
void
check
(
ArchitectureElementSymbol
sym
)
{
if
(
sym
instanceof
LayerSymbol
&&
sym
.
getName
().
equals
(
"Memory"
))
{
checkMemoryLayer
((
LayerSymbol
)
sym
);
}
}
public
void
checkMemoryLayer
(
LayerSymbol
layer
)
{
List
<
ArgumentSymbol
>
arguments
=
layer
.
getArguments
();
Integer
subKeySize
=
new
Integer
(
0
);
Integer
k
=
new
Integer
(
0
);
for
(
ArgumentSymbol
arg
:
arguments
)
{
if
(
arg
.
getName
().
equals
(
"subKeySize"
))
{
subKeySize
=
arg
.
getRhs
().
getIntValue
().
get
();
}
else
if
(
arg
.
getName
().
equals
(
"k"
))
{
k
=
arg
.
getRhs
().
getIntValue
().
get
();
}
}
if
(
subKeySize
<
k
)
{
Log
.
error
(
"0"
+
ErrorCodes
.
INVALID_MEMORY_LAYER_PARAMETERS
+
" Invalid Memory layer Parameter values, subKeySize has to be greater or equal to k. "
,
layer
.
getSourcePosition
());
}
}
}
src/main/java/de/monticore/lang/monticar/cnnarch/_cocos/CheckReplayMemoryLayer.java
0 → 100644
View file @
ac4bc0af
/**
*
* (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 */
package
de.monticore.lang.monticar.cnnarch._cocos
;
import
de.monticore.lang.monticar.cnnarch._symboltable.StreamInstructionSymbol
;
import
de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureElementSymbol
;
import
de.monticore.lang.monticar.cnnarch._symboltable.ParallelCompositeElementSymbol
;
import
de.monticore.lang.monticar.cnnarch._symboltable.SerialCompositeElementSymbol
;
import
de.monticore.lang.monticar.cnnarch.helper.ErrorCodes
;
import
de.se_rwth.commons.logging.Log
;
import
java.util.Optional
;
import
java.util.List
;
public
class
CheckReplayMemoryLayer
extends
CNNArchSymbolCoCo
{
@Override
public
void
check
(
StreamInstructionSymbol
stream
)
{
List
<
ArchitectureElementSymbol
>
elements
=
stream
.
getBody
().
getElements
();
for
(
ArchitectureElementSymbol
element
:
elements
){
if
(
element
instanceof
ParallelCompositeElementSymbol
){
checkForReplayMemory
((
ParallelCompositeElementSymbol
)
element
);
}
}
}
public
void
checkForReplayMemory
(
ParallelCompositeElementSymbol
parallelElement
)
{
for
(
ArchitectureElementSymbol
subStream:
parallelElement
.
getElements
()){
if
(
subStream
instanceof
SerialCompositeElementSymbol
){
//should always be the case
for
(
ArchitectureElementSymbol
element
:
((
SerialCompositeElementSymbol
)
subStream
).
getElements
()){
if
(
element
instanceof
ParallelCompositeElementSymbol
){
checkForReplayMemory
((
ParallelCompositeElementSymbol
)
element
);
}
else
if
(
element
.
getName
().
equals
(
"ReplayMemory"
))
{
Log
.
error
(
"0"
+
ErrorCodes
.
INVALID_REPLAY_MEMORY_LAYER_PLACEMENT
+
" Invalid placement of ReplayMemory layer. It can't be placed inside a Prallalel execution block."
,
element
.
getSourcePosition
());
}
}
}
}
}
}
src/main/java/de/monticore/lang/monticar/cnnarch/helper/ErrorCodes.java
View file @
ac4bc0af
...
...
@@ -37,6 +37,8 @@ public class ErrorCodes {
public
static
final
String
ILLEGAL_LAYER_USE
=
"x04845"
;
public
static
final
String
UNUSED_LAYER
=
"x04847"
;
public
static
final
String
INVALID_CONSTANT
=
"x04856"
;
public
static
final
String
INVALID_MEMORY_LAYER_PARAMETERS
=
"x04866"
;
public
static
final
String
INVALID_REPLAY_MEMORY_LAYER_PLACEMENT
=
"x04876"
;
public
static
final
String
OUTPUT_WRITTEN_TO_MULTIPLE_TIMES
=
"x04836"
;
public
static
final
String
UNROLL_INPUTS_TOO_MANY
=
"x02384"
;
public
static
final
String
UNROLL_OUTPUTS_TOO_MANY
=
"x02385"
;
...
...
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