Added generic container support. Fixes #476 (#891)

* WIP #476 Update 'Container' category and added 'addLayers' set

* WIP #476 Added ContainerLayerDecorator

* WIP #476 Embedded arch editor in decorator

* WIP #476 Shrink the nested layers. Hide on condense

* WIP #476 Fixed positioning of nested layers

* WIP #476 Added background click handling

* WIP #476 alternate colors w/ nested containers

* WIP #476 Fixed nesting viz and layer prompt

* WIP #476 Refactored nested layers

* WIP #476 Added box on hover for nested layers

* WIP #476 Fixed the nested layer hover box position/size

* WIP #476 added button event handling

* WIP #476 Some nested layer creation support

* WIP #476 Fixed nested layer deletion

* WIP #476 prompt layer on first creation

* WIP #476 Fixed horizontal positioning of nested layers

* WIP #476 Fixed nested layer removal

* WIP #476 Fixed reordering nested layers

* WIP #476 Added basic button styling

* WIP #476 Added hint text

* WIP #476 nested layer delete icon

* WIP #476 Fixed hover and added first button

* WIP #476 Fixed the position of the nested layers (w/ attrs)

* WIP #476 more position adjustments

* WIP #476 Fixed add nested layer not updating

* WIP #476 Load nested children eagerly

* WIP #476 Minor aesthetic tweaks

* WIP #476 Fixed attribute field editing (width messing up)

* WIP #476 Added support for container code generation

* WIP #476 Added generic container support to importer

* WIP #476 Moved Concat to 'Simple'

Concat is only implicitly a container in deepforge (the contained
nodes are inferred by the graph structure rather than physically
nested w/in the node)

* WIP #476 Fixed minor code climate issues

* WIP Protected against null id on project unload

* WIP #476 Fixed 'push' of undefined bug in import tests

* WIP #476 Updated tests

* WIP #476 Only reset attr field size if attribute changed

* WIP #476 re-open error fixed

* WIP #476 update territory on creation

* WIP #476 Updated the nested editor height calculation

* WIP #476 Added resnet import example
Esse commit está contido em:
Brian Broll
2016-11-15 18:54:26 -06:00
commit de GitHub
commit 964ebc9714
30 arquivos alterados com 2181 adições e 866 exclusões
+4
Ver Arquivo
@@ -11,6 +11,9 @@
}
}(this, function() {
return {
CONTAINED_LAYER_SET: 'addLayers',
CONTAINED_LAYER_INDEX: 'index',
LINE_OFFSET: 'lineOffset',
// DeepForge metadata creation in dist execution
@@ -37,6 +40,7 @@
OUTPUT: 'Output'
},
// Heartbeat constants (ExecPulse router)
PULSE: {
DEAD: 0,
ALIVE: 1,
+2 -2
Ver Arquivo
@@ -46,7 +46,7 @@ define([
minValue;
nodes = this.graph.nodes().map(id => this.graph.node(id));
minValue = Math.min.apply(null, nodes.map(node => node[dim]));
minValue = nodes.length ? Math.min.apply(null, nodes.map(node => node[dim] || 0)) : 0;
return maxValue-minValue;
};
@@ -55,7 +55,7 @@ define([
};
ThumbnailWidget.prototype.getSvgHeight = function() {
return this.getSvgDistanceDim('y');
return this.height - 25;
};
ThumbnailWidget.prototype.getViewBox = function() {
@@ -0,0 +1,39 @@
/*globals define, _*/
/*jshint browser: true, camelcase: false*/
define([
'js/Decorators/DecoratorBase',
'./EasyDAG/ContainerLayerDecorator.EasyDAGWidget'
], function (
DecoratorBase,
ContainerLayerDecoratorEasyDAGWidget
) {
'use strict';
var ContainerLayerDecorator,
__parent__ = DecoratorBase,
__parent_proto__ = DecoratorBase.prototype,
DECORATOR_ID = 'ContainerLayerDecorator';
ContainerLayerDecorator = function (params) {
var opts = _.extend({loggerName: this.DECORATORID}, params);
__parent__.apply(this, [opts]);
this.logger.debug('ContainerLayerDecorator ctor');
};
_.extend(ContainerLayerDecorator.prototype, __parent_proto__);
ContainerLayerDecorator.prototype.DECORATORID = DECORATOR_ID;
/*********************** OVERRIDE DecoratorBase MEMBERS **************************/
ContainerLayerDecorator.prototype.initializeSupportedWidgetMap = function () {
this.supportedWidgetMap = {
EasyDAG: ContainerLayerDecoratorEasyDAGWidget
};
};
return ContainerLayerDecorator;
});
@@ -0,0 +1,25 @@
.condense .nested-layers {
display: none;
}
.nested-layers .hover-box {
stroke: black;
stroke-dasharray: 4, 4;
stroke-opacity: 0;
}
.nested-layers .unhovered .button {
opacity: 0;
}
.nested-layers .hovered .button {
opacity: 1;
}
.nested-layers .unhovered .hover-box {
stroke-opacity: 0;
}
.nested-layers .hovered .hover-box {
stroke-opacity: 0;
}
@@ -0,0 +1,414 @@
/*globals define, _, */
/*jshint browser: true, camelcase: false*/
define([
'decorators/LayerDecorator/EasyDAG/LayerDecorator.EasyDAGWidget',
'js/Constants',
'deepforge/Constants',
'./NestedLayer',
'widgets/EasyDAG/Buttons',
'css!./ContainerLayerDecorator.EasyDAGWidget.css'
], function (
LayerDecorator,
GME_CONSTANTS,
CONSTANTS,
NestedLayer,
Buttons
) {
'use strict';
var ContainerLayerDecorator,
ZOOM = 0.8,
DECORATOR_ID = 'ContainerLayerDecorator';
// Container layer nodes need to be able to nest the containedLayers
// in order inside of themselves when expanded
ContainerLayerDecorator = function (options) {
this.nestedLayers = {};
LayerDecorator.call(this, options);
this.$nested = this.$el.append('g')
.attr('class', 'nested-layers');
// If clicked, deselect the given nested layer
this.$el.on('click', () => {
if (this.expanded) {
Object.keys(this.nestedLayers).forEach(id => {
this.nestedLayers[id].widget.onBackgroundClick();
});
}
});
this.onNestedRefresh = _.debounce(this.updateExpand.bind(this), 50);
// Add event handlers
NestedLayer.prototype.addLayerBefore = function(layerId) {
var decorator = this._parent,
index = decorator._node.containedLayers.indexOf(this.id);
return decorator.addLayerAt(layerId, index - 1);
};
NestedLayer.prototype.addLayerAfter = function(layerId) {
var decorator = this._parent,
index = decorator._node.containedLayers.indexOf(this.id);
return decorator.addLayerAt(layerId, index + 1);
};
NestedLayer.prototype.isLast = function() {
var index = this._parent._node.containedLayers.length - 1;
return this._parent._node.containedLayers[index] === this.id;
};
NestedLayer.prototype.isFirst = function() {
return this._parent._node.containedLayers[0] === this.id;
};
NestedLayer.prototype.moveLayerForward = function() {
return this.moveLayer(true);
};
NestedLayer.prototype.moveLayerBackward = function() {
return this.moveLayer();
};
NestedLayer.prototype.moveLayer = function(forward) {
var decorator = this._parent,
index = decorator._node.containedLayers.indexOf(this.id),
client = decorator.client,
msg;
decorator._node.containedLayers.splice(index, 1);
if (forward) {
index = Math.max(0, index - 1);
} else {
index++;
}
decorator._node.containedLayers.splice(index, 0, this.id);
msg = `Swapping nested layers at ${index} and ${forward ? index-1 : index+1}`;
client.startTransaction(msg);
decorator._updateNestedIndices();
client.completeTransaction();
};
NestedLayer.prototype.onLastNodeRemoved = function() {
var decorator = this._parent,
index = decorator._node.containedLayers.indexOf(this.id),
msg = `Removing nested layer of ${decorator._node.name} at position ${index}`;
decorator.client.startTransaction(msg);
decorator.client.deleteNode(this.id);
decorator.client.completeTransaction();
};
this.updateNestedTerritory();
};
_.extend(ContainerLayerDecorator.prototype, LayerDecorator.prototype);
ContainerLayerDecorator.prototype.DECORATOR_ID = DECORATOR_ID;
ContainerLayerDecorator.prototype._updateNestedIndices = function() {
this._node.containedLayers.forEach((layerId, index) => {
// Set the layer's member registry to it's index
this.client.setMemberRegistry(
this._node.id,
layerId,
CONSTANTS.CONTAINED_LAYER_SET,
CONSTANTS.CONTAINED_LAYER_INDEX,
index
);
});
};
ContainerLayerDecorator.prototype.addLayerAt = function(baseId, index) {
var client = this.client,
parentId = this._node.id,
archNode,
newId,
msg;
// Get the index of the given layer
index = Math.max(index, 0);
archNode = client.getAllMetaNodes()
.find(node => node.getAttribute('name') === 'Architecture');
// Create a new Architecture node in the given node
msg = `Adding layer to ${this._node.name} at position ${index}`;
client.startTransaction(msg);
newId = client.createNode({
parentId: parentId,
baseId: archNode.getId()
});
// Create the selected layer
client.createNode({
parentId: newId,
baseId: baseId
});
client.addMember(parentId, newId, CONSTANTS.CONTAINED_LAYER_SET);
this._node.containedLayers.splice(index, 0, newId);
this._updateNestedIndices();
client.completeTransaction();
};
ContainerLayerDecorator.prototype.condense = function() {
// hide the nested layers
this.$el.attr('class', 'centering-offset condense');
this.removeCreateNestedBtn();
return LayerDecorator.prototype.condense.apply(this, arguments);
};
ContainerLayerDecorator.prototype.updateNestedTerritory = function() {
// Add the nested layers and update
if (!this._nestedTerritoryUI) {
this._nestedTerritoryUI = this.client.addUI(this, this._containedEvents.bind(this));
}
this._territory = {};
this._node.containedLayers.forEach(id => this._territory[id] = {children: 0});
this.client.updateTerritory(this._nestedTerritoryUI, this._territory);
};
ContainerLayerDecorator.prototype._containedEvents = function(events) {
for (var i = events.length; i--;) {
switch (events[i].etype) {
case GME_CONSTANTS.TERRITORY_EVENT_LOAD:
if (!this.nestedLayers[events[i].eid]) {
this.createNestedWidget(events[i].eid);
}
break;
case GME_CONSTANTS.TERRITORY_EVENT_UNLOAD:
this.removeNestedWidget(events[i].eid);
break;
}
}
if (events.length > 1) { // if more than just 'complete' event
this.updateExpand();
}
};
ContainerLayerDecorator.prototype.update = function(node) {
var attrsUpdated = false,
attrs = this._attributes;
this._node = node;
// Update the attributes
this.setAttributes();
attrsUpdated = !_.isEqual(attrs, this._attributes);
// Check for a new nested layer
var hasNewLayers = this._node.containedLayers
.filter(id => !this.nestedLayers[id])
.length > 0;
if (hasNewLayers) {
this.updateNestedTerritory();
} else {
// Update the order of the nested layers
if (this._selected) {
this.expand();
} else {
this.condense();
}
}
// Only reset fieldsWidth if the attribute has gotten larger
if (attrsUpdated) {
this.fieldsWidth = null;
}
};
ContainerLayerDecorator.prototype.updateExpand = function() {
if (this.expanded) {
this.expand();
}
};
ContainerLayerDecorator.prototype.createNestedWidget = function(id) {
if (!this.$nested) {
this.$nested = this.$el.append('g')
.attr('class', 'nested-layers');
}
this.nestedLayers[id] = new NestedLayer({
$container: this.$nested,
parent: this,
client: this.client,
logger: this.logger,
onRefresh: this.onNestedRefresh,
id: id
});
return this.nestedLayers[id];
};
ContainerLayerDecorator.prototype.removeNestedWidget = function(id) {
this.nestedLayers[id].destroy();
delete this.nestedLayers[id];
this.updateExpand();
};
ContainerLayerDecorator.prototype._renderInfo = function(top, width) {
var isAnUpdate = this.expanded,
y = top;
// Add the attribute fields
this.clearFields();
this.$attributes = this.$el.append('g')
.attr('fill', '#222222');
if (!isAnUpdate) {
this.$attributes.attr('opacity', 0);
}
y = this.createAttributeFields(y, width);
y = this.createPointerFields(y, width);
if (y !== top) {
y += this.ROW_HEIGHT/2;
}
return y;
};
ContainerLayerDecorator.prototype.expand = function() {
// This should be rendered with the attributes
var height,
width,
// Attributes
initialY = 25,
isAnUpdate = this.expanded,
NAME_MARGIN = 15,
nestedMargin = 15, // minimum
margin = 5,
y = margin + initialY,
x = margin,
i;
// Shift name down
this.$name.attr('y', 20);
// Add the nested children
var ids = this._node.containedLayers.filter(id => this.nestedLayers[id]),
totalNestedWidth = 0,
maxNestedHeight = 0,
fieldWidth,
widget;
if (ids.length === 0) {
maxNestedHeight = CreateNestedBtn.SIZE * 2;
} else {
for (i = 0; i < ids.length; i++) {
widget = this.nestedLayers[ids[i]].widget;
totalNestedWidth += widget.getSvgWidth() * ZOOM;
maxNestedHeight = Math.max(widget.getSvgHeight() * ZOOM, maxNestedHeight);
// Update the buttons (in case of reorder)
this.nestedLayers[ids[i]].refreshButtons();
}
}
fieldWidth = this.fieldsWidth + 3 * NAME_MARGIN;
width = Math.max(
this.nameWidth + 2 * NAME_MARGIN,
this.size.width,
fieldWidth,
totalNestedWidth + (ids.length + 1) * nestedMargin
);
// Render attributes
y = this._renderInfo(y, fieldWidth);
y += nestedMargin;
// Update width, height
height = y + maxNestedHeight + nestedMargin;
// Equally space the nested widgets
nestedMargin = (width - totalNestedWidth)/(ids.length + 1);
x = nestedMargin - width/2;
for (i = 0; i < ids.length; i++) {
this.nestedLayers[ids[i]].$el
.attr('transform', `translate(${x}, ${y}) scale(${ZOOM})`);
x += this.nestedLayers[ids[i]].widget.getSvgWidth() * ZOOM + nestedMargin;
}
this.removeCreateNestedBtn();
if (ids.length === 0) {
// Add the 'create nested layer' button if no nested layers
this.$createNestedBtn = new CreateNestedBtn({
context: this,
$pEl: this.$el,
y: y + CreateNestedBtn.SIZE
});
}
this.$body
.transition()
.attr('x', -width/2)
.attr('y', 0)
.attr('rx', 0)
.attr('ry', 0)
.attr('width', width)
.attr('height', height)
.each('end', () => {
if (!isAnUpdate) {
this.$attributes.attr('opacity', 1);
this.$el.attr('class', 'centering-offset expand');
}
});
if (this.height !== height || this.width !== width) {
this.height = height;
this.width = width;
this.expanded = true;
this.$el
.attr('transform', `translate(${this.width/2}, 0)`);
this.onResize();
}
};
ContainerLayerDecorator.prototype.removeCreateNestedBtn = function() {
if (this.$createNestedBtn) {
this.$createNestedBtn.remove();
this.$createNestedBtn = null;
}
};
ContainerLayerDecorator.prototype.destroyNested = function() {
Object.keys(this.nestedLayers).forEach(id => this.nestedLayers[id].destroy());
this.nestedLayers = {};
if (this.$nested) {
this.$nested.remove();
this.$nested = this.$el.append('g')
.attr('class', 'nested-layers');
}
};
ContainerLayerDecorator.prototype.destroy = function() {
LayerDecorator.prototype.destroy.call(this);
if (this._nestedTerritoryUI) {
this.client.removeUI(this._nestedTerritoryUI);
this._nestedTerritoryUI = null;
}
this.destroyNested();
};
var CreateNestedBtn = function(params) {
params.title = 'Add nested layer';
Buttons.Add.call(this, params);
};
CreateNestedBtn.SIZE = Buttons.Add.SIZE;
CreateNestedBtn.prototype = Object.create(Buttons.Add.prototype);
CreateNestedBtn.prototype._onClick = function() {
// Call addLayerAfter and prompt for a layer
this.promptLayer()
.then(layerId => this.addLayerAt(layerId, 0));
};
return ContainerLayerDecorator;
});
@@ -0,0 +1,175 @@
/*globals define, _ */
define([
'panels/ArchEditor/ArchEditorControl',
'widgets/ArchEditor/ArchEditorWidget',
'widgets/EasyDAG/Buttons'
], function(
ArchEditor,
ArchEditorWidget,
Buttons
) {
var nop = () => {};
var NestedLayer = function(opts) {
this.$el = opts.$container.append('g')
.attr('class', 'nested-layer');
this.id = opts.id;
this._parent = opts.parent;
this.logger = opts.logger;
this.refreshButtons = _.debounce(this.updateButtons.bind(this), 100);
this.$outline = this.$el.append('rect') // for hover detection
.attr('fill-opacity', 0)
.attr('x', 0)
.attr('y', 0);
this.$content = this.$el.append('g');
this.initHover();
this.widget = new ArchEditorWidget({
logger: this.logger.fork('ArchWidget'),
autoCenter: false,
svg: this.$content
});
this.widget.setTitle =
this.widget.updateEmptyMsg = nop;
this.onRefresh = opts.onRefresh;
this.widget.refreshExtras = this.onWidgetRefresh.bind(this);
this.control = new ArchEditor({
logger: this.logger.fork('ArchControl'),
client: opts.client,
embedded: true,
widget: this.widget
});
this.control._onUnload = () => {
ArchEditor.prototype._onUnload.apply(this.control, arguments);
// If it was the last node, remove it
var node = this.control._client.getNode(this.id);
if (node.getChildrenIds().length === 0) {
this.onLastNodeRemoved();
}
};
// hack :(
this.control.$btnModelHierarchyUp = {
show: nop,
hide: nop
};
this.widget.active = true;
this.control.selectedObjectChanged(this.id);
};
NestedLayer.prototype.initHover = function() {
this.$hover = this.$el.append('g')
.attr('class', 'hover-items');
this.$el.on('mouseenter', this.onHover.bind(this));
this.$el.on('mouseleave', this.onUnhover.bind(this));
// Buttons
this.$leftBtn = new Buttons.Add({
hide: true,
icon: this.isFirst() ? 'plus' : 'chevron-left',
$pEl: this.$hover
});
this.$rightBtn = new Buttons.Add({
hide: true,
icon: this.isLast() ? 'plus' : 'chevron-right',
$pEl: this.$hover
});
this.$deleteBtn = new Buttons.DeleteOne({
hide: true,
title: 'Delete',
$pEl: this.$hover
});
this.$leftBtn._onClick = this.clickLeft.bind(this);
this.$rightBtn._onClick = this.clickRight.bind(this);
this.$deleteBtn._onClick = () => this.onLastNodeRemoved();
this.$leftHint = this.$leftBtn.$el.append('title');
this.$rightHint = this.$rightBtn.$el.append('title');
this.refreshButtons();
};
NestedLayer.prototype.updateButtons = function() {
this.$leftBtn.icon = this.isFirst() ? 'plus' : 'chevron-left';
this.$rightBtn.icon = this.isLast() ? 'plus' : 'chevron-right';
this.$leftHint.text(this.isFirst() ?
'Add nested layer' :
'Move nested layer left'
);
this.$rightHint.text(this.isLast() ?
'Add nested layer' :
'Move nested layer right'
);
this.$leftBtn.render();
this.$rightBtn.render();
};
NestedLayer.prototype.clickLeft = function() {
if (this.isFirst()) {
this.promptLayer()
.then(layerId => this.addLayerBefore(layerId));
} else {
this.moveLayerForward();
}
this.onUnhover();
};
NestedLayer.prototype.promptLayer = function() {
var nodes = this.widget.getValidInitialNodes();
return this.widget.promptLayer(nodes)
.then(selected => selected.node.id);
};
NestedLayer.prototype.clickRight = function() {
if (this.isLast()) {
this.promptLayer()
.then(layerId => this.addLayerAfter(layerId));
} else {
this.moveLayerBackward();
}
this.onUnhover();
};
NestedLayer.prototype.onHover = function() {
this.refreshButtons();
this.$hover.attr('class', 'hover-items hovered');
};
NestedLayer.prototype.onUnhover = function() {
this.$hover.attr('class', 'hover-items unhovered');
};
NestedLayer.prototype.onWidgetRefresh = function() {
var width = this.widget.getSvgWidth(),
height = this.widget.getSvgHeight();
this.$outline
.attr('width', width)
.attr('height', height);
this.$leftBtn.$el.attr('transform', `translate(0, ${height/2})`);
this.$rightBtn.$el
.attr('transform', `translate(${width}, ${height/2})`);
this.onRefresh();
};
NestedLayer.prototype.destroy = function() {
this.control.destroy();
this.widget.destroy();
this.$el.remove();
};
return NestedLayer;
});
+6 -6
Ver Arquivo
@@ -105,7 +105,7 @@
"defaults": {
"nInputDim": 2
},
"type": "Misc"
"type": "Container"
},
{
"name": "CAdd",
@@ -229,7 +229,7 @@
"setters": {},
"types": {},
"defaults": {},
"type": "Containers"
"type": "Simple"
},
{
"name": "ConcatTable",
@@ -238,7 +238,7 @@
"setters": {},
"types": {},
"defaults": {},
"type": "Misc"
"type": "Container"
},
{
"name": "Contiguous",
@@ -924,7 +924,7 @@
"setters": {},
"types": {},
"defaults": {},
"type": "Misc"
"type": "Container"
},
{
"name": "ParallelCriterion",
@@ -944,7 +944,7 @@
"setters": {},
"types": {},
"defaults": {},
"type": "Misc"
"type": "Container"
},
{
"name": "PartialLinear",
@@ -2149,4 +2149,4 @@
"defaults": {},
"type": "Criterion"
}
]
]
@@ -6,13 +6,15 @@ define([
'SimpleNodes/Constants',
'deepforge/layer-args',
'deepforge/utils',
'deepforge/Constants',
'underscore',
'text!./metadata.json'
], function (
PluginBase,
Constants,
SimpleNodeConstants,
createLayerDict,
utils,
Constants,
_,
metadata
) {
@@ -65,7 +67,7 @@ define([
};
GenerateArchitecture.prototype.createOutputFiles = function (tree) {
var layers = tree[Constants.CHILDREN],
var layers = tree[SimpleNodeConstants.CHILDREN],
result = {},
code = '';
@@ -125,12 +127,57 @@ define([
};
GenerateArchitecture.prototype.createLayer = function (layer) {
var args = this.createArgString(layer);
return `nn.${layer.name}${args}`;
var args = this.createArgString(layer),
def = `nn.${layer.name}${args}`,
type = layer.base.base.name,
addedIds,
node,
name,
children,
id;
// Check if it is a container and has the 'addLayers' set
// If so, it should sort them by their registry 'index' and add
// each nested architecture's code to the given container
if (type === 'Container') {
// Get the members of the 'addLayers' set
addedIds = {};
id = layer[SimpleNodeConstants.NODE_PATH];
node = this._nodeCache[id];
this.core.getMemberPaths(node, Constants.CONTAINED_LAYER_SET)
.forEach(id => addedIds[id] = true);
// Get the (sorted) children
children = layer[SimpleNodeConstants.CHILDREN]
.map(child => { // get (child, index) tuples
var index;
id = child[SimpleNodeConstants.NODE_PATH];
index = this.core.getMemberRegistry(node, Constants.CONTAINED_LAYER_SET, id, Constants.CONTAINED_LAYER_INDEX);
return [child, index];
})
.filter(pair => pair[1] !== undefined) // remove non-members
.sort((a, b) => a[1] < b[1] ? -1 : 1) // sort by 'index'
.map(pair => pair[0]);
var addedLayerDefs = '',
firstLayer;
for (var i = 0; i < children.length; i++) {
id = children[i][SimpleNodeConstants.NODE_PATH];
// Get the children!
firstLayer = children[i][SimpleNodeConstants.CHILDREN][0];
name = this.getVarName(utils.abbr(layer.name + '_' + i));
addedLayerDefs += this.createSequential(firstLayer, name).code;
def += `:add(${name})`;
}
this.hoist(addedLayerDefs);
}
return def;
};
GenerateArchitecture.prototype.createSequential = function (layer, name) {
var next = layer[Constants.NEXT][0],
var next = layer[SimpleNodeConstants.NEXT][0],
args,
snippet,
snippets,
@@ -142,7 +189,7 @@ define([
while (layer) {
// if there is only one successor, just add the given layer
if (layer[Constants.PREV].length > 1) { // sequential layers are over
if (layer[SimpleNodeConstants.PREV].length > 1) { // sequential layers are over
next = layer; // the given layer will be added by the caller
break;
} else { // add the given layer
@@ -151,11 +198,11 @@ define([
}
while (layer && layer[Constants.NEXT].length > 1) { // concat/parallel
while (layer && layer[SimpleNodeConstants.NEXT].length > 1) { // concat/parallel
// if there is a fork, recurse and add a concat layer
this.logger.debug(`detected fork of size ${layer[Constants.NEXT].length}`);
snippets = layer[Constants.NEXT].map(nlayer =>
this.logger.debug(`detected fork of size ${layer[SimpleNodeConstants.NEXT].length}`);
snippets = layer[SimpleNodeConstants.NEXT].map(nlayer =>
this.createSequential(nlayer, this.getVarName('net')));
code += '\n' + snippets.map(snippet => snippet.code).join('\n');
@@ -183,7 +230,7 @@ define([
`concat_${layer[INDEX]}:add(${snippet.name})`)
.join('\n') + `\n\n${name}:add(concat_${layer[INDEX]})`;
next = layer[Constants.NEXT][0];
next = layer[SimpleNodeConstants.NEXT][0];
} else {
next = null; // no next layers
}
@@ -203,7 +250,7 @@ define([
}
layer = next;
next = layer && layer[Constants.NEXT][0];
next = layer && layer[SimpleNodeConstants.NEXT][0];
}
return {
@@ -218,14 +265,14 @@ define([
var content = layer[arg];
if (typeof content === 'object') { // layer as arg
if (content[Constants.CHILDREN].length) {
if (content[SimpleNodeConstants.CHILDREN].length) {
// Generate the code for the children of layer[arg]
var name = this.getVarName(utils.abbr(arg)),
layers;
this.logger.debug(`Adding layer arg for ${arg} (${layer.name})`);
try {
layers = this.genRawArchCode(layer[arg][Constants.CHILDREN], name);
layers = this.genRawArchCode(layer[arg][SimpleNodeConstants.CHILDREN], name);
} catch (e) {
this.logger.error(`Layer arg creation failed: ${e}`);
return null;
@@ -244,7 +291,7 @@ define([
GenerateArchitecture.prototype.createArgString = function (layer) {
var setters = this.LayerDict[layer.name].setters,
setterNames = Object.keys(this.LayerDict[layer.name].setters),
base = layer[Constants.BASE],
base = layer[SimpleNodeConstants.BASE],
desc,
fn,
layerCode,
+119 -17
Ver Arquivo
@@ -3,10 +3,12 @@
define([
'deepforge/layer-args',
'common/util/assert',
'deepforge/Constants',
'deepforge/lua'
], function(
createLayerDict,
assert,
Constants,
lua
) {
'use strict';
@@ -93,6 +95,7 @@ define([
connsFrom[id] = [];
}
connsFrom[id].push(conn, dst);
return conn;
};
// nn drawing library
@@ -194,56 +197,131 @@ define([
return self;
};
// Each container will have `inputs` and `outputs`
Layer.prototype._getAllNodes = function() {
return [this._node()];
};
var Container = function() {
Layer.apply(this, arguments);
this._nestedIndex = 0;
};
Container.prototype = Object.create(Layer.prototype);
Container.prototype.add = function(self, tlayer) {
var layer = tlayer.get('_node'),
container = this._node(),
children,
arch;
// Add a nested 'Architecture' node
arch = core.createNode({
parent: container,
base: META.Architecture
});
// Add this node to the 'addLayers' set
core.addMember(container, Constants.CONTAINED_LAYER_SET, arch);
// Assign it an appropriate 'index' value
core.setMemberRegistry(
container,
Constants.CONTAINED_LAYER_SET,
core.getPath(arch),
Constants.CONTAINED_LAYER_INDEX,
this._nestedIndex++
);
// Move the added node(s)/conns to this architecture node
children = layer._getAllNodes();
for (var i = children.length; i--;) {
core.moveNode(children[i], arch);
}
layer._parent = arch;
return self;
};
// Implicit Containers are sequential and concat containers;
// these containers are visually implied in deepforge (although
// they are explicitly defined in torch)
var ImplicitContainer = function() {
// inputs and outputs are webgme nodes
this._inputs = [];
this._outputs = [];
this._children = [];
this._connections = [];
};
Container.prototype.add = function() {
// Implicit containers will have to record their 'children'.
// When an implicit container is added to an actual container,
// the container will set it's '_parent' value. If any additional
// layers are added to the implicit container after, they will
// need to be moved to the parent of the implicit container
ImplicitContainer.prototype.add = function() {
logger.error('Add is not overridden!');
};
var Sequential = function(/*attrs, args*/) {
Container.call(this);
ImplicitContainer.prototype._getAllNodes = function() {
var nodes = this._children.map(layer => layer._getAllNodes())
.reduce((l1, l2) => l1.concat(l2), []);
return this._connections.concat(nodes);
};
Sequential.prototype = new Container();
var Sequential = function(/*attrs, args*/) {
ImplicitContainer.call(this);
};
Sequential.prototype = new ImplicitContainer();
Sequential.prototype.add = function(self, tlayer) {
var layer = tlayer.get('_node'),
nodes = layer._inputs;
nodes = layer._inputs,
connections = [];
// If this._inputs is empty, add the layer to the inputs list
if (this._inputs.length === 0) { // first node
this._inputs = this._inputs.concat(nodes);
} else {
// connect all inputs of the added node to the current outputs
// add the connection to the list of allNodes
this._outputs.forEach(src =>
nodes.forEach(dst => connect(src, dst))
nodes.forEach(dst => connections.push(connect(src, dst)))
);
}
this._outputs = layer._outputs;
this._children.push(layer);
this._connections = this._connections.concat(connections);
// If _parent is set, move the nodes and connection to the _parent node
if (this._parent) {
nodes = layer._getAllNodes().concat(connections);
for (var i = nodes.length; i--;) {
core.moveNode(nodes[i], this._parent);
}
}
return self;
};
var Concat = function(attrs, args) {
Container.call(this);
ImplicitContainer.call(this);
// Create a concat node and add it to this._outputs
var concat = new Layer('Concat', attrs, args);
this._outputs.push(concat._node());
this._children.push(concat);
};
Concat.prototype = new Container();
Concat.prototype = new ImplicitContainer();
Concat.prototype.add = function(self, tlayer) {
// Connect the tlayer outputs to this._outputs
var layer = tlayer.get('_node'),
concatLayer = this._outputs[0];
concatLayer = this._outputs[0],
connections = [],
nodes;
layer._outputs.forEach(output => connect(output, concatLayer));
layer._outputs.forEach(output =>
connections.push(connect(output, concatLayer)));
// Connect the incomingly connected node to tlayer
// TODO: This might not work if adding layers after this container is
@@ -251,14 +329,23 @@ define([
// Add the layer's inputs to the inputs
this._inputs = this._inputs.concat(layer._inputs);
this._children.push(layer);
this._connections = this._connections.concat(connections);
if (this._parent) {
nodes = layer._getAllNodes().concat(connections);
for (var i = nodes.length; i--;) {
core.moveNode(nodes[i], this._parent);
}
}
return self;
};
// Special layers (with special functions - like 'add')
var LAYERS = {
Concat: Concat,
Sequential: Sequential
};
var CONTAINERS,
LAYERS = {
Concat: Concat,
Sequential: Sequential
};
var getValue = function(txt) {
if (txt === 'true') {
@@ -311,6 +398,9 @@ define([
if (LAYERS[type]) {
node = new LAYERS[type](args, attrs);
} else if (CONTAINERS[type]) {
node = new Container(type, args, attrs);
res.set('add', node.add.bind(node)); // add the 'add' method
} else { // Call generic Layer with type name
node = new Layer(type, args, attrs);
}
@@ -352,11 +442,23 @@ define([
return;
}
// TODO: Create the nn object
// Mocking the nn layers (as defined in the metamodel)
var nn = lua.newContext()._G,
names = Object.keys(LayerDict);
names = Object.keys(LayerDict),
base,
baseName;
// For each layer, check the name of the base type. If it is 'Container',
// then it should be added to the CONTAINERS dictionary. This will change how
// it is handled in 'CreateLayer'
CONTAINERS = {};
for (var i = names.length; i--;) {
base = core.getBase(META[names[i]]);
baseName = core.getAttribute(base, 'name');
if (baseName === 'Container') {
CONTAINERS[names[i]] = true;
}
nn.set(names[i], CreateLayer.bind(null, names[i]));
}
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
+1 -1
Ver Arquivo
@@ -1 +1 @@
0.4.0
0.5.0
Arquivo binário não exibido.
@@ -21,10 +21,11 @@ define([
var ArchEditorControl,
DEFAULT_CONFIG = {
DefaultColor: '#ffb74d',
DefaultColor: '#80cbc4',
LayerColors: {
Containers: '#ffb74d',
Convolution: '#2196f3',
Container: '#ffb74d',
NestedContainer: '#ffe0b2',
Convolution: '#42a5f5',
Simple: '#ff9100',
Transfer: '#80deea',
Misc: '#ce93d8'
@@ -46,6 +47,8 @@ define([
};
ArchEditorControl.prototype.selectedObjectChanged = function(id) {
this.nestedLevel = typeof id === 'string' ?
Math.floor(id.split('/').length/2) % 2 : 0;
ThumbnailControl.prototype.selectedObjectChanged.call(this, id);
DeepForge.last.Architecture = id;
@@ -97,11 +100,32 @@ define([
desc.layerType = layerType.getAttribute(nodePropertyNames.Attributes.name);
color = this._config.LayerColors[desc.layerType];
if (desc.layerType === 'Container' && this.nestedLevel) {
color = this._config.LayerColors.NestedContainer;
}
if (!color) {
this._logger.warn(`No color found for ${desc.layerType}`);
color = this._config.DefaultColor;
}
desc.color = color;
if (desc.layerType === 'Container') {
desc.containedLayers = node.getMemberIds(Constants.CONTAINED_LAYER_SET)
.map(layerId => {
var index = node.getMemberRegistry(
Constants.CONTAINED_LAYER_SET,
layerId,
Constants.CONTAINED_LAYER_INDEX
);
return [layerId, index];
})
.sort((a, b) => a[1] < b[1] ? -1 : 1)
.map(tuple => tuple[0]);
// Set the decorator to ContainerLayerDecorator
desc.Decorator = this._client.decoratorManager
.getDecoratorForWidget('ContainerLayerDecorator', 'EasyDAG');
}
}
}
}
@@ -31,13 +31,14 @@ define([
'Transfer',
'Convolution',
'RNN',
'Containers',
'Container',
'Misc'
];
ArchEditorWidget = function (logger, container) {
ThumbnailWidget.call(this, logger, container);
this.$el.addClass(WIDGET_CLASS);
ArchEditorWidget = function () {
ThumbnailWidget.apply(this, arguments);
var clazz = this.$el.attr('class');
this.$el.attr('class', clazz + ' ' + WIDGET_CLASS);
this._emptyMsg = 'Click to add a new layer';
};
@@ -47,15 +48,24 @@ define([
ArchEditorWidget.prototype.SelectionManager = SelectionManager;
ArchEditorWidget.prototype.setupItemCallbacks = function() {
var widget = this;
ThumbnailWidget.prototype.setupItemCallbacks.apply(this, arguments);
// Add the hover button functions
this.ItemClass.prototype.showHoverButtons = function() {
var layer = this;
widget.showHoverButtons(layer);
this._widget.showHoverButtons(layer);
};
this.ItemClass.prototype.hideHoverButtons = function() {
this._widget.hideHoverButtons();
};
this.ItemClass.prototype.isHoverAllowed = function() {
return !this._widget.isConnecting();
};
this.ItemClass.prototype.promptInitialLayer = function() {
var nodes = this._widget.getValidInitialNodes();
return this._widget.promptLayer(nodes)
.then(selected => selected.node.id);
};
this.ItemClass.prototype.hideHoverButtons = this.hideHoverButtons.bind(this);
this.ItemClass.prototype.isHoverAllowed = () => !this.isConnecting();
};
ArchEditorWidget.prototype.showHoverButtons = function(layer) {
@@ -186,5 +196,11 @@ define([
};
};
ArchEditorWidget.prototype.updateNode = function(desc) {
var item = this.items[desc.id];
item.update(desc);
this.refreshUI();
};
return ArchEditorWidget;
});
@@ -25,6 +25,7 @@ define([
node: desc,
parentEl: this.$el
});
this.decorator.promptLayer = this.promptInitialLayer.bind(this);
this.width = this.decorator.width;
this.height = this.decorator.height;
@@ -89,6 +89,7 @@ describe('GenerateArchitecture', function () {
//['/o', 'basic.lua'],
//['/8', 'basic-transfers.lua'],
//['/M', 'concat-parallel.lua'],
['/Q', 'basiccontainer.lua'],
['/4', 'requiredOmitted.lua'],
['/e', 'googlenet.lua'],
['/X', 'overfeat.lua']
+16
Ver Arquivo
@@ -0,0 +1,16 @@
require 'nn'
require 'rnn'
local P0 = nn.Sequential()
P0:add(nn.View(2,5,10):setNumInputDims(20))
local P1 = nn.Sequential()
P1:add(nn.Linear(50, 200))
P1:add(nn.ReLU())
P1:add(nn.Linear(100, 210))
local net = nn.Sequential()
net:add(nn.Linear(100, 200))
net:add(nn.Parallel(100, 200):add(P0):add(P1))
net:add(nn.Sqrt(3))
return net
+213
Ver Arquivo
@@ -0,0 +1,213 @@
--
-- Copyright (c) 2016, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.
--
-- The ResNet model definition
--
local nn = require 'nn'
require 'cunn'
local Convolution = nn.SpatialConvolution
local Avg = nn.SpatialAveragePooling
local ReLU = nn.ReLU
local Max = nn.SpatialMaxPooling
local SBatchNorm = nn.SpatialBatchNormalization
local function createModel(opt)
local depth = opt.depth
local shortcutType = opt.shortcutType or 'B'
local iChannels
-- The shortcut layer is either identity or 1x1 convolution
local function shortcut(nInputPlane, nOutputPlane, stride)
local useConv = shortcutType == 'C' or
(shortcutType == 'B' and nInputPlane ~= nOutputPlane)
if useConv then
-- 1x1 convolution
return nn.Sequential()
:add(Convolution(nInputPlane, nOutputPlane, 1, 1, stride, stride))
:add(SBatchNorm(nOutputPlane))
elseif nInputPlane ~= nOutputPlane then
-- Strided, zero-padded identity shortcut
return nn.Sequential()
:add(nn.SpatialAveragePooling(1, 1, stride, stride))
:add(nn.Concat(2)
:add(nn.Identity())
:add(nn.MulConstant(0)))
else
return nn.Identity()
end
end
-- The basic residual layer block for 18 and 34 layer network, and the
-- CIFAR networks
local function basicblock(n, stride)
local nInputPlane = iChannels
iChannels = n
local s = nn.Sequential()
s:add(Convolution(nInputPlane,n,3,3,stride,stride,1,1))
s:add(SBatchNorm(n))
s:add(ReLU(true))
s:add(Convolution(n,n,3,3,1,1,1,1))
s:add(SBatchNorm(n))
return nn.Sequential()
:add(nn.ConcatTable()
:add(s)
:add(shortcut(nInputPlane, n, stride)))
:add(nn.CAddTable(true))
:add(ReLU(true))
end
-- The bottleneck residual layer for 50, 101, and 152 layer networks
local function bottleneck(n, stride)
local nInputPlane = iChannels
iChannels = n * 4
local s = nn.Sequential()
s:add(Convolution(nInputPlane,n,1,1,1,1,0,0))
s:add(SBatchNorm(n))
s:add(ReLU(true))
s:add(Convolution(n,n,3,3,stride,stride,1,1))
s:add(SBatchNorm(n))
s:add(ReLU(true))
s:add(Convolution(n,n*4,1,1,1,1,0,0))
s:add(SBatchNorm(n * 4))
return nn.Sequential()
:add(nn.ConcatTable()
:add(s)
:add(shortcut(nInputPlane, n * 4, stride)))
:add(nn.CAddTable(true))
:add(ReLU(true))
end
-- Creates count residual blocks with specified number of features
local function layer(block, features, count, stride)
local s = nn.Sequential()
for i=1,count do
s:add(block(features, i == 1 and stride or 1))
end
return s
end
local model = nn.Sequential()
if opt.dataset == 'imagenet' then
-- Configurations for ResNet:
-- num. residual blocks, num features, residual block function
local cfg = {
[18] = {{2, 2, 2, 2}, 512, basicblock},
[34] = {{3, 4, 6, 3}, 512, basicblock},
[50] = {{3, 4, 6, 3}, 2048, bottleneck},
[101] = {{3, 4, 23, 3}, 2048, bottleneck},
[152] = {{3, 8, 36, 3}, 2048, bottleneck},
}
assert(cfg[depth], 'Invalid depth: ' .. tostring(depth))
local def, nFeatures, block = table.unpack(cfg[depth])
iChannels = 64
print(' | ResNet-' .. depth .. ' ImageNet')
-- The ResNet ImageNet model
model:add(Convolution(3,64,7,7,2,2,3,3))
model:add(SBatchNorm(64))
model:add(ReLU(true))
model:add(Max(3,3,2,2,1,1))
model:add(layer(block, 64, def[1]))
model:add(layer(block, 128, def[2], 2))
model:add(layer(block, 256, def[3], 2))
model:add(layer(block, 512, def[4], 2))
model:add(Avg(7, 7, 1, 1))
model:add(nn.View(nFeatures):setNumInputDims(3))
model:add(nn.Linear(nFeatures, 1000))
elseif opt.dataset == 'cifar10' then
-- Model type specifies number of layers for CIFAR-10 model
assert((depth - 2) % 6 == 0, 'depth should be one of 20, 32, 44, 56, 110, 1202')
local n = (depth - 2) / 6
iChannels = 16
print(' | ResNet-' .. depth .. ' CIFAR-10')
-- The ResNet CIFAR-10 model
model:add(Convolution(3,16,3,3,1,1,1,1))
model:add(SBatchNorm(16))
model:add(ReLU(true))
model:add(layer(basicblock, 16, n))
model:add(layer(basicblock, 32, n, 2))
model:add(layer(basicblock, 64, n, 2))
model:add(Avg(8, 8, 1, 1))
model:add(nn.View(64):setNumInputDims(3))
model:add(nn.Linear(64, 10))
elseif opt.dataset == 'cifar100' then
-- Model type specifies number of layers for CIFAR-100 model
assert((depth - 2) % 6 == 0, 'depth should be one of 20, 32, 44, 56, 110, 1202')
local n = (depth - 2) / 6
iChannels = 16
print(' | ResNet-' .. depth .. ' CIFAR-100')
-- The ResNet CIFAR-100 model
model:add(Convolution(3,16,3,3,1,1,1,1))
model:add(SBatchNorm(16))
model:add(ReLU(true))
model:add(layer(basicblock, 16, n))
model:add(layer(basicblock, 32, n, 2))
model:add(layer(basicblock, 64, n, 2))
model:add(Avg(8, 8, 1, 1))
model:add(nn.View(64):setNumInputDims(3))
model:add(nn.Linear(64, 100))
else
error('invalid dataset: ' .. opt.dataset)
end
-- The following initialization code has been
-- commented out for importing into deepforge
--
--local function ConvInit(name)
--for k,v in pairs(model:findModules(name)) do
--local n = v.kW*v.kH*v.nOutputPlane
--v.weight:normal(0,math.sqrt(2/n))
--if nn.version >= 4000 then
--v.bias = nil
--v.gradBias = nil
--else
--v.bias:zero()
--end
--end
--end
--local function BNInit(name)
--for k,v in pairs(model:findModules(name)) do
--v.weight:fill(1)
--v.bias:zero()
--end
--end
--ConvInit('nn.SpatialConvolution')
--ConvInit('nn.SpatialConvolution')
--BNInit('fbnn.SpatialBatchNormalization')
--BNInit('nn.SpatialBatchNormalization')
--BNInit('nn.SpatialBatchNormalization')
----for k,v in pairs(model:findModules('nn.Linear')) do
--v.bias:zero()
--end
--model:cuda()
--if opt.nn == 'deterministic' then
--model:apply(function(m)
--if m.setMode then m:setMode(1,1,1) end
--end)
--end
--model:get(1).gradInput = nil
return model
end
return createModel({
dataset = 'imagenet',
depth = 18
});
@@ -0,0 +1,16 @@
require 'nn'
require 'rnn'
local P0 = nn.Sequential()
P0:add(nn.View(2,5,10):setNumInputDims(20))
local P1 = nn.Sequential()
P1:add(nn.Linear(50, 200))
P1:add(nn.ReLU())
P1:add(nn.Linear(100, 210))
local net = nn.Sequential()
net:add(nn.Linear(100, 200))
net:add(nn.Parallel(100, 200):add(P0):add(P1))
net:add(nn.Sqrt(3))
return net
+187 -199
Ver Arquivo
@@ -1,32 +1,67 @@
- type: ReLU
id: /V/1
- type: SpatialMaxPooling
id: /Z/0
next:
- /V/M
- /Z/E
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 3
kW: 3
- type: ReLU
id: /Z/6
next:
- /Z/A
attributes:
p: ''
ctor_arg_order: p
- type: ReLU
id: /Z/9
next:
- /Z/0
attributes:
ctor_arg_order: p
p: true
- type: Linear
id: /V/29
next:
- /V/s
- type: LogSoftMax
id: /Z/L
next: []
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 10
inputSize: 4096
- type: Dropout
id: /V/3
ctor_arg_order: ''
- type: SpatialConvolution
id: /Z/l
next:
- /V/Q
- /Z/i
attributes:
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace'
p: 0.5
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 2
padW: 2
dH: 4
dW: 4
kH: 11
kW: 11
nOutputPlane: 64
nInputPlane: 3
- type: SpatialBatchNormalization
id: /Z/i
next:
- /Z/H
attributes:
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 64
- type: ReLU
id: /Z/H
next:
- /Z/J
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /V/4
id: /Z/J
next:
- /V/o
- /Z/y
attributes:
padW: ''
padH: ''
@@ -36,9 +71,50 @@
kH: 3
kW: 3
- type: SpatialConvolution
id: /V/6
id: /Z/y
next:
- /V/Z
- /Z/j
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 2
padW: 2
dH: 1
dW: 1
kH: 5
kW: 5
nOutputPlane: 192
nInputPlane: 64
- type: SpatialBatchNormalization
id: /Z/j
next:
- /Z/T
attributes:
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 192
- type: ReLU
id: /Z/T
next:
- /Z/V
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /Z/V
next:
- /Z/z
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialConvolution
id: /Z/z
next:
- /Z/W
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
@@ -50,64 +126,24 @@
nOutputPlane: 384
nInputPlane: 192
- type: SpatialBatchNormalization
id: /V/8
id: /Z/W
next:
- /V/R
- /Z/u
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 64
nOutput: 384
- type: ReLU
id: /V/F
id: /Z/u
next:
- /V/a
- /Z/g
attributes:
ctor_arg_order: p
p: true
- type: SpatialBatchNormalization
id: /V/G
next:
- /V/O
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 192
- type: ReLU
id: /V/H
next:
- /V/N
attributes:
ctor_arg_order: p
p: true
- type: Dropout
id: /V/Im
next:
- /V/iP
attributes:
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace'
p: 0.5
- type: SpatialMaxPooling
id: /V/M
next:
- /V/xK
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialConvolution
id: /V/N
id: /Z/g
next:
- /V/g
- /Z/N
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
@@ -118,67 +154,25 @@
kW: 3
nOutputPlane: 256
nInputPlane: 384
- type: ReLU
id: /V/O
next:
- /V/k
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /V/P
next:
- /V/8
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 2
padW: 2
dH: 4
dW: 4
kH: 11
kW: 11
nOutputPlane: 64
nInputPlane: 3
- type: Linear
id: /V/Q
next:
- /V/Qm
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 4096
- type: BatchNormalization
id: /V/Qm
next:
- /V/t7
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 4096
- type: ReLU
id: /V/R
next:
- /V/4
attributes:
ctor_arg_order: p
p: true
- type: SpatialBatchNormalization
id: /V/Z
id: /Z/N
next:
- /V/H
- /Z/I
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 384
- type: SpatialConvolution
id: /V/a
nOutput: 256
- type: ReLU
id: /Z/I
next:
- /V/z
- /Z/ki
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /Z/ki
next:
- /Z/x
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
@@ -189,94 +183,88 @@
kW: 3
nOutputPlane: 256
nInputPlane: 256
- type: BatchNormalization
id: /V/b
next:
- /V/t
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 4096
- type: SpatialBatchNormalization
id: /V/g
id: /Z/x
next:
- /V/F
- /Z/9
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 256
- type: Linear
id: /V/iP
- type: View
id: /Z/E
next:
- /V/b
- /Z/s
attributes:
ctor_arg_order: params
params: 9216
- type: Dropout
id: /Z/s
next:
- /Z/r
attributes:
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace,stochasticInference'
p: 0.5
- type: Linear
id: /Z/r
next:
- /Z/Rx
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 9216
- type: SpatialMaxPooling
id: /V/k
- type: BatchNormalization
id: /Z/Rx
next:
- /V/6
- /Z/S
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialConvolution
id: /V/o
next:
- /V/G
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 2
padW: 2
dH: 1
dW: 1
kH: 5
kW: 5
nOutputPlane: 192
nInputPlane: 64
- type: LogSoftMax
id: /V/s
next: []
attributes:
ctor_arg_order: ''
- type: ReLU
id: /V/t
next:
- /V/3
attributes:
p: ''
ctor_arg_order: p
- type: ReLU
id: /V/t7
next:
- /V/29
attributes:
p: ''
ctor_arg_order: p
- type: View
id: /V/xK
next:
- /V/Im
attributes:
ctor_arg_order: params
params: 9216
- type: SpatialBatchNormalization
id: /V/z
next:
- /V/1
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
momentum: 0.1
eps: 0.001
nOutput: 256
nOutput: 4096
- type: ReLU
id: /Z/S
next:
- /Z/D
attributes:
p: ''
ctor_arg_order: p
- type: Dropout
id: /Z/D
next:
- /Z/oM
attributes:
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace,stochasticInference'
p: 0.5
- type: Linear
id: /Z/oM
next:
- /Z/q
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 4096
- type: BatchNormalization
id: /Z/q
next:
- /Z/6
attributes:
ctor_arg_order: 'nOutput,eps,momentum,affine'
momentum: 0.1
eps: 0.001
nOutput: 4096
- type: Linear
id: /Z/A
next:
- /Z/L
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 10
inputSize: 4096
+23
Ver Arquivo
@@ -0,0 +1,23 @@
- type: Sqrt
id: /Q/0
next: []
attributes:
ctor_arg_order: b
b: 3
- type: Linear
id: /Q/V
next:
- /Q/K
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
inputSize: 100
outputSize: 200
- type: Parallel
id: /Q/K
next:
- /Q/0
attributes:
ctor_arg_order: 'inputDimension,outputDimension'
inputDimension: 100
outputDimension: 200
+296 -320
Ver Arquivo
@@ -1,7 +1,55 @@
- type: SpatialConvolution
id: /J/1
id: /G/5
next:
- /J/G
- /G/x
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 256
nInputPlane: 256
- type: ReLU
id: /G/8
next:
- /G/U
attributes:
ctor_arg_order: p
p: true
- type: SpatialBatchNormalization
id: /G/9
next:
- /G/T
attributes:
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 1024
- type: SpatialConvolution
id: /G/56
next:
- /G/9
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 1024
nInputPlane: 384
- type: LogSoftMax
id: /G/rn
next: []
attributes:
ctor_arg_order: ''
- type: SpatialConvolution
id: /G/y
next:
- /G/r
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 5
@@ -12,182 +60,25 @@
kW: 11
nOutputPlane: 96
nInputPlane: 3
- type: ReLU
id: /J/1n
next:
- /J/o
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /J/4l
next:
- /J/xm
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 1024
nInputPlane: 1024
- type: SpatialConvolution
id: /J/5
next:
- /J/St
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 1024
nInputPlane: 1024
- type: SpatialBatchNormalization
id: /J/6
id: /G/r
next:
- /J/d
- /G/d
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 96
- type: SpatialMaxPooling
id: /J/8
next:
- /J/g
attributes:
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 2
dW: 2
kH: 3
kW: 3
- type: Linear
id: /J/8r
next:
- /J/jq
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 1000
inputSize: 1024
- type: SpatialBatchNormalization
id: /J/95
next:
- /J/u
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 256
- type: ReLU
id: /J/D
next:
- /J/p
attributes:
ctor_arg_order: p
p: true
- type: SpatialBatchNormalization
id: /J/E
next:
- /J/X
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 96
- type: SpatialBatchNormalization
id: /J/F
next:
- /J/qt
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 384
- type: SpatialBatchNormalization
id: /J/G
next:
- /J/s
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 96
- type: ReLU
id: /J/KE
id: /G/d
next:
- /J/5
attributes:
ctor_arg_order: p
p: true
- type: ReLU
id: /J/N
next:
- /J/c
attributes:
ctor_arg_order: p
p: true
- type: ReLU
id: /J/O
next:
- /J/Z
- /G/L
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /J/P
id: /G/L
next:
- /J/e
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 256
nInputPlane: 256
- type: SpatialBatchNormalization
id: /J/St
next:
- /J/O
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 1024
- type: SpatialConvolution
id: /J/T
next:
- /J/XE
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 1024
nInputPlane: 384
- type: SpatialConvolution
id: /J/W
next:
- /J/E
- /G/t
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 0
@@ -198,62 +89,25 @@
kW: 1
nOutputPlane: 96
nInputPlane: 96
- type: ReLU
id: /J/X
- type: SpatialBatchNormalization
id: /G/t
next:
- /J/h
- /G/M
attributes:
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 96
- type: ReLU
id: /G/M
next:
- /G/o
attributes:
ctor_arg_order: p
p: true
- type: SpatialBatchNormalization
id: /J/XE
next:
- /J/f
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 1024
- type: SpatialBatchNormalization
id: /J/Xj
next:
- /J/1n
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 384
- type: SpatialMaxPooling
id: /J/Y
next:
- /J/b
attributes:
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialAveragePooling
id: /J/Z
next:
- /J/l
attributes:
padW: ''
padH: ''
count_include_pad: true
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 1
dW: 1
kH: 7
kW: 7
- type: SpatialConvolution
id: /J/a
id: /G/o
next:
- /J/Xj
- /G/O
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 0
@@ -262,12 +116,32 @@
dW: 1
kH: 1
kW: 1
nOutputPlane: 384
nInputPlane: 384
- type: SpatialConvolution
id: /J/b
nOutputPlane: 96
nInputPlane: 96
- type: SpatialBatchNormalization
id: /G/O
next:
- /J/q
- /G/8
attributes:
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 96
- type: SpatialMaxPooling
id: /G/U
next:
- /G/P
attributes:
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialConvolution
id: /G/P
next:
- /G/N
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 2
@@ -278,10 +152,40 @@
kW: 5
nOutputPlane: 256
nInputPlane: 96
- type: SpatialConvolution
id: /J/c
- type: SpatialBatchNormalization
id: /G/N
next:
- /J/95
- /G/Q
attributes:
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 256
- type: ReLU
id: /G/Q
next:
- /G/5
attributes:
ctor_arg_order: p
p: true
- type: SpatialBatchNormalization
id: /G/x
next:
- /G/p
attributes:
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 256
- type: ReLU
id: /G/p
next:
- /G/na
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /G/na
next:
- /G/w
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 0
@@ -292,34 +196,37 @@
kW: 1
nOutputPlane: 256
nInputPlane: 256
- type: ReLU
id: /J/d
next:
- /J/Y
attributes:
ctor_arg_order: p
p: true
- type: SpatialBatchNormalization
id: /J/e
id: /G/w
next:
- /J/n
- /G/F
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 256
- type: ReLU
id: /J/f
id: /G/F
next:
- /J/4l
- /G/E
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /J/g
- type: SpatialMaxPooling
id: /G/E
next:
- /J/w
- /G/us
attributes:
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialConvolution
id: /G/us
next:
- /G/D
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
@@ -330,56 +237,25 @@
kW: 3
nOutputPlane: 384
nInputPlane: 256
- type: SpatialConvolution
id: /J/h
- type: SpatialBatchNormalization
id: /G/D
next:
- /J/6
- /G/g
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 96
nInputPlane: 96
- type: LogSoftMax
id: /J/jq
next: []
attributes:
ctor_arg_order: ''
- type: View
id: /J/l
next:
- /J/8r
attributes:
ctor_arg_order: params
params: -1
numInputDims: 3
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 384
- type: ReLU
id: /J/n
id: /G/g
next:
- /J/8
- /G/9J
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /J/o
next:
- /J/T
attributes:
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialConvolution
id: /J/p
id: /G/9J
next:
- /J/F
- /G/1l
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 0
@@ -391,53 +267,153 @@
nOutputPlane: 384
nInputPlane: 384
- type: SpatialBatchNormalization
id: /J/q
id: /G/1l
next:
- /J/N
- /G/Jw
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 256
- type: ReLU
id: /J/qt
next:
- /J/a
attributes:
ctor_arg_order: p
p: true
- type: ReLU
id: /J/s
next:
- /J/W
attributes:
ctor_arg_order: p
p: true
- type: ReLU
id: /J/u
next:
- /J/P
attributes:
ctor_arg_order: p
p: true
- type: SpatialBatchNormalization
id: /J/w
next:
- /J/D
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 384
- type: SpatialBatchNormalization
id: /J/xm
- type: ReLU
id: /G/Jw
next:
- /J/KE
- /G/qA
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /G/qA
next:
- /G/HW
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 384
nInputPlane: 384
- type: SpatialBatchNormalization
id: /G/HW
next:
- /G/Ev
attributes:
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 384
- type: ReLU
id: /G/Ev
next:
- /G/ky
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /G/ky
next:
- /G/56
attributes:
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 2
dW: 2
kH: 3
kW: 3
- type: ReLU
id: /G/T
next:
- /G/zi
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /G/zi
next:
- /G/J
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 1024
nInputPlane: 1024
- type: SpatialBatchNormalization
id: /G/J
next:
- /G/Tq
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 1024
- type: ReLU
id: /G/Tq
next:
- /G/jy
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /G/jy
next:
- /G/3g
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 0
padW: 0
dH: 1
dW: 1
kH: 1
kW: 1
nOutputPlane: 1024
nInputPlane: 1024
- type: SpatialBatchNormalization
id: /G/3g
next:
- /G/cl
attributes:
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 1024
- type: ReLU
id: /G/cl
next:
- /G/xs
attributes:
ctor_arg_order: p
p: true
- type: SpatialAveragePooling
id: /G/xs
next:
- /G/CK
attributes:
padW: ''
padH: ''
count_include_pad: true
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 1
dW: 1
kH: 7
kW: 7
- type: View
id: /G/CK
next:
- /G/b
attributes:
ctor_arg_order: params
params: -1
numInputDims: 3
- type: Linear
id: /G/b
next:
- /G/rn
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 1000
inputSize: 1024
+229
Ver Arquivo
@@ -0,0 +1,229 @@
- type: SpatialConvolution
id: /r/2
next:
- /r/C
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 3
padW: 3
dH: 2
dW: 2
kH: 7
kW: 7
nOutputPlane: 64
nInputPlane: 3
- type: ReLU
id: /r/3
next:
- /r/ry
attributes:
ctor_arg_order: p
p: true
- type: CAddTable
id: /r/4
next:
- /r/3
attributes:
ctor_arg_order: ip
ip: true
- type: ConcatTable
id: /r/6
next:
- /r/M
attributes:
ctor_arg_order: ''
- type: ReLU
id: /r/7
next:
- /r/6
attributes:
ctor_arg_order: p
p: true
- type: Linear
id: /r/Dp
next: []
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 1000
inputSize: 512
- type: SpatialBatchNormalization
id: /r/C
next:
- /r/S
attributes:
ctor_arg_order: 'nOutput,eps,momentum,affine'
nOutput: 64
- type: ReLU
id: /r/S
next:
- /r/P
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /r/P
next:
- /r/k
attributes:
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 2
dW: 2
kH: 3
kW: 3
- type: ConcatTable
id: /r/k
next:
- /r/s
attributes:
ctor_arg_order: ''
- type: CAddTable
id: /r/s
next:
- /r/H
attributes:
ctor_arg_order: ip
ip: true
- type: ReLU
id: /r/H
next:
- /r/e
attributes:
ctor_arg_order: p
p: true
- type: ConcatTable
id: /r/e
next:
- /r/g
attributes:
ctor_arg_order: ''
- type: CAddTable
id: /r/g
next:
- /r/7
attributes:
ctor_arg_order: ip
ip: true
- type: CAddTable
id: /r/M
next:
- /r/Q
attributes:
ctor_arg_order: ip
ip: true
- type: ReLU
id: /r/Q
next:
- /r/N
attributes:
ctor_arg_order: p
p: true
- type: ConcatTable
id: /r/N
next:
- /r/Mf
attributes:
ctor_arg_order: ''
- type: CAddTable
id: /r/Mf
next:
- /r/a
attributes:
ctor_arg_order: ip
ip: true
- type: ReLU
id: /r/a
next:
- /r/ab
attributes:
ctor_arg_order: p
p: true
- type: ConcatTable
id: /r/ab
next:
- /r/CR
attributes:
ctor_arg_order: ''
- type: CAddTable
id: /r/CR
next:
- /r/i
attributes:
ctor_arg_order: ip
ip: true
- type: ReLU
id: /r/i
next:
- /r/H5
attributes:
ctor_arg_order: p
p: true
- type: ConcatTable
id: /r/H5
next:
- /r/4
attributes:
ctor_arg_order: ''
- type: ConcatTable
id: /r/ry
next:
- /r/t
attributes:
ctor_arg_order: ''
- type: CAddTable
id: /r/t
next:
- /r/9A
attributes:
ctor_arg_order: ip
ip: true
- type: ReLU
id: /r/9A
next:
- /r/Qu
attributes:
ctor_arg_order: p
p: true
- type: ConcatTable
id: /r/Qu
next:
- /r/q
attributes:
ctor_arg_order: ''
- type: CAddTable
id: /r/q
next:
- /r/o
attributes:
ctor_arg_order: ip
ip: true
- type: ReLU
id: /r/o
next:
- /r/G
attributes:
ctor_arg_order: p
p: true
- type: SpatialAveragePooling
id: /r/G
next:
- /r/b
attributes:
padW: ''
padH: ''
count_include_pad: true
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 1
dW: 1
kH: 7
kW: 7
- type: View
id: /r/b
next:
- /r/Dp
attributes:
ctor_arg_order: params
params: 512
numInputDims: 3
+287 -289
Ver Arquivo
@@ -1,302 +1,21 @@
- type: SpatialMaxPooling
id: /f/0
next:
- /f/y
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: View
id: /f/1V
next:
- /f/R
attributes:
ctor_arg_order: params
params: 25088
- type: Linear
id: /f/3
id: /K/5
next:
- /f/vo
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 1000
inputSize: 4096
- type: SpatialConvolution
id: /f/4
next:
- /f/ID
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: BatchNormalization
id: /f/4R
next:
- /f/V
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 4096
- type: Threshold
id: /f/6
next:
- /f/J
attributes:
ip: ''
ctor_arg_order: 'th,v,ip'
v: 0.000001
th: 0
- type: SpatialConvolution
id: /f/C
next:
- /f/e
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 256
- type: ReLU
id: /f/D
next:
- /f/X
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /f/FN
next:
- /f/b
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: ReLU
id: /f/ID
next:
- /f/g
attributes:
ctor_arg_order: p
p: true
- type: BatchNormalization
id: /f/J
next:
- /f/eZ
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 4096
- type: ReLU
id: /f/N
next:
- /f/0
attributes:
ctor_arg_order: p
p: true
- type: Linear
id: /f/R
next:
- /f/i
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 25088
- type: SpatialMaxPooling
id: /f/U
next:
- /f/FN
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: Dropout
id: /f/V
next:
- /f/s
attributes:
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace'
p: 0.5
- type: SpatialConvolution
id: /f/W
next:
- /f/l
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: SpatialConvolution
id: /f/X
next:
- /f/j
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 256
nInputPlane: 256
- type: ReLU
id: /f/Y
next:
- /f/q
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /f/ZV
next:
- /f/C
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: ReLU
id: /f/b
next:
- /f/4
attributes:
ctor_arg_order: p
p: true
- type: ReLU
id: /f/e
next:
- /f/W
attributes:
ctor_arg_order: p
p: true
- type: Dropout
id: /f/eZ
next:
- /f/3
attributes:
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace'
p: 0.5
- type: SpatialMaxPooling
id: /f/g
next:
- /f/1V
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: Threshold
id: /f/i
next:
- /f/4R
attributes:
ip: ''
ctor_arg_order: 'th,v,ip'
v: 0.000001
th: 0
- type: ReLU
id: /f/j
next:
- /f/ZV
attributes:
ctor_arg_order: p
p: true
- type: ReLU
id: /f/l
next:
- /f/U
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /f/n
next:
- /f/D
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 256
nInputPlane: 128
- type: SpatialMaxPooling
id: /f/q
next:
- /f/n
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: Linear
id: /f/s
next:
- /f/6
- /K/r
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 4096
- type: LogSoftMax
id: /f/vo
id: /K/3g
next: []
attributes:
ctor_arg_order: ''
- type: SpatialConvolution
id: /f/w
id: /K/z
next:
- /f/N
- /K/p
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
@@ -307,10 +26,29 @@
kW: 3
nOutputPlane: 64
nInputPlane: 3
- type: SpatialConvolution
id: /f/y
- type: ReLU
id: /K/p
next:
- /f/Y
- /K/G
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /K/G
next:
- /K/O
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialConvolution
id: /K/O
next:
- /K/U
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
@@ -321,3 +59,263 @@
kW: 3
nOutputPlane: 128
nInputPlane: 64
- type: ReLU
id: /K/U
next:
- /K/B
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /K/B
next:
- /K/c
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialConvolution
id: /K/c
next:
- /K/w
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 256
nInputPlane: 128
- type: ReLU
id: /K/w
next:
- /K/P
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /K/P
next:
- /K/K
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 256
nInputPlane: 256
- type: ReLU
id: /K/K
next:
- /K/t
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /K/t
next:
- /K/f
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialConvolution
id: /K/f
next:
- /K/I
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 256
- type: ReLU
id: /K/I
next:
- /K/o
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /K/o
next:
- /K/T
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: ReLU
id: /K/T
next:
- /K/J
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /K/J
next:
- /K/X
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialConvolution
id: /K/X
next:
- /K/V
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: ReLU
id: /K/V
next:
- /K/g
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /K/g
next:
- /K/W
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: ReLU
id: /K/W
next:
- /K/m
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /K/m
next:
- /K/gg
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: View
id: /K/gg
next:
- /K/pB
attributes:
ctor_arg_order: params
params: 25088
- type: Linear
id: /K/pB
next:
- /K/Z
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 25088
- type: Threshold
id: /K/Z
next:
- /K/S
attributes:
ip: ''
ctor_arg_order: 'th,v,ip'
v: 0.000001
th: 0
- type: BatchNormalization
id: /K/S
next:
- /K/W9
attributes:
ctor_arg_order: 'nOutput,eps,momentum,affine'
momentum: 0.1
eps: 0.001
nOutput: 4096
- type: Dropout
id: /K/W9
next:
- /K/5
attributes:
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace,stochasticInference'
p: 0.5
- type: Threshold
id: /K/r
next:
- /K/e
attributes:
ip: ''
ctor_arg_order: 'th,v,ip'
v: 0.000001
th: 0
- type: BatchNormalization
id: /K/e
next:
- /K/4q
attributes:
ctor_arg_order: 'nOutput,eps,momentum,affine'
momentum: 0.1
eps: 0.001
nOutput: 4096
- type: Dropout
id: /K/4q
next:
- /K/tp
attributes:
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace,stochasticInference'
p: 0.5
- type: Linear
id: /K/tp
next:
- /K/3g
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 1000
inputSize: 4096
+1 -3
Ver Arquivo
@@ -65,9 +65,6 @@
"VolumetricFullConvolution",
"VolumetricMaxUnpooling"
],
"Containers": [
"Concat"
],
"Criterion": [
"BCECriterion",
"WeightedMSECriterion",
@@ -96,6 +93,7 @@
"LinearNoBias",
"SparseLinear",
"Dropout",
"Concat",
"Abs",
"Add",
"Mul",
+11 -4
Ver Arquivo
@@ -36,10 +36,17 @@ skipLayerList.forEach(name => SKIP_LAYERS[name] = true);
catNames.forEach(cat => // create layer -> category dictionary
categories[cat].forEach(lname => layerToCategory[lname] = cat)
);
var lookupType = function(name){
var layerType = layerToCategory[name];
var lookupType = function(layer){
var layerType;
if (layer.baseType === 'Container') {
layerType = 'Container';
} else {
layerType = layerToCategory[layer.name];
}
if (!layerType) { // try to infer
layerType = name.indexOf('Criterion') > -1 && 'Criterion';
layerType = layer.name.indexOf('Criterion') > -1 && 'Criterion';
}
return layerType || 'Misc';
};
@@ -55,7 +62,7 @@ fs.readdir(torchPath, function(err,files){
.filter(layer => !!layer && layer.name);
layers.forEach(layer => {
layer.type = lookupType(layer.name);
layer.type = lookupType(layer);
layerByName[layer.name] = layer;
});
+3
Ver Arquivo
@@ -287,6 +287,9 @@
},
"LayerDecorator": {
"src": "src/decorators/LayerDecorator"
},
"ContainerLayerDecorator": {
"src": "src/decorators/ContainerLayerDecorator"
}
},
"seeds": {