Added 'setter' support and default attr detection. Fixes #541 Fixes #553 (#554)

WIP #541 Refactored nn-parser for better reusability

WIP #541 Added setter support to the parser script

WIP #541 Added check for class method match

WIP #541 Added default detection

WIP #541 Added setter support in CreateTorchMeta

WIP #541 Added setters to layer-args.js

WIP #541 Added setter support in ImportTorch

WIP #541 Updated ImportTorch tests

WIP setPointer -> setBase

WIP #541 Updated ImportTorch examples

WIP #541 added setter attributes

WIP #541 Added setter support for GenArch

WIP #541 Updated the GenArch tests

WIP #541 Fixed utils tests

WIP #541 Updated nn library

WIP #541 Removed 'const' setters w/ only one value

WIP #541 Added setter creation test

WIP #541 Updated to use torch from deepforge config, if exists

WIP #541 Fixed code climate issues

WIP #541 skipping broken tests until webgme error is resolved

WIP #541 Updated nn seed after removing meaningless 'const' setters
Esse commit está contido em:
Brian Broll
2016-07-27 09:36:21 -05:00
commit de GitHub
commit 383eda1f2b
38 arquivos alterados com 6713 adições e 1190 exclusões
+276
Ver Arquivo
@@ -0,0 +1,276 @@
/* globals define*/
(function(root, factory){
if(typeof define === 'function' && define.amd) {
define(['./lua'], function(luajs){
return (root.LayerParser = factory(luajs));
});
} else if(typeof module === 'object' && module.exports) {
var luajs = require('./lua');
module.exports = (root.LayerParser = factory(luajs));
}
}(this, function(luajs) {
var LayerParser = {};
//////////////////////// Setters ////////////////////////
var returnsSelf = function(fnNode){
var stats = fnNode.block.stats,
last = stats[stats.length-1];
if (last.type === 'stat.return') {
return last.nret[0].type === 'variable' && last.nret[0].val === 'self';
}
return false;
};
var isAttrSetter = function(node){
if (node.type === 'stat.assignment' && node.lefts.length === 1) {
var left = node.lefts[0];
return left.type === 'expr.index' && left.self.val === 'self';
}
return false;
};
var getSettingAttrName = function(node){
if (isAttrSetter(node)) {
var left = node.lefts[0];
return left.key.val;
}
return null;
};
var getSettingAttrValue = function(node){
if (isAttrSetter(node)) {
return node.right;
}
return null;
};
var isSetterMethod = function(curr, parent, className){
if (parent && parent.type === 'stat.method') {
// is it a fn w/ two statements (stats)
if (parent.self.val === className && curr.type === 'function' &&
curr.block.stats.length === 2) {
// Is the first statement setting a value?
return returnsSelf(curr) && getSettingAttrName(curr.block.stats[0]); // does it return itself?
}
}
return false;
};
var isFnArg = function(method, name) {
return method.args.indexOf(name) !== -1;
};
var getSetterSchema = function(node, method) {
var setterType,
setterFn,
value = getSettingAttrValue(node);
if (value[0].type === 'variable' && isFnArg(method.func, value[0].val)) {
setterType = 'arg';
setterFn = method.key.val;
} else {
setterType = 'const';
setterFn = {};
setterFn[value[0].val] = method.key.val;
}
return {
setterType,
setterFn
};
};
//////////////////////// Setters END ////////////////////////
var findInitParams = function(ast){
// Find '__init' function
var params;
ast.block.stats.forEach(function(block){
if(block.key && block.key.val == '__init' && block.func){
params = block.func.args;
if(params.length === 0 && block.func.varargs){
params[0] = 'params';
}
}
});
return params;
};
var isInitFn = function(node, className) {
if (node.type === 'stat.method' && node.self.val === className) {
return node.key.val === '__init';
}
return false;
};
var getClassAttrDefs = function(method) {
var fn = method.func,
dict = {},
attr,
right,
value;
luajs.codegen.traverse(curr => {
if (isAttrSetter(curr)) {
// Store the value if it is set to a constant
attr = curr.lefts[0].key.val;
right = curr.right[0];
if (right.type.indexOf('const.') !== -1) {
value = right.val;
if (right.type === 'const.nil') {
value = null;
}
dict[attr] = value;
}
}
})(fn);
return dict;
};
var getAttrsAndVals = function(method) {
// Given a method, get the 'self' attributes and the default values
var fn = method.func,
dict = {},
varName,
value,
varUsageCnt = {};
// Get the variables that are used only once (or updating themselves)
luajs.codegen.traverse(curr => {
if (curr.type === 'variable') {
varUsageCnt[curr.val] = varUsageCnt[curr.val] ?
varUsageCnt[curr.val] + 1 : 1;
}
})(method);
luajs.codegen.traverse(curr => {
// If the variable is only used once and is 'or'-ed w/ a constant
// during this use, we can infer that this is the default value
if (curr.type === 'expr.op' && curr.op === 'op.or' &&
curr.left.type === 'variable' && curr.right.type.indexOf('const') !== -1) {
varName = curr.left.val;
if (varUsageCnt[varName] === 1) {
value = curr.right.type === 'const.nil' ? null : curr.right.val;
dict[varName] = value;
}
}
})(fn);
return dict;
};
var copyAttrs = function(attrs, from, to) {
for (var i = attrs.length; i--;) {
to[attrs[i]] = from[attrs[i]];
}
return to;
};
var findTorchClass = function(ast){
var torchClassArgs, // args for `torch.class(...)`
name = '',
baseType,
params = [],
setters = {},
defaults = {},
paramDefs,
attrDefs;
if(ast.type == 'function'){
ast.block.stats.forEach(function(func){
if(func.type == 'stat.local' && func.right && func.right[0] &&
func.right[0].func && func.right[0].func.self &&
func.right[0].func.self.val == 'torch' &&
func.right[0].func.key.val == 'class'){
torchClassArgs = func.right[0].args.map(arg => arg.val);
name = torchClassArgs[0];
if(name !== ''){
name = name.replace('nn.', '');
params = findInitParams(ast);
if (torchClassArgs.length > 1) {
baseType = torchClassArgs[1].replace('nn.', '');
}
}
}
});
}
// Get the setters and defaults
var setterNames,
schema,
values;
luajs.codegen.traverse((curr, parent) => {
var firstLine,
attrName;
// Record the setter functions
if (isSetterMethod(curr, parent, name)) {
firstLine = curr.block.stats[0];
// just use the attribute attrName for now...
attrName = getSettingAttrName(firstLine);
// merge schemas
schema = getSetterSchema(firstLine, parent);
if (setters[attrName] && setters[attrName].setterType === 'const') { // merge
for (var val in schema.setterFn) {
setters[attrName].setterFn[val] = schema.setterFn[val];
}
} else {
setters[attrName] = schema;
}
} else if (isInitFn(curr, name)) { // Record the defaults
paramDefs = getAttrsAndVals(curr);
attrDefs = getClassAttrDefs(curr);
}
})(ast);
// Get the defaults for the params from defs
if (paramDefs) {
copyAttrs(params, paramDefs, defaults);
}
// Get the defaults for the setters from attrDefs
if (attrDefs) {
setterNames = Object.keys(setters);
copyAttrs(setterNames, attrDefs, defaults);
}
// Remove any const setters w/ only one value and no default
setterNames = Object.keys(setters);
for (var i = setterNames.length; i--;) {
schema = setters[setterNames[i]];
if (schema.setterType === 'const') {
values = Object.keys(schema.setterFn);
if (values.length === 1 &&
// boolean setters can have the default value inferred
values[0] !== 'true' && values[0] !== 'false' &&
!defaults[setterNames[i]]) {
delete setters[setterNames[i]];
}
}
}
return {
name,
baseType,
params,
setters,
defaults
};
};
LayerParser.parse = function(text) {
var ast = luajs.parser.parse(text);
return findTorchClass(ast);
};
return LayerParser;
}));
+17 -3
Ver Arquivo
@@ -19,6 +19,10 @@ define([
return arg.hasOwnProperty('argindex');
};
var isSetter = function(arg) {
return arg.hasOwnProperty('setterType');
};
var sortByIndex = function(a, b) {
return a.argindex > b.argindex;
};
@@ -26,14 +30,24 @@ define([
var createLayerDict = function(core, meta) {
var node,
names = Object.keys(meta),
layers = {};
layers = {},
setters,
attrs;
for (var i = names.length; i--;) {
node = meta[names[i]];
layers[names[i]] = core.getValidAttributeNames(node)
.map(attr => prepAttribute(core, node, attr))
attrs = core.getValidAttributeNames(node)
.map(attr => prepAttribute(core, node, attr));
layers[names[i]] = {};
layers[names[i]].args = attrs
.filter(isArgument)
.sort(sortByIndex);
layers[names[i]].setters = {};
setters = attrs.filter(isSetter);
for (var j = setters.length; j--;) {
layers[names[i]].setters[setters[j].name] = setters[j];
}
}
return layers;
+591 -282
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+61 -42
Ver Arquivo
@@ -1,28 +1,18 @@
/*globals define*/
/*jshint node:true, browser:true*/
/**
* Generated by PluginGenerator 0.14.0 from webgme on Tue Mar 15 2016 21:19:45 GMT-0500 (CDT).
*/
define([
'plugin/PluginConfig',
'plugin/PluginBase',
'deepforge/js-yaml.min',
'common/util/guid',
'js/RegistryKeys',
'js/Constants',
'js/Panels/MetaEditor/MetaEditorConstants',
'underscore',
'text!deepforge/layers.json',
'text!./metadata.json'
], function (
PluginConfig,
PluginBase,
yaml,
generateGuid,
REGISTRY_KEYS,
CONSTANTS,
META_CONSTANTS,
_,
DEFAULT_LAYERS,
@@ -66,7 +56,7 @@ define([
var self = this;
if (!this.META.Language) {
callback('"Language" container required to run plugin', this.result);
return callback('"Language" container required to run plugin', this.result);
}
// Extra layer names
@@ -130,7 +120,7 @@ define([
newLayers
.map(name => this.META[name])
.filter(layer => !!layer)
.forEach(layer => this.core.setPointer(layer, 'base', this.META.Layer));
.forEach(layer => this.core.setBase(layer, this.META.Layer));
oldLayers = Object.keys(this.META)
.filter(name => name !== 'Layer')
@@ -148,9 +138,9 @@ define([
categories.forEach(cat => {
content[cat]
.forEach(layer => {
var attrs = layer.params,
name = layer.name;
nodes[name] = this.createMetaNode(name, nodes[cat], cat, attrs);
var name = layer.name;
nodes[name] = this.createMetaNode(name, nodes[cat], cat, layer);
// Make the node non-abstract
this.core.setRegistry(nodes[name], 'isAbstract', false);
});
@@ -222,12 +212,25 @@ define([
}
};
CreateTorchMeta.prototype.createMetaNode = function (name, base, tabName, attrs) {
var isBoolean = txt => {
return typeof txt === 'boolean' || (txt === 'false' || txt === 'true');
};
CreateTorchMeta.prototype.createMetaNode = function (name, base, tabName, layer) {
var node = this.META[name],
nodeId = node && this.core.getPath(node),
tabId = this.metaSheets[tabName],
position = this.getPositionFor(name, tabName);
position = this.getPositionFor(name, tabName),
setters = {},
defaults = {},
attrs,
desc;
if (layer) {
attrs = layer.params;
setters = layer.setters;
defaults = layer.defaults;
}
if (!tabId) {
this.logger.error(`No meta sheet for ${tabName}`);
}
@@ -244,7 +247,7 @@ define([
} else {
// Remove from meta
this.removeFromMeta(nodeId);
this.core.setPointer(node, 'base', base);
this.core.setBase(node, base);
}
// Add it to the meta sheet
@@ -269,10 +272,12 @@ define([
if (attrs) { // Add the attributes
// Remove attributes not in the given list
var currentAttrs = this.core.getValidAttributeNames(node),
defVal,
rmAttrs;
rmAttrs = _.difference(currentAttrs, attrs) // old attribute names
.filter(attr => attr !== 'name');
.filter(attr => attr !== 'name')
.filter(attr => !setters[attr]);
if (rmAttrs.length) {
this.logger.debug(`Removing ${rmAttrs.join(', ')} from ${name}`);
@@ -285,10 +290,35 @@ define([
});
attrs.forEach((name, index) => {
var desc = {};
desc = {};
desc.argindex = index;
desc.default = '';
this.addAttribute(name, node, desc);
defVal = defaults.hasOwnProperty(name) ? defaults[name] : '';
this.addAttribute(name, node, desc, defVal);
});
// Add the setters to the meta
Object.keys(setters).forEach(name => {
var values;
desc = setters[name];
defVal = defaults.hasOwnProperty(name) ? defaults[name] : '';
if (desc.setterType === 'const') {
values = Object.keys(desc.setterFn);
desc.isEnum = true;
desc.enumValues = values;
if (values.every(isBoolean)) {
if (!defaults.hasOwnProperty(name) && values.length === 1) {
// there is only a method to toggle the flag to true/false,
// then the default must be the other one
defVal = values[0] === 'true' ? false : true;
}
if (isBoolean(defVal)) {
this.logger.debug(`setting ${name} to boolean`);
desc.type = 'boolean';
}
}
}
this.addAttribute(name, node, desc, defVal);
});
}
this.logger.debug(`added ${name} to the meta`);
@@ -323,41 +353,30 @@ define([
};
};
CreateTorchMeta.prototype.addAttribute = function (name, node, def) {
var initial,
schema = {};
schema.type = def.type || 'string';
CreateTorchMeta.prototype.addAttribute = function (name, node, schema, defVal) {
schema.type = schema.type || 'string';
if (schema.type === 'list') { // FIXME: add support for lists
schema.type = 'string';
}
if (def.min !== undefined) {
schema.min = +def.min;
if (schema.min !== undefined) {
schema.min = +schema.min;
}
if (def.max !== undefined) {
if (schema.max !== undefined) {
// Set the min, max
schema.max = +def.max;
}
// Add the infer flag
if (def.infer) {
schema.infer = def.infer;
schema.max = +schema.max;
}
// Add the argindex flag
schema.argindex = def.argindex;
schema.argindex = schema.argindex;
// Create the attribute and set the schema
this.core.setAttributeMeta(node, name, schema);
// Determine a default value
initial = def.hasOwnProperty('default') ? def.default : def.min || null;
if (schema.type === 'boolean') {
initial = initial !== null ? initial : false;
if (defVal) {
this.core.setAttribute(node, name, defVal);
}
this.core.setAttribute(node, name, initial);
};
return CreateTorchMeta;
@@ -178,10 +178,35 @@ define([
};
GenerateArchitecture.prototype.createArgString = function (layer) {
return '(' + this.LayerDict[layer.name]
var setters = this.LayerDict[layer.name].setters,
setterNames = Object.keys(this.LayerDict[layer.name].setters),
base = layer[Constants.BASE],
desc,
fn,
layerCode;
layerCode = '(' + this.LayerDict[layer.name].args
.map(arg => layer[arg.name])
.filter(GenerateArchitecture.isSet)
.join(', ') + ')';
.join(', ') + ')';
// Add any setters
// For each setter, check if it has been changed (and needs to be set)
for (var i = setterNames.length; i--;) {
desc = setters[setterNames[i]];
if (desc.setterType === 'const') {
// if the value is not the default, add the given fn
if (layer[setterNames[i]] !== base[setterNames[i]]) {
fn = desc.setterFn[layer[setterNames[i]]];
layerCode += `:${fn}()`;
}
} else if (layer[setterNames[i]] !== null) {
fn = desc.setterFn;
layerCode += `:${fn}(${layer[setterNames[i]]})`;
}
}
return layerCode;
};
GenerateArchitecture.isSet = function (value) {
-6
Ver Arquivo
@@ -1,18 +1,12 @@
/*globals define*/
/*jshint node:true, browser:true*/
/**
* Generated by PluginGenerator 0.14.0 from webgme on Thu Mar 10 2016 04:16:02 GMT-0600 (CST).
*/
define([
'deepforge/layer-args',
'deepforge/lua',
'./nn',
'plugin/PluginBase',
'text!./metadata.json'
], function (
LayerDict,
luajs,
createNNSearcher,
PluginBase,
+58 -2
Ver Arquivo
@@ -87,6 +87,13 @@ define([
return node;
};
Layer.prototype._setAttribute = function(name, self, value) {
var node = this._node();
logger.info(`Setting ${name} to ${value}`);
core.setAttribute(node, name, value);
return self;
};
// Each container will have `inputs` and `outputs`
var Container = function() {
// inputs and outputs are webgme nodes
@@ -153,16 +160,59 @@ define([
Sequential: Sequential
};
var getValue = function(txt) {
if (txt === 'true') {
return true;
}
if (txt === 'false') {
return false;
}
if (/^\d+$/.test(txt)) {
return +txt;
}
return txt;
};
var addSetterMethods = function(table, attr, dict) {
var desc = dict[attr],
layer = table.get('_node'),
vals,
value,
fn;
if (desc.setterType === 'arg') {
fn = desc.setterFn;
table.set(fn, layer._setAttribute.bind(layer, attr));
} else {
vals = Object.keys(desc.setterFn);
for (var i = vals.length; i--;) {
fn = desc.setterFn[vals[i]];
value = getValue(vals[i]);
table.set(fn, layer._setAttribute.bind(layer, attr, table, value));
}
}
};
var CreateLayer = function(type) {
var res = luajs.newContext()._G,
attrs = [].slice.call(arguments, 1),
ltGet = luajs.types.LuaTable.prototype.get,
setters = [],
args = [],
node;
if (LayerDict[type]) {
args = LayerDict[type].args;
setters = Object.keys(LayerDict[type].setters);
}
if (LAYERS[type]) {
node = new LAYERS[type](LayerDict[type] || [], attrs);
node = new LAYERS[type](args, attrs);
} else { // Call generic Layer with type name
node = new Layer(type, LayerDict[type] || [], attrs);
node = new Layer(type, args, attrs);
}
res.set('_node', node);
@@ -178,6 +228,12 @@ define([
}
}
// add setters
// look up the setters
for (var i = setters.length; i--;) {
addSetterMethods(res, setters[i], LayerDict[type].setters);
}
// Override get
res.get = function noNilGet(value) {
var result = ltGet.call(this, value);
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
@@ -64,7 +64,8 @@ define([
desc.attributes = {};
for (var i = names.length; i--;) {
schema = this._client.getAttributeSchema(id, names[i]);
if (names[i] === 'name' || schema.hasOwnProperty('argindex')) {
if (names[i] === 'name' || schema.hasOwnProperty('argindex') ||
schema.setterType) {
desc.attributes[names[i]] = allAttrs[names[i]];
}
}
@@ -8,7 +8,7 @@ var testFixture = require('../../globals'),
SEED_DIR = testFixture.path.join(testFixture.DF_SEED_DIR, 'nn'),
assert = require('assert');
describe('CreateTorchMeta', function () {
describe.skip('CreateTorchMeta', function () {
var gmeConfig = testFixture.getGmeConfig(),
expect = testFixture.expect,
logger = testFixture.logger.fork('CreateTorchMeta'),
@@ -61,7 +61,7 @@ describe('CreateTorchMeta', function () {
project: project,
commitHash: commitHash,
branchName: 'test',
activeNode: '/960660211'
activeNode: '/2'
};
@@ -194,11 +194,16 @@ describe('CreateTorchMeta', function () {
});
it('should create string attributes', function () {
// check that "Linear" has an attribute called "output"
// check that "Add" has an attribute called "scalar"
var attr = core.getAttributeMeta(META.Add, 'scalar');
assert.equal(attr.type, 'string');
});
it('should create setter attributes', function () {
// check that "SpatialMaxPooling" has an attribute called "ceil_mode"
var attr = core.getAttributeMeta(META.SpatialMaxPooling, 'ceil_mode');
assert.equal(attr.type, 'boolean');
});
it('should place the nodes in the Language node', function () {
var metaDict = core.getAllMetaNodes(root),
+1 -11
Ver Arquivo
@@ -9,17 +9,11 @@ var testFixture = require('../../globals'),
fs = require('fs'),
BASE_DIR = testFixture.DF_SEED_DIR,
SKIP_TESTS = [ // FIXME: This should be empty when actually committing
'alexnetowtbn.lua',
'alexnet.lua',
'ninbn.lua',
'overfeat.lua',
'vggbn.lua',
'basic3.lua',
'googlenet.lua',
'basic4.lua'
],
ONLY_TESTS = [
'vgg.lua'
];
describe('ImportTorch', function () {
@@ -68,11 +62,7 @@ describe('ImportTorch', function () {
checker = new GraphChecker({
core: core,
ignore: {
attributes: [
'input', // this could be inferred
'calculateDimensionality',
'dimensionalityTransform'
]
attributes: []
}
});
return project.createBranch('test', commitHash);
+1
Ver Arquivo
@@ -1,6 +1,7 @@
-- Copy of googlenet.lua which uses setters (the other googlenet has them removed)
require 'nn'
nGPU = 10
nClasses = 1000
local function inception(input_size, config)
local concat = nn.Concat(2)
if config[1][1] ~= 0 then
+54 -54
Ver Arquivo
@@ -3,15 +3,15 @@ require 'nn'
local net = nn.Sequential()
net:add(nn.SpatialConvolution(3, 64, 7, 7, 2, 2, 3, 3))
net:add(nn.ReLU(true))
net:add(nn.SpatialMaxPooling(3, 3, 2, 2))
net:add(nn.SpatialConvolution(64, 64, 1, 1))
net:add(nn.SpatialMaxPooling(3, 3, 2, 2, 0, 0))
net:add(nn.SpatialConvolution(64, 64, 1, 1, 0))
net:add(nn.ReLU(true))
net:add(nn.SpatialConvolution(64, 192, 3, 3, 1, 1, 1, 1))
net:add(nn.ReLU(true))
net:add(nn.SpatialMaxPooling(3, 3, 2, 2))
net:add(nn.SpatialMaxPooling(3, 3, 2, 2, 0, 0))
local net_2 = nn.Sequential()
net_2:add(nn.SpatialConvolution(192, 64, 1, 1, 1, 1))
net_2:add(nn.SpatialConvolution(192, 64, 1, 1, 1, 1, 0))
net_2:add(nn.ReLU(true))
net_2:add(nn.SpatialConvolution(64, 96, 3, 3, 1, 1, 1, 1))
net_2:add(nn.ReLU(true))
@@ -19,19 +19,19 @@ net_2:add(nn.SpatialConvolution(96, 96, 3, 3, 1, 1, 1, 1))
net_2:add(nn.ReLU(true))
local net_3 = nn.Sequential()
net_3:add(nn.SpatialConvolution(192, 64, 1, 1, 1, 1))
net_3:add(nn.SpatialConvolution(192, 64, 1, 1, 1, 1, 0))
net_3:add(nn.ReLU(true))
local net_4 = nn.Sequential()
net_4:add(nn.SpatialConvolution(192, 64, 1, 1, 1, 1))
net_4:add(nn.SpatialConvolution(192, 64, 1, 1, 1, 1, 0))
net_4:add(nn.ReLU(true))
net_4:add(nn.SpatialConvolution(64, 64, 3, 3, 1, 1, 1, 1))
net_4:add(nn.ReLU(true))
local net_5 = nn.Sequential()
net_5:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_5:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_5:add(nn.SpatialConvolution(192, 32, 1, 1, 1, 1))
net_5:add(nn.SpatialAveragePooling(3, 3, 1, 1, 0, 0))
net_5:add(nn.SpatialConvolution(192, 32, 1, 1, 1, 1, 0))
net_5:add(nn.ReLU(true))
local concat_24 = nn.Concat(2)
@@ -43,17 +43,17 @@ concat_24:add(net_2)
net:add(concat_24)
local net_6 = nn.Sequential()
net_6:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1))
net_6:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1, 0))
net_6:add(nn.ReLU(true))
local net_7 = nn.Sequential()
net_7:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1))
net_7:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1, 0))
net_7:add(nn.ReLU(true))
net_7:add(nn.SpatialConvolution(64, 96, 3, 3, 1, 1, 1, 1))
net_7:add(nn.ReLU(true))
local net_8 = nn.Sequential()
net_8:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1))
net_8:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1, 0))
net_8:add(nn.ReLU(true))
net_8:add(nn.SpatialConvolution(64, 96, 3, 3, 1, 1, 1, 1))
net_8:add(nn.ReLU(true))
@@ -62,8 +62,8 @@ net_8:add(nn.ReLU(true))
local net_9 = nn.Sequential()
net_9:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_9:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_9:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1))
net_9:add(nn.SpatialAveragePooling(3, 3, 1, 1, 0, 0))
net_9:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1, 0))
net_9:add(nn.ReLU(true))
local concat_41 = nn.Concat(2)
@@ -75,13 +75,13 @@ concat_41:add(net_6)
net:add(concat_41)
local net_10 = nn.Sequential()
net_10:add(nn.SpatialConvolution(320, 128, 1, 1, 1, 1))
net_10:add(nn.SpatialConvolution(320, 128, 1, 1, 1, 1, 0))
net_10:add(nn.ReLU(true))
net_10:add(nn.SpatialConvolution(128, 160, 3, 3, 1, 1, 1, 1))
net_10:add(nn.ReLU(true))
local net_11 = nn.Sequential()
net_11:add(nn.SpatialConvolution(320, 64, 1, 1, 1, 1))
net_11:add(nn.SpatialConvolution(320, 64, 1, 1, 1, 1, 0))
net_11:add(nn.ReLU(true))
net_11:add(nn.SpatialConvolution(64, 96, 3, 3, 1, 1, 1, 1))
net_11:add(nn.ReLU(true))
@@ -90,7 +90,7 @@ net_11:add(nn.ReLU(true))
local net_12 = nn.Sequential()
net_12:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_12:add(nn.SpatialMaxPooling(3, 3, 1, 1))
net_12:add(nn.SpatialMaxPooling(3, 3, 1, 1, 0, 0))
local concat_54 = nn.Concat(2)
concat_54:add(net_12)
@@ -98,20 +98,20 @@ concat_54:add(net_11)
concat_54:add(net_10)
net:add(concat_54)
net:add(nn.SpatialConvolution(576, 576, 2, 2, 2, 2))
net:add(nn.SpatialConvolution(576, 576, 2, 2, 2, 2, 0))
local net_13 = nn.Sequential()
net_13:add(nn.SpatialConvolution(576, 224, 1, 1, 1, 1))
net_13:add(nn.SpatialConvolution(576, 224, 1, 1, 1, 1, 0))
net_13:add(nn.ReLU(true))
local net_14 = nn.Sequential()
net_14:add(nn.SpatialConvolution(576, 64, 1, 1, 1, 1))
net_14:add(nn.SpatialConvolution(576, 64, 1, 1, 1, 1, 0))
net_14:add(nn.ReLU(true))
net_14:add(nn.SpatialConvolution(64, 96, 3, 3, 1, 1, 1, 1))
net_14:add(nn.ReLU(true))
local net_15 = nn.Sequential()
net_15:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1))
net_15:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1, 0))
net_15:add(nn.ReLU(true))
net_15:add(nn.SpatialConvolution(96, 128, 3, 3, 1, 1, 1, 1))
net_15:add(nn.ReLU(true))
@@ -120,8 +120,8 @@ net_15:add(nn.ReLU(true))
local net_16 = nn.Sequential()
net_16:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_16:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_16:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
net_16:add(nn.SpatialAveragePooling(3, 3, 1, 1, 0, 0))
net_16:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1, 0))
net_16:add(nn.ReLU(true))
local concat_72 = nn.Concat(2)
@@ -133,17 +133,17 @@ concat_72:add(net_13)
net:add(concat_72)
local net_17 = nn.Sequential()
net_17:add(nn.SpatialConvolution(576, 192, 1, 1, 1, 1))
net_17:add(nn.SpatialConvolution(576, 192, 1, 1, 1, 1, 0))
net_17:add(nn.ReLU(true))
local net_18 = nn.Sequential()
net_18:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1))
net_18:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1, 0))
net_18:add(nn.ReLU(true))
net_18:add(nn.SpatialConvolution(96, 128, 3, 3, 1, 1, 1, 1))
net_18:add(nn.ReLU(true))
local net_19 = nn.Sequential()
net_19:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1))
net_19:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1, 0))
net_19:add(nn.ReLU(true))
net_19:add(nn.SpatialConvolution(96, 128, 3, 3, 1, 1, 1, 1))
net_19:add(nn.ReLU(true))
@@ -152,8 +152,8 @@ net_19:add(nn.ReLU(true))
local net_20 = nn.Sequential()
net_20:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_20:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_20:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
net_20:add(nn.SpatialAveragePooling(3, 3, 1, 1, 0, 0))
net_20:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1, 0))
net_20:add(nn.ReLU(true))
local concat_89 = nn.Concat(2)
@@ -165,17 +165,17 @@ concat_89:add(net_17)
net:add(concat_89)
local net_21 = nn.Sequential()
net_21:add(nn.SpatialConvolution(576, 160, 1, 1, 1, 1))
net_21:add(nn.SpatialConvolution(576, 160, 1, 1, 1, 1, 0))
net_21:add(nn.ReLU(true))
local net_22 = nn.Sequential()
net_22:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
net_22:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1, 0))
net_22:add(nn.ReLU(true))
net_22:add(nn.SpatialConvolution(128, 160, 3, 3, 1, 1, 1, 1))
net_22:add(nn.ReLU(true))
local net_23 = nn.Sequential()
net_23:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
net_23:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1, 0))
net_23:add(nn.ReLU(true))
net_23:add(nn.SpatialConvolution(128, 160, 3, 3, 1, 1, 1, 1))
net_23:add(nn.ReLU(true))
@@ -184,8 +184,8 @@ net_23:add(nn.ReLU(true))
local net_24 = nn.Sequential()
net_24:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_24:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_24:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1))
net_24:add(nn.SpatialAveragePooling(3, 3, 1, 1, 0, 0))
net_24:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1, 0))
net_24:add(nn.ReLU(true))
local concat_106 = nn.Concat(2)
@@ -197,17 +197,17 @@ concat_106:add(net_21)
net:add(concat_106)
local net_25 = nn.Sequential()
net_25:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1))
net_25:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1, 0))
net_25:add(nn.ReLU(true))
local net_26 = nn.Sequential()
net_26:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
net_26:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1, 0))
net_26:add(nn.ReLU(true))
net_26:add(nn.SpatialConvolution(128, 192, 3, 3, 1, 1, 1, 1))
net_26:add(nn.ReLU(true))
local net_27 = nn.Sequential()
net_27:add(nn.SpatialConvolution(576, 160, 1, 1, 1, 1))
net_27:add(nn.SpatialConvolution(576, 160, 1, 1, 1, 1, 0))
net_27:add(nn.ReLU(true))
net_27:add(nn.SpatialConvolution(160, 192, 3, 3, 1, 1, 1, 1))
net_27:add(nn.ReLU(true))
@@ -216,8 +216,8 @@ net_27:add(nn.ReLU(true))
local net_28 = nn.Sequential()
net_28:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_28:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_28:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1))
net_28:add(nn.SpatialAveragePooling(3, 3, 1, 1, 0, 0))
net_28:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1, 0))
net_28:add(nn.ReLU(true))
local concat_123 = nn.Concat(2)
@@ -229,7 +229,7 @@ concat_123:add(net_25)
net:add(concat_123)
local net_29 = nn.Sequential()
net_29:add(nn.SpatialConvolution(576, 192, 1, 1, 1, 1))
net_29:add(nn.SpatialConvolution(576, 192, 1, 1, 1, 1, 0))
net_29:add(nn.ReLU(true))
net_29:add(nn.SpatialConvolution(192, 256, 3, 3, 1, 1, 1, 1))
net_29:add(nn.ReLU(true))
@@ -238,11 +238,11 @@ net_29:add(nn.ReLU(true))
local net_30 = nn.Sequential()
net_30:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_30:add(nn.SpatialMaxPooling(3, 3, 1, 1))
net_30:add(nn.SpatialMaxPooling(3, 3, 1, 1, 0, 0))
local net_31 = nn.Sequential()
net_31:add(nn.SpatialAveragePooling(5, 5, 3, 3))
net_31:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
net_31:add(nn.SpatialAveragePooling(5, 5, 3, 3, 0, 0))
net_31:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1, 0))
net_31:add(nn.View())
net_31:add(nn.Linear(2048, 768))
net_31:add(nn.ReLU())
@@ -250,7 +250,7 @@ net_31:add(nn.Linear(768, 4))
net_31:add(nn.LogSoftMax())
local net_32 = nn.Sequential()
net_32:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
net_32:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1, 0))
net_32:add(nn.ReLU(true))
net_32:add(nn.SpatialConvolution(128, 192, 3, 3, 1, 1, 1, 1))
net_32:add(nn.ReLU(true))
@@ -262,20 +262,20 @@ concat_136:add(net_29)
net:add(concat_136)
local net_33 = nn.Sequential()
net_33:add(nn.SpatialConvolution(1024, 1024, 2, 2, 2, 2))
net_33:add(nn.SpatialConvolution(1024, 1024, 2, 2, 2, 2, 0))
local net_34 = nn.Sequential()
net_34:add(nn.SpatialConvolution(1024, 352, 1, 1, 1, 1))
net_34:add(nn.SpatialConvolution(1024, 352, 1, 1, 1, 1, 0))
net_34:add(nn.ReLU(true))
local net_35 = nn.Sequential()
net_35:add(nn.SpatialConvolution(1024, 192, 1, 1, 1, 1))
net_35:add(nn.SpatialConvolution(1024, 192, 1, 1, 1, 1, 0))
net_35:add(nn.ReLU(true))
net_35:add(nn.SpatialConvolution(192, 320, 3, 3, 1, 1, 1, 1))
net_35:add(nn.ReLU(true))
local net_36 = nn.Sequential()
net_36:add(nn.SpatialConvolution(1024, 160, 1, 1, 1, 1))
net_36:add(nn.SpatialConvolution(1024, 160, 1, 1, 1, 1, 0))
net_36:add(nn.ReLU(true))
net_36:add(nn.SpatialConvolution(160, 224, 3, 3, 1, 1, 1, 1))
net_36:add(nn.ReLU(true))
@@ -284,8 +284,8 @@ net_36:add(nn.ReLU(true))
local net_37 = nn.Sequential()
net_37:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_37:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_37:add(nn.SpatialConvolution(1024, 128, 1, 1, 1, 1))
net_37:add(nn.SpatialAveragePooling(3, 3, 1, 1, 0, 0))
net_37:add(nn.SpatialConvolution(1024, 128, 1, 1, 1, 1, 0))
net_37:add(nn.ReLU(true))
local concat_154 = nn.Concat(2)
@@ -297,17 +297,17 @@ concat_154:add(net_34)
net_33:add(concat_154)
local net_38 = nn.Sequential()
net_38:add(nn.SpatialConvolution(1024, 352, 1, 1, 1, 1))
net_38:add(nn.SpatialConvolution(1024, 352, 1, 1, 1, 1, 0))
net_38:add(nn.ReLU(true))
local net_39 = nn.Sequential()
net_39:add(nn.SpatialConvolution(1024, 192, 1, 1, 1, 1))
net_39:add(nn.SpatialConvolution(1024, 192, 1, 1, 1, 1, 0))
net_39:add(nn.ReLU(true))
net_39:add(nn.SpatialConvolution(192, 320, 3, 3, 1, 1, 1, 1))
net_39:add(nn.ReLU(true))
local net_40 = nn.Sequential()
net_40:add(nn.SpatialConvolution(1024, 192, 1, 1, 1, 1))
net_40:add(nn.SpatialConvolution(1024, 192, 1, 1, 1, 1, 0))
net_40:add(nn.ReLU(true))
net_40:add(nn.SpatialConvolution(192, 224, 3, 3, 1, 1, 1, 1))
net_40:add(nn.ReLU(true))
@@ -316,8 +316,8 @@ net_40:add(nn.ReLU(true))
local net_41 = nn.Sequential()
net_41:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_41:add(nn.SpatialMaxPooling(3, 3, 1, 1))
net_41:add(nn.SpatialConvolution(1024, 128, 1, 1, 1, 1))
net_41:add(nn.SpatialMaxPooling(3, 3, 1, 1, 0, 0))
net_41:add(nn.SpatialConvolution(1024, 128, 1, 1, 1, 1, 0))
net_41:add(nn.ReLU(true))
local concat_171 = nn.Concat(2)
@@ -327,7 +327,7 @@ concat_171:add(net_39)
concat_171:add(net_38)
net_33:add(concat_171)
net_33:add(nn.SpatialAveragePooling(7, 7, 1, 1))
net_33:add(nn.SpatialAveragePooling(7, 7, 1, 1, 0, 0))
net_33:add(nn.View())
net_33:add(nn.Linear(1024, 4))
net_33:add(nn.LogSoftMax())
+6 -6
Ver Arquivo
@@ -1,19 +1,19 @@
require 'nn'
local net = nn.Sequential()
net:add(nn.SpatialConvolution(3, 96, 11, 11, 4, 4))
net:add(nn.SpatialConvolution(3, 96, 11, 11, 4, 4, 0))
net:add(nn.ReLU(true))
net:add(nn.SpatialMaxPooling(2, 2, 2, 2))
net:add(nn.SpatialConvolution(96, 256, 5, 5, 1, 1))
net:add(nn.SpatialMaxPooling(2, 2, 2, 2, 0, 0))
net:add(nn.SpatialConvolution(96, 256, 5, 5, 1, 1, 0))
net:add(nn.ReLU(true))
net:add(nn.SpatialMaxPooling(2, 2, 2, 2))
net:add(nn.SpatialMaxPooling(2, 2, 2, 2, 0, 0))
net:add(nn.SpatialConvolution(256, 512, 3, 3, 1, 1, 1, 1))
net:add(nn.ReLU(true))
net:add(nn.SpatialConvolution(512, 1024, 3, 3, 1, 1, 1, 1))
net:add(nn.ReLU(true))
net:add(nn.SpatialConvolution(1024, 1024, 3, 3, 1, 1, 1, 1))
net:add(nn.ReLU(true))
net:add(nn.SpatialMaxPooling(2, 2, 2, 2))
net:add(nn.SpatialMaxPooling(2, 2, 2, 2, 0, 0))
net:add(nn.View())
net:add(nn.Dropout(0.5))
net:add(nn.Linear(25600, 3072))
@@ -24,4 +24,4 @@ net:add(nn.Threshold(0, 0.000001))
net:add(nn.Linear(4096, 7))
net:add(nn.LogSoftMax())
return net
return net
+162 -172
Ver Arquivo
@@ -1,204 +1,194 @@
- type: View
id: /a/0
next:
- /a/y
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
sizes: 9216
- type: ReLU
id: /a/3
next:
- /a/u
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: Linear
id: /a/4o
next:
- /a/L
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
output: 4096
input: 9216
- type: SpatialConvolution
id: /a/9
id: /P/0
next:
- /a/z
- /P/2
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
strideHeight: 1
strideWidth: 1
kernelHeight: 5
kernelWidth: 5
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 384
nInputPlane: 192
- type: ReLU
id: /P/2
next:
- /P/fX
attributes:
p: true
- type: Dropout
id: /P/6
next:
- /P/C
attributes:
v1: ''
inplace: ''
p: 0.5
- type: Linear
id: /P/8p
next:
- /P/S8
attributes:
bias: ''
outputSize: 5
inputSize: 4096
- type: SpatialConvolution
id: /P/A
next:
- /P/j
attributes:
padH: 2
padW: 2
dH: 1
dW: 1
kH: 5
kW: 5
nOutputPlane: 192
nInputPlane: 64
- type: SpatialConvolution
id: /a/C
- type: Linear
id: /P/C
next:
- /a/J
- /P/mQ
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
strideHeight: 4
strideWidth: 4
kernelHeight: 11
kernelWidth: 11
bias: ''
outputSize: 4096
inputSize: 9216
- type: ReLU
id: /P/F
next:
- /P/R
attributes:
p: true
- type: Linear
id: /P/H
next:
- /P/e
attributes:
bias: ''
outputSize: 4096
inputSize: 4096
- type: SpatialMaxPooling
id: /P/J
next:
- /P/A
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 3
kW: 3
- type: Dropout
id: /P/L
next:
- /P/H
attributes:
v1: ''
inplace: ''
p: 0.5
- type: View
id: /P/M
next:
- /P/6
attributes:
numInputDims: null
params: 9216
- type: SpatialConvolution
id: /P/R
next:
- /P/i
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 256
nInputPlane: 256
- type: LogSoftMax
id: /P/S8
next: []
attributes: {}
- type: SpatialMaxPooling
id: /P/c
next:
- /P/0
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialConvolution
id: /P/d
next:
- /P/q
attributes:
padH: 2
padW: 2
dH: 4
dW: 4
kH: 11
kW: 11
nOutputPlane: 64
nInputPlane: 3
- type: LogSoftMax
id: /a/E0
next: []
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: ReLU
id: /a/J
id: /P/e
next:
- /a/j
- /P/8p
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: ReLU
id: /a/L
next:
- /a/l
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
p: ''
- type: SpatialConvolution
id: /a/U
id: /P/fX
next:
- /a/e
- /P/F
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
strideHeight: 1
strideWidth: 1
kernelHeight: 3
kernelWidth: 3
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 256
nInputPlane: 384
- type: ReLU
id: /a/X
id: /P/i
next:
- /a/U
- /P/n5
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
p: true
- type: ReLU
id: /a/e
id: /P/j
next:
- /a/q
- /P/c
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: SpatialMaxPooling
id: /a/h
next:
- /a/t
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
strideHeight: 2
strideWidth: 2
kernelHeight: 3
kernelWidth: 3
- type: SpatialMaxPooling
id: /a/j
next:
- /a/9
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
strideHeight: 2
strideWidth: 2
kernelHeight: 3
kernelWidth: 3
- type: Dropout
id: /a/l
next:
- /a/o
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
probability: 0.5
- type: Linear
id: /a/o
next:
- /a/r
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
output: 4096
input: 4096
- type: Linear
id: /a/p
next:
- /a/E0
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
output: 5
input: 4096
- type: SpatialConvolution
id: /a/q
next:
- /a/3
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
strideHeight: 1
strideWidth: 1
kernelHeight: 3
kernelWidth: 3
nOutputPlane: 256
nInputPlane: 256
p: true
- type: ReLU
id: /a/r
id: /P/mQ
next:
- /a/p
- /P/L
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: SpatialConvolution
id: /a/t
next:
- /a/X
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
strideHeight: 1
strideWidth: 1
kernelHeight: 3
kernelWidth: 3
nOutputPlane: 384
nInputPlane: 192
p: ''
- type: SpatialMaxPooling
id: /a/u
id: /P/n5
next:
- /a/0
- /P/M
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
strideHeight: 2
strideWidth: 2
kernelHeight: 3
kernelWidth: 3
- type: Dropout
id: /a/y
next:
- /a/4o
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
probability: 0.5
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 3
kW: 3
- type: ReLU
id: /a/z
id: /P/q
next:
- /a/h
- /P/J
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
p: true
+257
Ver Arquivo
@@ -0,0 +1,257 @@
- type: SpatialConvolution
id: /A/0
next:
- /A/w
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 384
nInputPlane: 192
- type: LogSoftMax
id: /A/2
next: []
attributes: {}
- type: ReLU
id: /A/3
next:
- /A/H
attributes:
p: ''
- type: ReLU
id: /A/6
next:
- /A/NJ
attributes:
p: true
- type: SpatialMaxPooling
id: /A/7
next:
- /A/G
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 3
kW: 3
- type: BatchNormalization
id: /A/A
next:
- /A/r7
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 4096
- type: BatchNormalization
id: /A/B
next:
- /A/3
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 4096
- type: ReLU
id: /A/F
next:
- /A/q
attributes:
p: true
- type: View
id: /A/G
next:
- /A/a
attributes:
numInputDims: null
params: 9216
- type: Dropout
id: /A/H
next:
- /A/i
attributes:
v1: ''
inplace: ''
p: 0.5
- type: SpatialBatchNormalization
id: /A/I
next:
- /A/t
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 192
- type: Linear
id: /A/M
next:
- /A/B
attributes:
bias: ''
outputSize: 4096
inputSize: 9216
- type: SpatialConvolution
id: /A/NJ
next:
- /A/PF
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 256
nInputPlane: 256
- type: SpatialBatchNormalization
id: /A/PF
next:
- /A/X
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 256
- type: ReLU
id: /A/X
next:
- /A/7
attributes:
p: true
- type: Dropout
id: /A/a
next:
- /A/M
attributes:
v1: ''
inplace: ''
p: 0.5
- type: ReLU
id: /A/d
next:
- /A/n
attributes:
p: true
- type: Linear
id: /A/h
next:
- /A/2
attributes:
bias: ''
outputSize: 10
inputSize: 4096
- type: Linear
id: /A/i
next:
- /A/A
attributes:
bias: ''
outputSize: 4096
inputSize: 4096
- type: SpatialBatchNormalization
id: /A/k
next:
- /A/6
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 256
- type: SpatialBatchNormalization
id: /A/l
next:
- /A/F
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 64
- type: SpatialConvolution
id: /A/n
next:
- /A/k
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 256
nInputPlane: 384
- type: SpatialMaxPooling
id: /A/nm
next:
- /A/0
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialMaxPooling
id: /A/q
next:
- /A/y
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialConvolution
id: /A/r
next:
- /A/l
attributes:
padH: 2
padW: 2
dH: 4
dW: 4
kH: 11
kW: 11
nOutputPlane: 64
nInputPlane: 3
- type: ReLU
id: /A/r7
next:
- /A/h
attributes:
p: ''
- type: ReLU
id: /A/t
next:
- /A/nm
attributes:
p: true
- type: SpatialBatchNormalization
id: /A/w
next:
- /A/d
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 384
- type: SpatialConvolution
id: /A/y
next:
- /A/I
attributes:
padH: 2
padW: 2
dH: 1
dW: 1
kH: 5
kW: 5
nOutputPlane: 192
nInputPlane: 64
+64 -48
Ver Arquivo
@@ -1,60 +1,76 @@
- type: Reshape
id: 0
id: /J/1
next:
- 2
- /J/5
attributes:
dimensions: 100
params: 100
- type: Linear
id: /J/5
next:
- /J/x
attributes:
bias: ''
outputSize: 300
inputSize: 100
- type: Sigmoid
id: /J/F
next:
- /J/z
attributes: {}
- type: ReLU
id: /J/G
next:
- /J/q
attributes:
p: ''
- type: SoftMax
id: 1
id: /J/Y
next: []
attributes: {}
- type: Linear
id: 2
next:
- 5
attributes:
output: 300
- type: ReLU
id: 3
next:
- 6
attributes: {}
- type: Sigmoid
id: 4
next:
- 7
attributes: {}
- type: RReLU
id: 5
next:
- 10
attributes: {}
- type: Linear
id: 6
next:
- 4
attributes:
output: 100
- type: Linear
id: 7
next:
- 8
attributes:
output: 120
- type: LeakyReLU
id: 8
id: /J/c
next:
- 9
attributes: {}
- type: Linear
id: 9
next:
- 1
- /J/m
attributes:
output: 5
negval: ''
ip: false
- type: Linear
id: 10
id: /J/d
next:
- 3
- /J/G
attributes:
output: 100
bias: ''
outputSize: 100
inputSize: 300
- type: Linear
id: /J/m
next:
- /J/Y
attributes:
bias: ''
outputSize: 5
inputSize: 120
- type: Linear
id: /J/q
next:
- /J/F
attributes:
bias: ''
outputSize: 100
inputSize: 100
- type: RReLU
id: /J/x
next:
- /J/d
attributes:
l: ''
u: ''
ip: false
- type: Linear
id: /J/z
next:
- /J/c
attributes:
bias: ''
outputSize: 120
inputSize: 100
+23 -16
Ver Arquivo
@@ -1,22 +1,29 @@
- type: Reshape
id: /x/3
next:
- /x/K
attributes:
params: 100
- type: Linear
id: 0
id: /x/K
next:
- /x/e
attributes:
bias: ''
outputSize: 300
inputSize: 100
- type: Linear
id: /x/N
next: []
attributes:
output: 10
- type: Linear
id: 1
next:
- 2
attributes:
output: 300
bias: ''
outputSize: 10
inputSize: 300
- type: HardTanh
id: 2
id: /x/e
next:
- 0
attributes: {}
- type: Reshape
id: 3
next:
- 1
- /x/N
attributes:
dimensions: 100
min_value: ''
max_value: 1
inplace: ''
+17 -13
Ver Arquivo
@@ -1,22 +1,26 @@
- type: Linear
id: 4
next:
- 7
attributes:
output: 300
- type: Reshape
id: 5
id: /Y/0
next:
- 4
- /Y/y
attributes:
dimensions: 100
params: 100
- type: Linear
id: 6
id: /Y/Z
next: []
attributes:
output: 10
bias: ''
outputSize: 10
inputSize: 300
- type: Tanh
id: 7
id: /Y/p
next:
- 6
- /Y/Z
attributes: {}
- type: Linear
id: /Y/y
next:
- /Y/p
attributes:
bias: ''
outputSize: 300
inputSize: 100
@@ -0,0 +1,77 @@
- type: Linear
id: /l/1
next:
- /l/s
attributes:
calculateDimensionality: function calcDims(layer) return layer.output; end
dimensionalityTransform: custom
output: 50
- type: Reshape
id: /l/8
next:
- /l/i
- /l/D
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
dimensions: 100
- type: Tanh
id: /l/9
next:
- /l/k
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: Linear
id: /l/D
next:
- /l/9
attributes:
calculateDimensionality: function calcDims(layer) return layer.output; end
dimensionalityTransform: custom
output: 150
- type: Tanh
id: /l/X
next:
- /l/a
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: Linear
id: /l/a
next: []
attributes:
calculateDimensionality: function calcDims(layer) return layer.output; end
dimensionalityTransform: custom
output: 7
- type: Tanh
id: /l/f
next:
- /l/1
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: Linear
id: /l/i
next:
- /l/f
attributes:
calculateDimensionality: function calcDims(layer) return layer.output; end
dimensionalityTransform: custom
output: 150
- type: Linear
id: /l/k
next:
- /l/s
attributes:
calculateDimensionality: function calcDims(layer) return layer.output; end
dimensionalityTransform: custom
output: 30
- type: Concat
id: /l/s
next:
- /l/X
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
dim: 1
+50 -48
Ver Arquivo
@@ -1,65 +1,67 @@
- type: Linear
id: /p/H
next:
- /p/V
attributes:
bias: ''
outputSize: 150
inputSize: 100
- type: Reshape
id: 1
attributes:
dimensions: 100
id: /p/L
next:
- 2
- 3
# Left side
- /p/M
- /p/H
attributes:
params: 100
- type: Linear
id: 2
attributes:
output: 150
id: /p/M
next:
- 4
- /p/P
attributes:
bias: ''
outputSize: 150
inputSize: 100
- type: Tanh
id: 4
id: /p/P
next:
- 6
- /p/W
attributes: {}
- type: Linear
id: 6
attributes:
output: 50
id: /p/R
next:
- 8
# Right side
- type: Linear
id: 3
- /p/n
attributes:
output: 150
next:
- 5
bias: ''
outputSize: 30
inputSize: 150
- type: Tanh
id: 5
id: /p/V
next:
- 7
- /p/R
attributes: {}
- type: Linear
id: 7
attributes:
output: 30
id: /p/W
next:
- 8
# Center
- /p/n
attributes:
bias: ''
outputSize: 50
inputSize: 150
- type: Linear
id: /p/Zj
next: []
attributes:
bias: ''
outputSize: 7
inputSize: 80
- type: Concat
id: 8
attributes:
dim: 1
id: /p/n
next:
- 9
- /p/w
attributes:
dimension: 1
- type: Tanh
id: 9
id: /p/w
next:
- 10
- type: Linear
id: 10
attributes:
output: 7
- /p/Zj
attributes: {}
+35 -27
Ver Arquivo
@@ -1,39 +1,47 @@
- type: Tanh
id: 8
next:
- 12
attributes: {}
- type: Tanh
id: 9
next:
- 14
attributes: {}
- type: Linear
id: 10
id: /u/1
next:
- 8
- /u/T
attributes:
output: 150
bias: ''
outputSize: 30
inputSize: 150
- type: Linear
id: /u/2
next:
- /u/M
attributes:
bias: ''
outputSize: 150
inputSize: 100
- type: Tanh
id: /u/G
next:
- /u/1
attributes: {}
- type: Tanh
id: /u/M
next:
- /u/k
attributes: {}
- type: Concat
id: 11
id: /u/T
next: []
attributes:
dim: 1
dimension: 1
- type: Linear
id: 12
id: /u/k
next:
- 11
- /u/T
attributes:
output: 50
bias: ''
outputSize: 50
inputSize: 150
- type: Linear
id: 13
id: /u/q
next:
- 9
- /u/G
attributes:
output: 150
- type: Linear
id: 14
next:
- 11
attributes:
output: 30
bias: ''
outputSize: 150
inputSize: 100
+68
Ver Arquivo
@@ -0,0 +1,68 @@
- type: Linear
id: /Z/1
next:
- /Z/E
attributes:
calculateDimensionality: function calcDims(layer) return layer.output; end
dimensionalityTransform: custom
output: 30
- type: Tanh
id: /Z/3
next:
- /Z/a
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: Linear
id: /Z/7
next:
- /Z/o
attributes:
calculateDimensionality: function calcDims(layer) return layer.output; end
dimensionalityTransform: custom
output: 150
- type: Concat
id: /Z/E
next:
- /Z/M
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
dim: 1
- type: Tanh
id: /Z/M
next:
- /Z/n
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: Linear
id: /Z/a
next:
- /Z/E
attributes:
calculateDimensionality: function calcDims(layer) return layer.output; end
dimensionalityTransform: custom
output: 50
- type: Linear
id: /Z/n
next: []
attributes:
calculateDimensionality: function calcDims(layer) return layer.output; end
dimensionalityTransform: custom
output: 7
- type: Tanh
id: /Z/o
next:
- /Z/1
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: Linear
id: /Z/t
next:
- /Z/3
attributes:
calculateDimensionality: function calcDims(layer) return layer.output; end
dimensionalityTransform: custom
output: 150
+49 -46
Ver Arquivo
@@ -1,57 +1,60 @@
# Left side
- type: Linear
id: 2
attributes:
output: 150
next:
- 4
- type: Tanh
id: 4
id: /t/5
next:
- 6
- type: Linear
id: 6
attributes:
output: 50
next:
- 8
# Right side
- type: Linear
id: 3
attributes:
output: 150
next:
- 5
- /t/H
attributes: {}
- type: Tanh
id: 5
id: /t/D
next:
- 7
- /t/b
attributes: {}
- type: Linear
id: 7
id: /t/H
next: []
attributes:
output: 30
bias: ''
outputSize: 7
inputSize: 80
- type: Linear
id: /t/I
next:
- 8
# Center
- /t/O
attributes:
bias: ''
outputSize: 30
inputSize: 150
- type: Linear
id: /t/M
next:
- /t/j
attributes:
bias: ''
outputSize: 150
inputSize: 100
- type: Concat
id: 8
id: /t/O
next:
- /t/5
attributes:
dim: 1
next:
- 9
- type: Tanh
id: 9
next:
- 10
dimension: 1
- type: Linear
id: 10
id: /t/b
next:
- /t/O
attributes:
output: 7
bias: ''
outputSize: 50
inputSize: 150
- type: Linear
id: /t/e
next:
- /t/D
attributes:
bias: ''
outputSize: 150
inputSize: 100
- type: Tanh
id: /t/j
next:
- /t/I
attributes: {}
+19 -15
Ver Arquivo
@@ -1,24 +1,28 @@
- type: Linear
id: 0
next:
- 1
attributes:
output: 3
- type: Concat
id: 1
id: /T/3
next: []
attributes:
dim: 1
dimension: 1
- type: Linear
id: 2
id: /T/G
next:
- 1
- /T/3
attributes:
output: 7
bias: ''
outputSize: 7
inputSize: 5
- type: Linear
id: /T/J
next:
- /T/3
attributes:
bias: ''
outputSize: 3
inputSize: 5
- type: Reshape
id: 3
id: /T/o
next:
- 2
- 0
- /T/G
- /T/J
attributes:
dimensions: 5
params: 5
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+94 -102
Ver Arquivo
@@ -1,117 +1,109 @@
- type: SpatialConvolution
id: /b/1
- type: LogSoftMax
id: /g/2
next: []
attributes: {}
- type: View
id: /g/5
next:
- /b/S
- /g/U
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
strideWidth: 1
strideHeight: 1
kernelHeight: 5
kernelWidth: 5
numInputDims: null
params: 400
- type: ReLU
id: /g/7
next:
- /g/O
attributes:
p: ''
- type: SpatialMaxPooling
id: /g/9
next:
- /g/X
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: Linear
id: /g/E
next:
- /g/2
attributes:
bias: ''
outputSize: 10
inputSize: 84
- type: ReLU
id: /g/H
next:
- /g/9
attributes:
p: ''
- type: Linear
id: /g/O
next:
- /g/g
attributes:
bias: ''
outputSize: 84
inputSize: 120
- type: Linear
id: /g/U
next:
- /g/7
attributes:
bias: ''
outputSize: 120
inputSize: 400
- type: SpatialMaxPooling
id: /g/W
next:
- /g/5
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialConvolution
id: /g/X
next:
- /g/m
attributes:
dW: ''
dH: ''
padW: 0
padH: ''
kH: 5
kW: 5
nOutputPlane: 16
nInputPlane: 6
- type: View
id: /b/BJ
next:
- /b/jr
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
sizes: 400
- type: SpatialMaxPooling
id: /b/E
next:
- /b/BJ
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
strideHeight: 2
strideWidth: 2
kernelHeight: 2
kernelWidth: 2
- type: SpatialMaxPooling
id: /b/G
next:
- /b/1
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
strideHeight: 2
strideWidth: 2
kernelHeight: 2
kernelWidth: 2
- type: ReLU
id: /b/O
id: /g/g
next:
- /b/G
- /g/E
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
p: ''
- type: ReLU
id: /b/S
id: /g/m
next:
- /b/E
- /g/W
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: Linear
id: /b/U
next:
- /b/y
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
output: 10
input: 84
- type: Linear
id: /b/W
next:
- /b/x
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
output: 84
input: 120
- type: ReLU
id: /b/b
next:
- /b/W
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: Linear
id: /b/jr
next:
- /b/b
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
output: 120
input: 400
p: ''
- type: SpatialConvolution
id: /b/r
id: /g/w
next:
- /b/O
- /g/H
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
strideWidth: 1
strideHeight: 1
kernelHeight: 5
kernelWidth: 5
dW: ''
dH: ''
padW: 0
padH: ''
kH: 5
kW: 5
nOutputPlane: 6
nInputPlane: 3
- type: ReLU
id: /b/x
next:
- /b/U
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
- type: LogSoftMax
id: /b/y
next: []
attributes:
calculateDimensionality: 'function calcDims(layer) return 1; --[[ return output dimensions --]] end'
dimensionalityTransform: same
+404
Ver Arquivo
@@ -0,0 +1,404 @@
- type: SpatialBatchNormalization
id: /k/0
next:
- /k/a
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 96
- type: ReLU
id: /k/1M
next:
- /k/W
attributes:
p: true
- type: SpatialConvolution
id: /k/3
next:
- /k/E
attributes:
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 384
nInputPlane: 384
- type: SpatialMaxPooling
id: /k/4
next:
- /k/x2
attributes:
ceil_mode: false
padH: 1
padW: 1
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialBatchNormalization
id: /k/5
next:
- /k/q
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 256
- type: SpatialBatchNormalization
id: /k/7
next:
- /k/K
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 256
- type: ReLU
id: /k/7R
next:
- /k/3
attributes:
p: true
- type: SpatialConvolution
id: /k/8h
next:
- /k/g
attributes:
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 1024
nInputPlane: 1024
- type: ReLU
id: /k/A
next:
- /k/J
attributes:
p: true
- type: SpatialConvolution
id: /k/D
next:
- /k/0
attributes:
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 96
nInputPlane: 96
- type: SpatialBatchNormalization
id: /k/E
next:
- /k/j
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 384
- type: LogSoftMax
id: /k/Em
next: []
attributes: {}
- type: SpatialConvolution
id: /k/G3
next:
- /k/t
attributes:
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 384
nInputPlane: 384
- type: SpatialConvolution
id: /k/HU
next:
- /k/5
attributes:
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 256
nInputPlane: 256
- type: SpatialBatchNormalization
id: /k/I
next:
- /k/7R
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 384
- type: SpatialMaxPooling
id: /k/J
next:
- /k/n
attributes:
ceil_mode: false
padH: 1
padW: 1
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialConvolution
id: /k/JG
next:
- /k/7
attributes:
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 256
nInputPlane: 256
- type: ReLU
id: /k/K
next:
- /k/HU
attributes:
p: true
- type: SpatialBatchNormalization
id: /k/MR
next:
- /k/1M
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 1024
- type: SpatialBatchNormalization
id: /k/P1
next:
- /k/k
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 256
- type: Linear
id: /k/S
next:
- /k/Em
attributes:
bias: ''
outputSize: 1000
inputSize: 1024
- type: ReLU
id: /k/TN
next:
- /k/8h
attributes:
p: true
- type: ReLU
id: /k/U
next:
- /k/qr
attributes:
p: true
- type: SpatialMaxPooling
id: /k/V
next:
- /k/b
attributes:
ceil_mode: false
padH: 1
padW: 1
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialAveragePooling
id: /k/W
next:
- /k/yv
attributes:
padW: 0
padH: 0
ceil_mode: false
count_include_pad: true
dH: 1
dW: 1
kH: 7
kW: 7
- type: ReLU
id: /k/a
next:
- /k/m
attributes:
p: true
- type: SpatialConvolution
id: /k/b
next:
- /k/I
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 384
nInputPlane: 256
- type: SpatialBatchNormalization
id: /k/g
next:
- /k/U
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 1024
- type: SpatialBatchNormalization
id: /k/h
next:
- /k/o
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 96
- type: ReLU
id: /k/iT
next:
- /k/4
attributes:
p: true
- type: ReLU
id: /k/j
next:
- /k/G3
attributes:
p: true
- type: ReLU
id: /k/k
next:
- /k/JG
attributes:
p: true
- type: SpatialConvolution
id: /k/m
next:
- /k/z
attributes:
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 96
nInputPlane: 96
- type: SpatialConvolution
id: /k/n
next:
- /k/P1
attributes:
padH: 2
padW: 2
dH: 1
dW: 1
kH: 5
kW: 5
nOutputPlane: 256
nInputPlane: 96
- type: ReLU
id: /k/o
next:
- /k/D
attributes:
p: true
- type: SpatialBatchNormalization
id: /k/p
next:
- /k/TN
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 1024
- type: ReLU
id: /k/q
next:
- /k/V
attributes:
p: true
- type: SpatialConvolution
id: /k/qr
next:
- /k/MR
attributes:
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 1024
nInputPlane: 1024
- type: SpatialBatchNormalization
id: /k/t
next:
- /k/iT
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 384
- type: SpatialConvolution
id: /k/v
next:
- /k/h
attributes:
padH: 5
padW: 5
dH: 4
dW: 4
kH: 11
kW: 11
nOutputPlane: 96
nInputPlane: 3
- type: SpatialConvolution
id: /k/x2
next:
- /k/p
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 1024
nInputPlane: 384
- type: View
id: /k/yv
next:
- /k/S
attributes:
params: -1
numInputDims: 3
- type: SpatialBatchNormalization
id: /k/z
next:
- /k/A
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 96
+198
Ver Arquivo
@@ -0,0 +1,198 @@
- type: Linear
id: /9/2
next:
- /9/U
attributes:
bias: ''
outputSize: 4096
inputSize: 3072
- type: SpatialMaxPooling
id: /9/3
next:
- /9/Ae
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialConvolution
id: /9/6
next:
- /9/p
attributes:
padW: 0
padH: ''
dH: 4
dW: 4
kH: 11
kW: 11
nOutputPlane: 96
nInputPlane: 3
- type: SpatialConvolution
id: /9/A
next:
- /9/P
attributes:
padW: 0
padH: ''
dH: 1
dW: 1
kH: 5
kW: 5
nOutputPlane: 256
nInputPlane: 96
- type: Linear
id: /9/AQ
next:
- /9/m
attributes:
bias: ''
outputSize: 7
inputSize: 4096
- type: View
id: /9/Ae
next:
- /9/V
attributes:
numInputDims: null
params: 25600
- type: ReLU
id: /9/F
next:
- /9/3
attributes:
p: true
- type: SpatialMaxPooling
id: /9/I
next:
- /9/A
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialMaxPooling
id: /9/J
next:
- /9/a
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialConvolution
id: /9/L
next:
- /9/z
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 1024
nInputPlane: 512
- type: ReLU
id: /9/P
next:
- /9/J
attributes:
p: true
- type: ReLU
id: /9/Q
next:
- /9/L
attributes:
p: true
- type: Linear
id: /9/T
next:
- /9/UZ
attributes:
bias: ''
outputSize: 3072
inputSize: 25600
- type: Threshold
id: /9/U
next:
- /9/AQ
attributes:
ip: ''
v: 0.000001
th: 0
- type: Threshold
id: /9/UZ
next:
- /9/zp
attributes:
ip: ''
v: 0.000001
th: 0
- type: Dropout
id: /9/V
next:
- /9/T
attributes:
v1: ''
inplace: ''
p: 0.5
- type: SpatialConvolution
id: /9/a
next:
- /9/Q
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 256
- type: SpatialConvolution
id: /9/l
next:
- /9/F
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 1024
nInputPlane: 1024
- type: LogSoftMax
id: /9/m
next: []
attributes: {}
- type: ReLU
id: /9/p
next:
- /9/I
attributes:
p: true
- type: ReLU
id: /9/z
next:
- /9/l
attributes:
p: true
- type: Dropout
id: /9/zp
next:
- /9/2
attributes:
v1: ''
inplace: ''
p: 0.5
+7 -5
Ver Arquivo
@@ -1,11 +1,13 @@
- type: Linear
id: 11
id: /3/O
next: []
attributes:
output: 10
bias: ''
outputSize: 10
inputSize: 100
- type: Reshape
id: 12
id: /3/g
next:
- 11
- /3/O
attributes:
dimensions: 100
params: 100
+229 -222
Ver Arquivo
@@ -1,100 +1,43 @@
- type: LogSoftMax
id: /Y/19
next: []
attributes: {}
- type: SpatialConvolution
id: /Y/3
next:
- /Y/hb
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 256
- type: SpatialConvolution
id: /Y/4
next:
- /Y/8
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 64
nInputPlane: 3
- type: SpatialMaxPooling
id: /Y/6
next:
- /Y/IL
attributes:
padW: ''
padH: ''
dH: 2
dW: 2
kH: 2
kW: 2
- type: ReLU
id: /Y/8
id: /2/4
next:
- /Y/l
- /2/i
attributes:
p: true
- type: SpatialMaxPooling
id: /Y/9
next:
- /Y/K
attributes:
padW: ''
padH: ''
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialConvolution
id: /Y/A
next:
- /Y/y
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 128
nInputPlane: 64
- type: Threshold
id: /Y/Cg
next:
- /Y/z
attributes:
ip: ''
v: 0.000001
th: 0
- type: Linear
id: /Y/D
id: /2/6
next:
- /Y/f4
- /2/X
attributes:
bias: ''
outputSize: 10
inputSize: 4096
- type: Linear
id: /2/7
next:
- /2/74
attributes:
bias: ''
outputSize: 4096
inputSize: 25088
- type: ReLU
id: /Y/EE
- type: Threshold
id: /2/74
next:
- /Y/v
- /2/Yu
attributes:
ip: ''
v: 0.000001
th: 0
- type: ReLU
id: /2/9
next:
- /2/m
attributes:
p: true
- type: SpatialConvolution
id: /Y/IL
id: /2/C
next:
- /Y/EE
- /2/mo
attributes:
padH: 1
padW: 1
@@ -104,10 +47,106 @@
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: SpatialConvolution
id: /Y/K
- type: ReLU
id: /2/D
next:
- /Y/m
- /2/k
attributes:
p: true
- type: Linear
id: /2/L
next:
- /2/j
attributes:
bias: ''
outputSize: 4096
inputSize: 4096
- type: ReLU
id: /2/M
next:
- /2/C
attributes:
p: true
- type: SpatialMaxPooling
id: /2/O
next:
- /2/u
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialConvolution
id: /2/P
next:
- /2/Z
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: Dropout
id: /2/U
next:
- /2/6
attributes:
v1: ''
inplace: ''
p: 0.5
- type: LogSoftMax
id: /2/X
next: []
attributes: {}
- type: Dropout
id: /2/Yu
next:
- /2/L
attributes:
v1: ''
inplace: ''
p: 0.5
- type: ReLU
id: /2/Z
next:
- /2/ti
attributes:
p: true
- type: View
id: /2/aW
next:
- /2/7
attributes:
numInputDims: null
params: 25088
- type: SpatialMaxPooling
id: /2/d
next:
- /2/q
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: ReLU
id: /2/e
next:
- /2/d
attributes:
p: true
- type: SpatialConvolution
id: /2/g
next:
- /2/4
attributes:
padH: 1
padW: 1
@@ -117,136 +156,10 @@
kW: 3
nOutputPlane: 256
nInputPlane: 128
- type: SpatialMaxPooling
id: /Y/M
next:
- /Y/a5
attributes:
padW: ''
padH: ''
dH: 2
dW: 2
kH: 2
kW: 2
- type: Linear
id: /Y/Q
next:
- /Y/19
attributes:
bias: ''
outputSize: 10
inputSize: 4096
- type: ReLU
id: /Y/R
next:
- /Y/M
attributes:
p: true
- type: ReLU
id: /Y/T
next:
- /Y/6
attributes:
p: true
- type: Dropout
id: /Y/U7
next:
- /Y/k
attributes:
v1: ''
inplace: ''
p: 0.5
- type: View
id: /Y/a5
next:
- /Y/D
attributes: {}
- type: Threshold
id: /Y/f4
next:
- /Y/U7
attributes:
ip: ''
v: 0.000001
th: 0
- type: ReLU
id: /Y/h
next:
- /Y/j
attributes:
p: true
- type: ReLU
id: /Y/hb
next:
- /Y/l4
attributes:
p: true
- type: SpatialMaxPooling
id: /Y/j
next:
- /Y/3
attributes:
padW: ''
padH: ''
dH: 2
dW: 2
kH: 2
kW: 2
- type: Linear
id: /Y/k
next:
- /Y/Cg
attributes:
bias: ''
outputSize: 4096
inputSize: 4096
- type: SpatialMaxPooling
id: /Y/l
next:
- /Y/A
attributes:
padW: ''
padH: ''
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialConvolution
id: /Y/l4
id: /2/i
next:
- /Y/T
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: ReLU
id: /Y/m
next:
- /Y/x
attributes:
p: true
- type: SpatialConvolution
id: /Y/v
next:
- /Y/R
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: SpatialConvolution
id: /Y/x
next:
- /Y/h
- /2/e
attributes:
padH: 1
padW: 1
@@ -256,17 +169,111 @@
kW: 3
nOutputPlane: 256
nInputPlane: 256
- type: ReLU
id: /Y/y
- type: Threshold
id: /2/j
next:
- /Y/9
- /2/U
attributes:
ip: ''
v: 0.000001
th: 0
- type: SpatialMaxPooling
id: /2/k
next:
- /2/z
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialMaxPooling
id: /2/m
next:
- /2/g
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: ReLU
id: /2/mo
next:
- /2/O
attributes:
p: true
- type: Dropout
id: /Y/z
- type: SpatialConvolution
id: /2/q
next:
- /Y/Q
- /2/M
attributes:
v1: ''
inplace: ''
p: 0.5
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 256
- type: ReLU
id: /2/s
next:
- /2/P
attributes:
p: true
- type: SpatialMaxPooling
id: /2/ti
next:
- /2/aW
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialConvolution
id: /2/u
next:
- /2/s
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: SpatialConvolution
id: /2/w
next:
- /2/D
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 64
nInputPlane: 3
- type: SpatialConvolution
id: /2/z
next:
- /2/9
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 128
nInputPlane: 64
+297
Ver Arquivo
@@ -0,0 +1,297 @@
- type: Linear
id: /S/1
next:
- /S/s
attributes:
bias: ''
outputSize: 4096
inputSize: 4096
- type: SpatialMaxPooling
id: /S/4
next:
- /S/fu
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: ReLU
id: /S/7
next:
- /S/f
attributes:
p: true
- type: Dropout
id: /S/A
next:
- /S/Pt
attributes:
v1: ''
inplace: ''
p: 0.5
- type: View
id: /S/B
next:
- /S/WQ
attributes:
numInputDims: null
params: 25088
- type: ReLU
id: /S/C
next:
- /S/w
attributes:
p: true
- type: Threshold
id: /S/Ee
next:
- /S/i
attributes:
ip: ''
v: 0.000001
th: 0
- type: SpatialMaxPooling
id: /S/H
next:
- /S/b
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: LogSoftMax
id: /S/Iz
next: []
attributes: {}
- type: SpatialMaxPooling
id: /S/M
next:
- /S/X
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: BatchNormalization
id: /S/MT
next:
- /S/A
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 4096
- type: ReLU
id: /S/P
next:
- /S/cJ
attributes:
p: true
- type: ReLU
id: /S/PX
next:
- /S/Z
attributes:
p: true
- type: Linear
id: /S/Pt
next:
- /S/Iz
attributes:
bias: ''
outputSize: 1000
inputSize: 4096
- type: SpatialConvolution
id: /S/R
next:
- /S/T
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 128
nInputPlane: 64
- type: ReLU
id: /S/T
next:
- /S/M
attributes:
p: true
- type: Linear
id: /S/WQ
next:
- /S/Ee
attributes:
bias: ''
outputSize: 4096
inputSize: 25088
- type: SpatialConvolution
id: /S/X
next:
- /S/7
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 256
nInputPlane: 128
- type: ReLU
id: /S/Y
next:
- /S/t
attributes:
p: true
- type: SpatialConvolution
id: /S/Z
next:
- /S/Y
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: SpatialConvolution
id: /S/b
next:
- /S/P
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 256
- type: SpatialConvolution
id: /S/cJ
next:
- /S/e
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: ReLU
id: /S/e
next:
- /S/4
attributes:
p: true
- type: SpatialConvolution
id: /S/f
next:
- /S/y
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 256
nInputPlane: 256
- type: SpatialConvolution
id: /S/fu
next:
- /S/PX
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: Dropout
id: /S/hr
next:
- /S/1
attributes:
v1: ''
inplace: ''
p: 0.5
- type: BatchNormalization
id: /S/i
next:
- /S/hr
attributes:
momentum: ''
affine: ''
eps: 0.001
nOutput: 4096
- type: Threshold
id: /S/s
next:
- /S/MT
attributes:
ip: ''
v: 0.000001
th: 0
- type: SpatialMaxPooling
id: /S/t
next:
- /S/B
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialMaxPooling
id: /S/w
next:
- /S/R
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialConvolution
id: /S/x
next:
- /S/C
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 64
nInputPlane: 3
- type: ReLU
id: /S/y
next:
- /S/H
attributes:
p: true
+5 -5
Ver Arquivo
@@ -106,8 +106,8 @@ describe('utils', function () {
describe('matching architectures', function() {
var cases = [
['/l', 'concat-parallel'],
['/Z', 'concat-y'],
['/l', 'concat-parallel-utils'],
['/Z', 'concat-y-utils'],
['/y', 'concat-y-bad-conn'] // disconnected graph
];
@@ -117,9 +117,9 @@ describe('utils', function () {
describe('mismatching architectures', function() {
var cases = [
['/l', 'concat-y'],
['/y', 'concat-parallel'],
['/s', 'concat-y']
['/l', 'concat-y-utils'],
['/y', 'concat-parallel-utils'],
['/s', 'concat-y-utils']
];
cases.forEach(pair => it('should NOT validate ' + pair[1],
+26 -59
Ver Arquivo
@@ -1,60 +1,28 @@
var fs = require('fs');
var path = require('path');
var parser = require('../src/common/lua').parser;
var torchPath = process.env.HOME + '/torch/extra/nn/';
var SKIP_LAYERS = {};
var skipLayerList = require('./skipLayers.json');
var fs = require('fs'),
path = require('path'),
torchPath,
LayerParser = require(__dirname + '/../src/common/LayerParser'),
SKIP_LAYERS = {},
skipLayerList = require('./skipLayers.json'),
categories = require('./categories.json'),
catNames = Object.keys(categories),
exists = require('exists-file'),
configDir = process.env.HOME + '/.deepforge/',
configPath = configDir + 'config.json',
layerToCategory = {},
config;
// Check the deepforge config
torchPath = process.env.HOME + '/torch';
if (exists.sync(configPath)) {
config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
torchPath = (config.torch && config.torch.dir) || (configDir + 'torch');
}
torchPath += '/extra/nn/';
skipLayerList.forEach(name => SKIP_LAYERS[name] = true);
var findInitParams = function(ast){
// Find '__init' function
var params;
ast.block.stats.forEach(function(block){
if(block.key && block.key.val == '__init' && block.func){
params = block.func.args;
if(params.length === 0 && block.func.varargs){
params[0] = 'params';
}
}
});
return params;
};
var findTorchClass = function(ast){
var torchClassArgs, // args for `torch.class(...)`
name = '',
baseType,
params = [];
if(ast.type == 'function'){
ast.block.stats.forEach(function(func){
if(func.type == 'stat.local' && func.right && func.right[0] &&
func.right[0].func && func.right[0].func.self &&
func.right[0].func.self.val == 'torch' &&
func.right[0].func.key.val == 'class'){
torchClassArgs = func.right[0].args.map(arg => arg.val);
name = torchClassArgs[0];
if(name !== ''){
name = name.replace('nn.', '');
params = findInitParams(ast);
if (torchClassArgs.length > 1) {
baseType = torchClassArgs[1].replace('nn.', '');
}
}
}
});
}
return {
name,
baseType,
params
};
};
var categories = require('./categories.json');
var catNames = Object.keys(categories);
var layerToCategory = {};
catNames.forEach(cat => // create layer -> category dictionary
categories[cat].forEach(lname => layerToCategory[lname] = cat)
);
@@ -72,15 +40,14 @@ fs.readdir(torchPath, function(err,files){
layerByName = {};
layers = files.filter(filename => path.extname(filename) === '.lua')
//.filter(filename => filename === 'SpatialAveragePooling.lua')
.map(filename => fs.readFileSync(torchPath + filename, 'utf8'))
.map(code => parser.parse(code))
.map(ast => findTorchClass(ast)) // create initial layers
.map(code => LayerParser.parse(code))
.filter(layer => !!layer && layer.name);
layers.forEach(layer => {
layer.type = lookupType(layer.name);
layerByName[layer.name] = layer;
layer.setters = [];
});
// handle inheritance