Commit 41bd1e53 authored by cesomark's avatar cesomark

Added Datapath CoCos to Generator and test it

parent 69231de5
Pipeline #156021 failed with stages
in 11 seconds
......@@ -34,6 +34,7 @@ import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol;
import de.monticore.lang.monticar.cnntrain.CNNTrainGenerator;
import de.monticore.lang.monticar.cnntrain._symboltable.ConfigurationSymbol;
import de.monticore.lang.monticar.emadl._cocos.EMADLCocos;
import de.monticore.lang.monticar.emadl._cocos.DataPathCocos;
import de.monticore.lang.monticar.emadl.tagging.dltag.DataPathSymbol;
import de.monticore.lang.monticar.generator.FileContent;
import de.monticore.lang.monticar.generator.cpp.ArmadilloHelper;
......@@ -371,6 +372,7 @@ public class EMADLGenerator {
String dataPath;
if (!tags.isEmpty()) {
DataPathCocos.check(component, taggingResolver);
dataPath = (String) tags.get(0).getValues().get(0);
Log.warn("Tagfile was found, ignoring data_paths.txt: " + dataPath);
} else {
......
......@@ -189,7 +189,23 @@ public class GenerationTest extends AbstractSymtabTest {
EMADLGeneratorCli.main(args);
assertEquals(Log.getFindings().size(), 1);
assertEquals(Log.getFindings().get(0).toString(),
"Tagfile was found, ignoring data_paths.txt: src/test/resources/models");
assertTrue(Log.getErrorCount() == 0);
}
@Test
public void testInvalidPathCoCos() {
Log.getFindings().clear();
String[] args = { "-m", "src/test/resources/models/", "-r", "tagging.AlexnetInvalid", "-b", "MXNET", "-f", "n",
"-c", "n" };
EMADLGeneratorCli.main(args);
assertEquals(Log.getFindings().size(), 3);
assertEquals(Log.getFindings().get(0).toString(),
"Filepath '/Users/ceso/Documents/uni/SLE/projekt/EMADL2CPP/test/resources/models' does not exist!");
assertEquals(Log.getFindings().get(1).toString(), "DatapathType is incorrect, must be of Type: HDF5 or LMDB");
assertEquals(Log.getFindings().get(2).toString(),
"Tagfile was found, ignoring data_paths.txt: test/resources/models");
assertTrue(Log.getErrorCount() == 0);
}
}
......@@ -2,7 +2,10 @@ package tagging;
conforms to dltag.DataPathTagSchema;
tags Alexnet {
tag Alexnet with DataPath = {path = test/resources/models, type = random};
tag Alexnet with DataPath = {path = src/test/resources/models, type = LMDB};
tag AlexnetInvalid with DataPath = {path = test/resources/models, type = random};
tag Parent.a1 with DataPath = {path = instanceA1, type = random};
}
configuration AlexnetInvalid{
num_epoch : 100
batch_size : 500
optimizer : adam{
learning_rate : 0.001
}
}
package tagging;
component AlexnetInvalid{
ports in Z(0:255)^{3, 224, 224} image,
out Q(0:1)^{1000} predictions;
implementation CNN {
def split1(i){
[i] ->
Convolution(kernel=(5,5), channels=128) ->
Lrn(nsize=5, alpha=0.0001, beta=0.75) ->
Pooling(pool_type="max", kernel=(3,3), stride=(2,2), padding="no_loss") ->
Relu()
}
def split2(i){
[i] ->
Convolution(kernel=(3,3), channels=192) ->
Relu() ->
Convolution(kernel=(3,3), channels=128) ->
Pooling(pool_type="max", kernel=(3,3), stride=(2,2), padding="no_loss") ->
Relu()
}
def fc(){
FullyConnected(units=4096) ->
Relu() ->
Dropout()
}
image ->
Convolution(kernel=(11,11), channels=96, stride=(4,4), padding="no_loss") ->
Lrn(nsize=5, alpha=0.0001, beta=0.75) ->
Pooling(pool_type="max", kernel=(3,3), stride=(2,2), padding="no_loss") ->
Relu() ->
Split(n=2) ->
split1(i=[0|1]) ->
Concatenate() ->
Convolution(kernel=(3,3), channels=384) ->
Relu() ->
Split(n=2) ->
split2(i=[0|1]) ->
Concatenate() ->
fc(->=2) ->
FullyConnected(units=1000) ->
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