Commit c9f47ac6 authored by Sebastian Nickels's avatar Sebastian Nickels

Added some stuff to fix compilation of CNNArch2MxNet

parent b3f4bc77
Pipeline #150599 failed with stages
......@@ -67,8 +67,6 @@ public abstract class CNNArchGenerator {
generate(scope, rootModelName);
}
public abstract void checkSupport(ArchitectureSymbol architecture);
public abstract void generate(Scope scope, String rootModelName);
//check cocos with CNNArchCocos.checkAll(architecture) before calling this method.
......
......@@ -44,6 +44,7 @@ public class AllPredefinedLayers {
public static final String ADD_NAME = "Add";
public static final String CONCATENATE_NAME = "Concatenate";
public static final String FLATTEN_NAME = "Flatten";
public static final String ONE_HOT_NAME = "OneHot";
//predefined argument names
public static final String KERNEL_NAME = "kernel";
......@@ -61,7 +62,7 @@ public class AllPredefinedLayers {
public static final String BETA_NAME = "beta";
public static final String PADDING_NAME = "padding";
public static final String POOL_TYPE_NAME = "pool_type";
public static final String SIZE_NAME = "size";
//possible String values
public static final String PADDING_VALID = "valid";
......
/**
*
* ******************************************************************************
* 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.predefined;
import de.monticore.lang.monticar.cnnarch._symboltable.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class OneHot extends PredefinedLayerDeclaration {
private OneHot() {
super(AllPredefinedLayers.ONE_HOT_NAME);
}
@Override
public List<ArchTypeSymbol> computeOutputTypes(List<ArchTypeSymbol> inputTypes, LayerSymbol layer) {
return Collections.singletonList(new ArchTypeSymbol.Builder()
.channels(layer.getIntValue(AllPredefinedLayers.SIZE_NAME).get())
.height(1)
.width(1)
.elementType("0", "1")
.build());
}
@Override
public void checkInput(List<ArchTypeSymbol> inputTypes, LayerSymbol layer) {
errorIfInputSizeIsNotOne(inputTypes, layer);
}
public static OneHot create(){
OneHot declaration = new OneHot();
List<VariableSymbol> parameters = new ArrayList<>(Arrays.asList(
new VariableSymbol.Builder()
.name(AllPredefinedLayers.SIZE_NAME)
.constraints(Constraints.POSITIVE, Constraints.INTEGER)
.build()));
declaration.setParameters(parameters);
return declaration;
}
}
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