Comparar commits

..

45 Commits

Autor SHA1 Mensagem Data
Brian Broll 1abbecc54c v0.13.0 2016-08-15 10:07:40 -05:00
Brian Broll af2f34545b Added basic table literal support. Fixes #652 (#689) 2016-08-12 17:05:03 -05:00
Brian Broll f7499c4599 Added more robust layer parsing to LayerEditor. Fixes #670 (#688)
WIP #670 Added most LayerParser fn-ality

WIP Fixed error w/ changing arch editors

WIP #670 Added pointer, setter support in layer editor

WIP #670 Updated for layer-as-args

WIP #670 Fixed ctor_arg_order setting

WIP #670 Removed unused fn
2016-08-12 15:59:10 -05:00
Brian Broll ad52fe7d70 Removed containing dir info from stack trace. Fixes #668 (#687) 2016-08-12 15:30:16 -05:00
Brian Broll 5ddeb6f331 Added layers-as-arguments. Fixes #654 (#684)
WIP #654 Added LayerDecorator

WIP #654

WIP #654 Added support for adding/removing layers

WIP #654 Fixed the text for the layers

WIP #654 Refactored content text

WIP #654 Only delete target if it's a child

WIP #654 Updated for layers-as-args

WIP #654 Made a better name for layer args

WIP #654 Added explicit arg types

WIP #654 Changed argindex -> ctor_arg_order

WIP #654 Added support for layers-as-args in GenArch

WIP #654 Added import fn-ality

WIP #654 Updated visualizers for layer support

WIP #654 Fixed code climate issues

WIP #654 Fixed setter detection

WIP #654 Updated tests

WIP #654 Updated tests
2016-08-12 14:28:54 -05:00
Brian Broll 7cd3d961cf Added naming executions. Fixes #683 (#685)
WIP #683 Removed issue from merge w/ master

WIP #683 Updated googlenet test
2016-08-12 13:43:26 -05:00
Brian Broll c38b38b4a1 Added more logging to better debug failures in the future. Fixes #660 (#680)
WIP #660 Added more logs

WIP #660 Added more logs during execution creation

WIP #660 Added more logging for starting executions
2016-08-12 09:54:13 -05:00
Brian Broll 6ae73ece70 Added edit icon for custom layers. Fixes #678 (#679) 2016-08-11 21:33:16 -05:00
Brian Broll b5512d8228 Added better error handling when blob changed. Fixes #659 (#677) 2016-08-11 17:03:48 -05:00
Brian Broll 89c871412a Remove territory ui on ExecIndex destroy. Fixes #673 (#676) 2016-08-11 16:42:13 -05:00
JimnyCricket 33e28aa3f1 Filter non-numbers before graphing. Fixes #671 (#672)
WIP #671 Fixed code climate issues
2016-08-11 16:16:07 -05:00
Brian Broll 3899c3cb16 Added attr type inference in parser. Fixes #655 (#669)
WIP #655 Added type inference based on defaults

WIP #655 removed extra console.log

WIP #655 Inferring type from assertions

WIP #655 Fixed some parsing bugs

WIP #655 Added better type inference

WIP #655 Using types in metamodel creation

WIP #655 Added types

WIP #655 Updated nn library

WIP #655 Fixed code climate issues
2016-08-11 13:22:06 -05:00
Brian Broll eb4f97e9b5 Added check for points before graphing. Fixes #663 (#665)
WIP #663 Removed empty point text
2016-08-11 12:29:14 -05:00
JimnyCricket 16e37043f4 Added type checking for x,y in graph. Fixes #664 (#666)
Changed to single assertion with more info

WIP #664 "Expected" -> "expected"
2016-08-11 11:45:32 -05:00
Brian Broll 261ffd1eba Update README.md (#657) 2016-08-10 15:20:10 -05:00
Brian Broll 9167b33e18 Added configurable worker.cache.dir and worker.cache.useBlob. Fixes #638 (#653)
WIP #638 Added config schema

WIP #638 Added default cache location

WIP #638 Added useBlob fn-ality

WIP #638 Added type checking

WIP #638 Fixed config merge issue

WIP #638 Create worker cache parent dir if needed
2016-08-10 08:23:44 -05:00
Brian Broll 6f7f0d01e5 Added check for undefined value. Fixes #650 (#651) 2016-08-09 16:39:20 -05:00
Brian Broll c11b1fe812 Added blob.dir configuration. Fixes #639 (#649)
WIP #639 Added config schema

WIP #639 Added blob.dir config value
2016-08-09 14:57:32 -05:00
Brian Broll 306425cae1 Added implicit require 'nn' to ImportTorch. Fixes #644 (#647)
WIP #644 Added test
2016-08-09 14:14:04 -05:00
Brian Broll 6d70728b54 Added recurrent layers. Fixes #477 (#645)
WIP #477 Added skipArgs and rnn parsing support

WIP #477 Added update script and updated CreateTorchMeta

WIP #477 Run update script after nn-parser

WIP #477 Simplified nn-parser usage (just 'rnn' or 'nn')

WIP #477 Added 'all' option

WIP #477 Updated the nn project

WIP #477 `require 'rnn'` => nop in importer

WIP #477 Updated gen arch

WIP #477 Updated update --torch

WIP #477 Added rnn installation to torch install

WIP #477 Fixed code climate issues
2016-08-09 13:50:19 -05:00
Brian Broll fadb654883 Create worker dir if doesn't exist. Fixes #643 (#646) 2016-08-09 13:49:13 -05:00
Brian Broll 6528bbdbc6 Clearing output viewer territory on destroy. Fixes #622 (#642) 2016-08-09 07:50:19 -05:00
Brian Broll 23852de607 Set the cache to blob in 'local' mode. Fixes #637 (#640) 2016-08-08 12:43:37 -05:00
Brian Broll 9cf66a0e02 Added caching support to workers. Fixes #616 (#636)
WIP #616 Added cache dir if doesn't exist

WIP #616 Removed data from execution files

WIP #616 Added pointer files to data download

WIP #616 Fixed symlink creation
2016-08-08 12:16:30 -05:00
Brian Broll ad19e0fb57 v0.12.0 2016-08-08 08:30:01 -05:00
Brian Broll 14f222bf6f Merge branch '624-large-files-fail-exec' 2016-08-04 15:23:00 -05:00
Brian Broll 95141d1a42 Added image counter for uploading. Fixes #625 (#632) 2016-08-04 15:14:26 -05:00
Brian Broll 93aaf72372 Added explicit data download on worker. Fixes #624
WIP #624 Missing parens
2016-08-04 15:11:02 -05:00
Brian Broll 47a6612ed0 Added anchor detection on output type click. Fixes #626 (#631) 2016-08-04 14:37:15 -05:00
Brian Broll fe48af8bf4 Created unique worker config and cleanup on close. Fixes #618 (#623) 2016-08-04 10:55:06 -05:00
Brian Broll 78ca4f8762 Added error logs for more complex errors. Fixes #620 (#621)
WIP #620 Added error message to stdout

WIP #620 Added colors and console message
2016-08-04 10:01:36 -05:00
Brian Broll a7e08aa279 Update attributes on cancel job. Fixes #617 (#619)
WIP #617 moved client edits out of promise

WIP #617 Made 'isRunning' more robust

WIP #617 Fixed client calls
2016-08-04 08:37:09 -05:00
Brian Broll e2980d616f Filter out all non-alphanumeric or _ chars in execution. Fixes #612 (#614) 2016-08-03 16:55:02 -05:00
Brian Broll 96f2090d9e Removed long error message on failed exec. Fixes #608 (#611) 2016-08-03 15:55:04 -05:00
Brian Broll 8a86a114db Updated Materialize to explicit require (~global). Fixes #607 (#610) 2016-08-03 15:44:31 -05:00
Brian Broll cb757da118 Added torch config dir check before update. Fixes #606 (#609) 2016-08-03 15:36:43 -05:00
Brian Broll 31711e079a Enabled autoMerge. Fixes #332 Fixes #346 (#605) 2016-08-03 14:02:11 -05:00
Brian Broll 16ebb83ae6 Hiding restart button when running. Fixes #597 (#604) 2016-08-03 13:49:17 -05:00
Brian Broll 65304b2645 Changed SNAPSHOT->DEBUG. Fixes #601 (#603) 2016-08-03 13:18:41 -05:00
Brian Broll b44c6a104b Added execution canceling. Fixes #481 (#602)
WIP #481 Added buttons and jobId, secret setting

WIP #481 Added 'jobId', 'secret' to Job

WIP #481 Canceling job exec support

WIP #481 Added canceling executing pipelines

WIP #481 Fixed canceling pipelines

WIP #481 Improved result messages from executions

WIP #481 Updated decorator and status setting for ExecJob

WIP #481 Updated job colors in lists

WIP #481 Updated pipeline library

WIP #481 Fixed code climate issues
2016-08-03 12:42:55 -05:00
Brian Broll a8e5876f83 Updated fab icon colors. Fixes #588 (#599) 2016-08-03 08:41:24 -05:00
Brian Broll 2d9d1e71c0 Added "complete" notification if exec forked. Fixes #596 (#598)
WIP #596 Added quotes around job, exec, branch for consistency
2016-08-03 08:37:24 -05:00
Brian Broll 475bdfed50 Added notification on fork to ExecuteJob. Fixes #591 (#595)
WIP #591 Added notification on fork to ExecuteJob

WIP #591 Fixed fork name creation
2016-08-03 08:16:04 -05:00
Brian Broll c36f12ccb2 Added Execution dashboard. Fixes #587 (#594)
WIP #587 Added toggling embedded viz

WIP #587 Added ExecutionIndex

WIP #587 Added exec table and rows

WIP #587 Added status colors

WIP #587 Added color coded by status

WIP #587 Retrieved graphs for each execution

WIP #587 Added lineGraph object in right split

WIP #587 Fixed lineGraph resize and added multiple lines

WIP #587 Fixed line updates/removal

WIP #587 Added execution selection

WIP #587 Added execution toggling

WIP #587 Fixed untoggle-able after update

WIP #587 Fixed exec status color updates

WIP #578 Exec name click -> navigate to the given execution

WIP #587 Added pipeline names

WIP #587 Added default 'checking' and pipeline name updates

WIP #587 Fixed the deselection of running execs

WIP #587 Fixed initial pipeline names

WIP #587 Added toggling visualizers

WIP #587 Fixed positioning

WIP #587 Added more logs and fixed pipeline name finding

WIP #587 Fixed project switching and obj changed

WIP #587 Improved perf of chart
2016-08-02 16:42:28 -05:00
Brian Broll 0b8b5b8adf Added decimal to number chars in graph plotting. Fixes #589 (#590) 2016-08-02 11:56:50 -05:00
88 arquivos alterados com 7993 adições e 5031 exclusões
+2
Ver Arquivo
@@ -20,6 +20,8 @@ Next, start deepforge with `deepforge start`!
Finally, navigate to [http://localhost:8888](http://localhost:8888) to start using DeepForge! For more, detailed instructions, check out the [wiki](https://github.com/dfst/deepforge/wiki/Installation-Guide).
Also, be sure to check out the other available features of the `deepforge` cli; it can be used to update, manage your torch installation, uninstall deepforge and run individual components!
## Interested in contributing?
Contributions are welcome! Either fork the project and submit some PR's or shoot me an email about getting more involved!
+9
Ver Arquivo
@@ -2,6 +2,15 @@
"torch": {
"dir": "~/.deepforge/torch"
},
"blob": {
"dir": "~/.deepforge/blob"
},
"worker": {
"cache": {
"useBlob": true,
"dir": "~/.deepforge/worker/cache"
}
},
"mongo": {
"dir": "~/.deepforge/data"
}
+90 -33
Ver Arquivo
@@ -3,7 +3,7 @@
var Command = require('commander').Command,
program = new Command(),
childProcess = require('child_process'),
spawn = childProcess.spawn,
rawSpawn = childProcess.spawn,
execSync = childProcess.execSync,
path = require('path'),
fs = require('fs'),
@@ -11,7 +11,7 @@ var Command = require('commander').Command,
exists = require('exists-file'),
forever = require('forever-monitor'),
DEFAULT_CONFIG = require('./config.json'),
assign = require('lodash.assign'),
merge = require('lodash.merge'),
config,
configDir = path.join(process.env.HOME, '.deepforge'),
@@ -20,7 +20,12 @@ var Command = require('commander').Command,
localConfig,
rm_rf = require('rimraf'),
p = dir => dir.replace(/^~/, process.env.HOME); // resolve '~' to '$HOME'
p = dir => {
if (typeof dir === 'string') {
return dir.replace(/^~/, process.env.HOME); // resolve '~' to '$HOME'
}
return dir;
};
// Check for any commands
if (process.argv.length === 2) {
@@ -39,17 +44,17 @@ if (!exists.sync(configPath)) {
}
localConfig = require(configPath);
config = assign(DEFAULT_CONFIG, require(configPath));
config = merge({}, DEFAULT_CONFIG, localConfig);
var getConfigValue = function(id) {
var getConfigValue = function(id, srcConfig) {
var keys = id.split('.'),
value = config;
value = srcConfig || config;
for (var i = 0; i < keys.length; i++) {
value = value[keys[i]];
if (!value) {
if (!value.hasOwnProperty(keys[i])) {
return null;
}
value = value[keys[i]];
}
return value;
};
@@ -59,7 +64,8 @@ var storeConfig = function(id, value) {
var keys = id.split('.').filter(k => k),
lastKey = keys.pop(),
currentObj = localConfig,
current = getConfigValue(id);
current = getConfigValue(id),
expType = typeof getConfigValue(id, DEFAULT_CONFIG);
// Check if it is a valid key
if (current === null) {
@@ -73,11 +79,35 @@ var storeConfig = function(id, value) {
currentObj = currentObj[keys[i]];
}
if (expType !== 'string') {
try { // try to downcast
value = JSON.parse(value);
} catch (e) {
console.log(`Invalid value: "${value}" (expected ${expType})`);
return;
}
}
currentObj[lastKey] = value;
fs.writeFileSync(configPath, JSON.stringify(localConfig, null, 2));
return true;
};
(function() { // Load config to env
var envToConf = require('./envConfig.json');
Object.keys(envToConf).forEach(env => {
var cKey = envToConf[env];
process.env[env] = process.env[env] || p(getConfigValue(cKey));
});
// Special cases
if (process.env.DEEPFORGE_WORKER_USE_BLOB === 'true' &&
exists.sync(process.env.DEEPFORGE_BLOB_DIR)) {
process.env.DEEPFORGE_WORKER_CACHE = process.env.DEEPFORGE_BLOB_DIR + '/wg-content';
}
})();
program
.version('v' + version)
.description('Command line interface for managing deepforge');
@@ -115,7 +145,7 @@ var checkMongo = function(args) {
};
var startMongo = function(args, silent) {
var job = spawn('mongod', ['--dbpath', p(config.mongo.dir)], {
var job = rawSpawn('mongod', ['--dbpath', p(config.mongo.dir)], {
cwd: process.env.HOME
});
if (!silent) {
@@ -166,7 +196,8 @@ var _checkTorch = function(resolve, reject) {
process.chdir(tgtDir);
spawnMany([
'bash install-deps',
'./install.sh'
'./install.sh',
'luarocks install rnn'
], () => {
storeConfig('torch.dir', tgtDir);
resolve(true);
@@ -192,7 +223,7 @@ var spawnMany = function(cmds, succ, err) {
rawCmd = cmds.shift();
args = rawCmd.split(' ');
cmd = args.shift();
job = spawn(cmd, args);
job = rawSpawn(cmd, args);
job.stdout.on('data', data => process.stdout.write(data));
job.stderr.on('data', data => process.stderr.write(data));
job.on('close', code => {
@@ -206,6 +237,28 @@ var spawnMany = function(cmds, succ, err) {
};
var spawn = function(cmd, args, opts) {
var promise,
err;
args = args || [];
promise = new Promise((resolve, reject) => {
var job = opts ? rawSpawn(cmd, args, opts) : rawSpawn(cmd, args);
job.stdout.on('data', data => process.stdout.write(data));
job.stderr.on('data', data => process.stderr.write(data));
job.on('close', code => {
if (err) {
reject(err);
} else {
resolve(code);
}
});
job.on('error', e => err = e);
});
return promise;
};
program.command('start')
.description('start deepforge locally (default) or specific components')
.option('-p, --port <port>', 'specify the port to use')
@@ -264,7 +317,6 @@ program
.option('-s, --server', 'update deepforge')
.action(args => {
var pkg = 'deepforge',
job,
latestVersion;
// Install the project
@@ -287,16 +339,11 @@ program
}
}
job = spawn('npm', ['install', '-g', pkg]);
job.stdout.on('data', data => process.stdout.write(data.toString()));
job.stderr.on('data', data => process.stderr.write(data.toString()));
job.on('close', code => {
if (!code) {
spawn('npm', ['install', '-g', pkg])
.then(() => {
console.log('Upgrade successful!');
} else {
console.log('Upgrade failed w/ error code: ' + code);
}
});
})
.catch(code => console.log('Upgrade failed w/ error code: ' + code));
}
if (args.torch || !args.server) {
@@ -305,18 +352,28 @@ program
if (!justInstalled) {
// Upgrade torch
console.log('Upgrading torch...');
job = spawn('bash', ['./update.sh'], {
cwd: p(config.torch.dir)
});
job.stdout.on('data', data => process.stdout.write(data.toString()));
job.stderr.on('data', data => process.stderr.write(data.toString()));
job.on('close', code => {
if (!code) {
console.log(`Checking for torch in ${config.torch.dir}`);
// Verify that torch is installed in the config's location
if (!exists.sync(path.join(config.torch.dir, 'update.sh'))) {
// config is incorrect!
console.log('Could not find torch installation. Please update the deepforge config with:');
console.log('');
console.log(' deepforge config torch.dir ~/path/to/torch/install');
console.log('');
return;
}
spawn('bash', ['./update.sh'], {cwd: p(config.torch.dir)})
.catch(err => console.log('Upgrade failed w/ error code: ' + err.code))
.then(() => {
console.log('About to update rnn package...');
// Update rnn
return spawn('luarocks', ['install', 'rnn']);
})
.then(() => {
console.log('Upgrade successful!');
} else {
console.log('Upgrade failed w/ error code: ' + code);
}
});
})
.catch(code => console.log('Upgrade failed w/ error code: ' + code));
}
});
}
+5
Ver Arquivo
@@ -0,0 +1,5 @@
{
"DEEPFORGE_BLOB_DIR": "blob.dir",
"DEEPFORGE_WORKER_CACHE": "worker.cache.dir",
"DEEPFORGE_WORKER_USE_BLOB": "worker.cache.useBlob"
}
+8 -1
Ver Arquivo
@@ -4,7 +4,14 @@ var spawn = require('child_process').spawn,
execJob,
path = require('path'),
env = {cwd: path.join(__dirname, '..')},
workerJob = null;
workerJob = null,
gmeConfig = require(__dirname + '/../config');
// Set the cache to the blob
console.log(gmeConfig);
if (gmeConfig.blob.type === 'FS') {
process.env.DEEPFORGE_WORKER_CACHE = path.resolve(gmeConfig.blob.fsDir + '/wg-content');
}
process.env.NODE_ENV = 'local';
execJob = spawn('npm', [
+23 -2
Ver Arquivo
@@ -4,15 +4,29 @@ var path = require('path'),
fs = require('fs'),
childProcess = require('child_process'),
spawn = childProcess.spawn,
rm_rf = require('rimraf'),
projectConfig = require(__dirname + '/../config'),
executorSrc = path.join(__dirname, '..', 'node_modules', 'webgme', 'src',
'server', 'middleware', 'executor', 'worker'),
workerPath = path.join(__dirname, '..', 'src', 'worker'),
workerConfigPath = path.join(workerPath, 'config.json'),
workerConfigPath = path.join(workerPath, 'config_' + Date.now() + '.json'),
workerTmp = path.join(workerPath, 'tmp'),
address,
config = {};
var createDir = function(dir) {
try {
fs.statSync(dir);
} catch (e) {
// Create dir
fs.mkdirSync(dir);
return true;
}
return false;
};
createDir(workerPath);
createDir(workerTmp);
// Check torch support
var result = childProcess.spawnSync('th', ['--help']);
if (result.error) {
@@ -22,7 +36,15 @@ if (result.error) {
process.exit(1);
}
var cleanUp = function() {
console.log('removing config ', workerConfigPath);
rm_rf.sync(workerConfigPath);
};
var startExecutor = function() {
process.on('SIGINT', cleanUp);
process.on('uncaughtException', cleanUp);
// Start the executor
var execJob = spawn('node', [
'node_worker.js',
@@ -42,7 +64,6 @@ var createConfigJson = function() {
}
config[address] = {};
// TODO: Check if the config already exists
fs.writeFile(workerConfigPath, JSON.stringify(config), startExecutor);
};
+4
Ver Arquivo
@@ -9,6 +9,8 @@ require('dotenv').load({silent: true});
// Add/overwrite any additional settings here
config.server.port = +process.env.PORT || config.server.port;
config.mongo.uri = process.env.MONGO_URI || config.mongo.uri;
config.blob.fsDir = process.env.DEEPFORGE_BLOB_DIR || config.blob.fsDir;
config.requirejsPaths.deepforge = './src/common';
config.requirejsPaths.ace = './src/visualizers/widgets/TextEditor/lib/ace';
config.seedProjects.defaultProject = 'project';
@@ -21,5 +23,7 @@ config.executor.clearOldDataAtStartUp = true;
config.visualization.extraCss.push('deepforge/styles/global.css');
config.storage.autoMerge.enable = true;
validateConfig(config);
module.exports = config;
+4 -4
Ver Arquivo
@@ -12,23 +12,23 @@
"watch-test": "./node_modules/nodemon/bin/nodemon.js --exec 'node ./node_modules/mocha/bin/mocha --recursive test'",
"build-nn": "node ./utils/nn-parser.js"
},
"version": "0.11.0",
"version": "0.13.0",
"dependencies": {
"commander": "^2.9.0",
"dotenv": "^2.0.0",
"exists-file": "^2.1.0",
"forever-monitor": "^1.7.0",
"lodash.assign": "^4.0.9",
"lodash.difference": "^4.1.2",
"lodash.merge": "^4.5.1",
"nodemon": "^1.9.2",
"rimraf": "^2.4.0",
"webgme": "^2.0.0",
"webgme-autoviz": "dfst/webgme-autoviz",
"webgme-breadcrumbheader": "^2.1.0",
"webgme-chflayout": "^2.0.0",
"webgme-easydag": "dfst/webgme-easydag",
"webgme-fab": "dfst/webgme-fab",
"webgme-simple-nodes": "^2.0.0",
"rimraf": "^2.4.0"
"webgme-simple-nodes": "^2.1.0"
},
"devDependencies": {
"chai": "^3.0.0",
+4 -1
Ver Arquivo
@@ -9,5 +9,8 @@ define({
GRAPH_CREATE: 'GRAPH',
GRAPH_PLOT: 'PLOT',
GRAPH_CREATE_LINE: 'LINE'
GRAPH_CREATE_LINE: 'LINE',
// Code Generation Constants
CTOR_ARGS_ATTR: 'ctor_arg_order'
});
+129 -25
Ver Arquivo
@@ -83,20 +83,6 @@
//////////////////////// 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';
@@ -154,7 +140,7 @@
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;
value = curr.right.type === 'const.nil' ? null : curr.right;
dict[varName] = value;
}
}
@@ -163,18 +149,124 @@
return dict;
};
var copyAttrs = function(attrs, from, to) {
var copyNodeValues = function(attrs, from, to) {
var value;
for (var i = attrs.length; i--;) {
to[attrs[i]] = from[attrs[i]];
value = from[attrs[i]] || null;
if (value) {
value = (value && value.hasOwnProperty('val')) ? value.val : value;
to[attrs[i]] = value;
}
}
return to;
};
var getTypeCheckInfo = function(cond) {
var caller,
method,
target,
expType;
// Check for torch.isTypeOf:
if (cond.type === 'expr.call' && cond.func.type === 'expr.index') {
caller = cond.func.self.val;
method = cond.func.key.val;
if (cond.type === 'expr.call' && caller === 'torch') {
target = cond.args[0].val;
if (method === 'isTypeOf' && target) {
expType = cond.args[1].val;
return {
target,
type: expType
};
}
}
} else if (cond.type === 'expr.op') { // torch.type() === ''
// Check right side, too!
var sides = [cond.left, cond.right],
side,
otherSide;
for (var i = sides.length; i--;) {
side = sides[i];
otherSide = sides[(i+1)%2];
if (side.type === 'expr.call' && side.func.type === 'expr.index') {
// Is it torch?
caller = side.func.self.val;
method = side.func.key.val;
if (caller === 'torch' && method === 'type') {
if (side.args[0].type === 'variable') {
target = side.args[0].val;
if (otherSide.type === 'const.string') {
expType = otherSide.val;
return {
target: target,
type: expType
};
}
}
}
}
}
return null;
}
};
var isError = function(stat) {
var fn;
if (stat.type === 'stat.expr' && stat.expr.type === 'expr.call') {
fn = stat.expr.func.val;
return fn === 'error';
}
return false;
};
var inferParamTypes = function(node, paramDefs) {
var types = {},
check,
cond;
// Infer from assertions
luajs.codegen.traverse(curr => {
// check for 'assert's that check type
if (curr.type === 'expr.call' && curr.func.val === 'assert') {
cond = curr.args[0];
check = getTypeCheckInfo(cond);
if (check) {
types[check.target] = check.type;
}
} else if (curr.type === 'stat.if' && curr.cond.op === 'uop.not') {
// if statements throwing errors on type mismatch
cond = curr.cond.operand; // non-negated version
// Check that it throws an error on true
if (curr.tblock.stats.some(isError)) {
check = getTypeCheckInfo(cond);
if (check) {
types[check.target] = check.type;
}
}
}
})(node);
// Infer from defaults
Object.keys(paramDefs).forEach(param => {
var val = paramDefs[param];
if (val) { // initialized to 'null' doesn't help us...
types[param] = val.type.replace('const.', '');
}
});
return types;
};
var findTorchClass = function(ast){
var torchClassArgs, // args for `torch.class(...)`
name = '',
baseType,
params = [],
params,
setters = {},
defaults = {},
paramDefs,
@@ -191,7 +283,6 @@
name = torchClassArgs[0];
if(name !== ''){
name = name.replace('nn.', '');
params = findInitParams(ast);
if (torchClassArgs.length > 1) {
baseType = torchClassArgs[1].replace('nn.', '');
}
@@ -200,9 +291,10 @@
});
}
// Get the setters and defaults
// Get the setters, defaults and type info (inferred)
var setterNames,
schema,
types,
values;
luajs.codegen.traverse((curr, parent) => {
@@ -227,19 +319,26 @@
} else if (isInitFn(curr, name)) { // Record the defaults
paramDefs = getAttrsAndVals(curr);
attrDefs = getClassAttrDefs(curr);
types = inferParamTypes(curr, paramDefs);
// get ctor args
params = curr.func.args;
if(params.length === 0 && curr.func.varargs){
params.push('params');
}
}
})(ast);
// Get the defaults for the params from defs
if (paramDefs) {
copyAttrs(params, paramDefs, defaults);
if (paramDefs && params) {
copyNodeValues(params, paramDefs, defaults);
}
// Get the defaults for the setters from attrDefs
if (attrDefs) {
setterNames = Object.keys(setters);
copyAttrs(setterNames, attrDefs, defaults);
copyNodeValues(setterNames, attrDefs, defaults);
}
// Remove any const setters w/ only one value and no default
@@ -263,13 +362,18 @@
baseType,
params,
setters,
types,
defaults
};
};
LayerParser.parse = function(text) {
var ast = luajs.parser.parse(text);
return findTorchClass(ast);
try {
var ast = luajs.parser.parse(text);
return findTorchClass(ast);
} catch (e) {
return null;
}
};
return LayerParser;
+3 -1
Ver Arquivo
@@ -1,10 +1,12 @@
/* globals Materialize, WebGMEGlobal, define*/
/* globals WebGMEGlobal, define*/
// This file creates the DeepForge namespace and defines basic actions
define([
'panel/FloatingActionButton/styles/Materialize',
'js/RegistryKeys',
'js/Panels/MetaEditor/MetaEditorConstants',
'js/Constants'
], function(
Materialize,
REGISTRY_KEYS,
META_CONSTANTS,
CONSTANTS
+20 -15
Ver Arquivo
@@ -1,6 +1,8 @@
/* globals define*/
define([
'deepforge/Constants'
], function(
Constants
) {
'use strict';
@@ -15,36 +17,39 @@ define([
return result;
};
var isArgument = function(arg) {
return arg.hasOwnProperty('argindex');
};
var isSetter = function(arg) {
return arg.hasOwnProperty('setterType');
};
var sortByIndex = function(a, b) {
return a.argindex > b.argindex;
};
var createLayerDict = function(core, meta) {
var node,
names = Object.keys(meta),
layers = {},
setters,
ctorData,
ctorArgs,
attrs;
for (var i = names.length; i--;) {
node = meta[names[i]];
attrs = core.getValidAttributeNames(node)
.map(attr => prepAttribute(core, node, attr));
ctorData = core.getAttribute(node, Constants.CTOR_ARGS_ATTR);
attrs = core.getValidAttributeNames(node);
layers[names[i]] = {};
layers[names[i]].args = attrs
.filter(isArgument)
.sort(sortByIndex);
if (ctorData) {
ctorArgs = ctorData.split(',')
.map(attr => prepAttribute(core, node, attr));
// Get the constructor args
layers[names[i]].args = ctorArgs;
} else {
layers[names[i]].args = [];
}
layers[names[i]].setters = {};
setters = attrs.filter(isSetter);
setters = attrs
.map(attr => prepAttribute(core, node, attr))
.filter(isSetter);
for (var j = setters.length; j--;) {
layers[names[i]].setters[setters[j].name] = setters[j];
}
@@ -54,7 +59,7 @@ define([
};
// When provided with the META, create the given LayerDict object
// - Sort (and filter) by argindex
// - Filter out the ctor args (in order)
// - add name attribute to schema
// - store this array under the META name
+4
Ver Arquivo
@@ -22,3 +22,7 @@
.create-node text {
font-style: italic;
}
.job-canceled {
background-color: #ffe0b2;
}
+39
Ver Arquivo
@@ -0,0 +1,39 @@
/* globals define*/
define([
], function(
) {
var isBoolean = txt => {
return typeof txt === 'boolean' || (txt === 'false' || txt === 'true');
};
var getSetterSchema = function(name, setters, defaults) {
var values,
schema = setters[name];
if (defaults.hasOwnProperty(name)) {
schema.default = defaults[name];
}
schema.type = 'string';
if (schema.setterType === 'const') {
values = Object.keys(schema.setterFn);
schema.isEnum = true;
schema.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
schema.default = values[0] === 'true' ? false : true;
}
if (isBoolean(schema.default)) {
schema.type = 'boolean';
}
}
}
return schema;
};
return {
getSetterSchema: getSetterSchema
};
});
+19
Ver Arquivo
@@ -0,0 +1,19 @@
/* globals define*/
define({
getDisplayTime: timestamp => {
var today = new Date().toLocaleDateString(),
date = new Date(timestamp).toLocaleDateString();
if (date === today) {
date = `Today (${new Date(timestamp).toLocaleTimeString()})`;
}
return date;
},
ClassForJobStatus: {
success: 'success',
canceled: 'job-canceled',
failed: 'danger',
pending: '',
running: 'warning'
}
});
@@ -1,10 +1,6 @@
/*globals define, _*/
/*jshint browser: true, camelcase: false*/
/**
* @author brollb / https://github.com/brollb
*/
define([
'decorators/EllipseDecorator/EasyDAG/EllipseDecorator.EasyDAGWidget',
'css!./JobDecorator.EasyDAGWidget.css'
@@ -20,6 +16,7 @@ define([
pending: '#9e9e9e',
queued: '#cfd8dc',
running: '#fff59d',
canceled: '#ffcc80',
success: '#66bb6a',
fail: '#e57373'
};
@@ -35,6 +32,8 @@ define([
status: true,
execFiles: true,
stdout: true,
secret: true,
jobId: true,
debug: true
};
EllipseDecorator.call(this, options);
@@ -0,0 +1,110 @@
/*globals define, _, WebGMEGlobal*/
/*jshint browser: true, camelcase: false*/
define([
'decorators/EllipseDecorator/EasyDAG/EllipseDecorator.EasyDAGWidget',
'deepforge/Constants',
'./LayerField'
], function (
EllipseDecorator,
Constants,
LayerField
) {
'use strict';
var LayerDecorator,
DECORATOR_ID = 'LayerDecorator';
// Layer nodes need to be able to...
// - show their ports
// - highlight ports
// - unhighlight ports
// - report the location of specific ports
LayerDecorator = function (options) {
options.skipAttributes = {name: true};
options.skipAttributes[Constants.CTOR_ARGS_ATTR] = true;
EllipseDecorator.call(this, options);
};
_.extend(LayerDecorator.prototype, EllipseDecorator.prototype);
LayerDecorator.prototype.DECORATOR_ID = DECORATOR_ID;
LayerDecorator.prototype.PointerField = LayerField;
LayerDecorator.prototype.getDisplayName = function() {
return this._node.name;
};
// Create the pointer fields and change the event handlers
LayerDecorator.prototype.createPointerFields = function() {
var i = this.fields.length,
y,
ptr;
// Get the fields
y = EllipseDecorator.prototype.createPointerFields.apply(this, arguments);
while (i < this.fields.length) {
// Update the event handlers
ptr = this.fields[i].name;
// TODO: This should be changed in EasyDAG
this.fields[i].selectTarget = this.getValidNestedLayers.bind(this, ptr);
i++;
}
return y;
};
LayerDecorator.prototype.getValidNestedLayers = function(ptr) {
var tgtId = this._node.pointers[ptr];
if (tgtId) {
WebGMEGlobal.State.registerActiveObject(tgtId);
} else {
this.createLayerArg(ptr);
}
};
LayerDecorator.prototype.createLayerArg = function(ptr) {
// Find the Architecture node type
var metanodes = this.client.getAllMetaNodes(),
base = metanodes.find(node => node.getAttribute('name') === 'Architecture'),
baseId,
msg = `Creating layers for "${ptr}" of ${this._node.name}`,
tgtId;
if (!base) {
return this.logger.error('Could not find "Architecture" type!');
}
// Create a nested "architecture" node and set the ptr target to it
baseId = base.getId();
this.client.startTransaction(msg);
tgtId = this.client.createChild({
parentId: this._node.id,
baseId: baseId
});
this.client.setAttributes(tgtId, 'name', `${ptr} (${this._node.name})`);
this.savePointer(ptr, tgtId);
this.client.completeTransaction();
WebGMEGlobal.State.registerActiveObject(tgtId);
};
LayerDecorator.prototype.savePointer = function(ptr, to) {
if (!to) { // delete the current target
var currentId = this._node.pointers[ptr],
name = this._node.name;
// If the target is contained in the current node, delete it!
if (currentId.indexOf(this._node.id) === 0) {
this.client.startTransaction(`Removing layer for ${ptr} of ${name}`);
this.client.delMoreNodes([currentId]);
this.client.completeTransaction();
this.logger.info(`Removed ${ptr} and deleted target (${currentId})`);
} else {
this.logger.info(`Removed ${ptr} (external architecture)`);
}
} else { // create and set the node
EllipseDecorator.prototype.savePointer.apply(this, arguments);
}
};
return LayerDecorator;
});
@@ -0,0 +1,29 @@
/* globals define, _ */
define([
'decorators/EllipseDecorator/EasyDAG/PointerField'
], function(
PointerField
) {
// The LayerField behaves the same as PointerFields but it shows "click to view"
// if it has a value
var LayerField = function() {
PointerField.apply(this, arguments);
};
_.extend(LayerField.prototype, PointerField.prototype);
LayerField.prototype.getContent = function(content) {
return content && 'click to view';
};
LayerField.prototype.createContent = function(w, y, content) {
PointerField.prototype.createContent.call(this, w, y, this.getContent(content));
this.$content.attr('font-style', 'italic');
};
LayerField.prototype.setValue = function(content) {
PointerField.prototype.setValue.call(this, this.getContent(content));
};
return LayerField;
});
@@ -0,0 +1,39 @@
/*globals define, _*/
/*jshint browser: true, camelcase: false*/
define([
'js/Decorators/DecoratorBase',
'./EasyDAG/LayerDecorator.EasyDAGWidget'
], function (
DecoratorBase,
LayerDecoratorEasyDAGWidget
) {
'use strict';
var LayerDecorator,
__parent__ = DecoratorBase,
__parent_proto__ = DecoratorBase.prototype,
DECORATOR_ID = 'LayerDecorator';
LayerDecorator = function (params) {
var opts = _.extend({loggerName: this.DECORATORID}, params);
__parent__.apply(this, [opts]);
this.logger.debug('LayerDecorator ctor');
};
_.extend(LayerDecorator.prototype, __parent_proto__);
LayerDecorator.prototype.DECORATORID = DECORATOR_ID;
/*********************** OVERRIDE DecoratorBase MEMBERS **************************/
LayerDecorator.prototype.initializeSupportedWidgetMap = function () {
this.supportedWidgetMap = {
EasyDAG: LayerDecoratorEasyDAGWidget
};
};
return LayerDecorator;
});
+36 -7
Ver Arquivo
@@ -79,7 +79,11 @@ define([
};
CreateExecution.prototype.createExecution = function (node) {
var name = this.core.getAttribute(node, 'name');
// Get the user supplied name
var name = this.core.getAttribute(node, 'name'),
config = this.getCurrentConfig(),
basename = config.name || (name + '_execution');
// Given a pipeline, copy all the operations to a custom job
// - Copy the operations
@@ -95,39 +99,52 @@ define([
return this.getExecutionDir()
.then(execDir => {
var execDirId = this.core.getPath(execDir),
execTypeId = this.core.getPath(this.META.Execution);
this.logger.debug(`Creating execution node in ${execDirId} (type is ${execTypeId})`);
tgtNode = this.core.createNode({
base: this.META.Execution,
parent: execDir
});
// Get a unique name
return this.getUniqueExecName(name + '_execution');
this.logger.debug(`About to get a unique name starting w/ ${basename}`);
return this.getUniqueExecName(basename);
})
.then(execName => {
var isSnapshot = !this.getCurrentConfig().debug;
var isSnapshot = !this.getCurrentConfig().debug,
originName = this.core.getAttribute(this.activeNode, 'name'),
oId = this.core.getPath(this.activeNode),
tgtId = this.core.getPath(tgtNode);
this.logger.debug(`Creating execution ${execName}`);
this.logger.debug(`Configuring execution attributes (${execName})`);
// Set all the metadata for the new execution
this.core.setAttribute(tgtNode, 'name', execName);
this.core.setAttribute(tgtNode, 'snapshot', isSnapshot);
this.core.setAttribute(tgtNode, 'tagname', execName);
this.core.setAttribute(tgtNode, 'createdAt', Date.now());
this.logger.debug(`Setting origin pipeline to ${originName} (${oId})`);
this.core.setPointer(tgtNode, 'origin', this.activeNode);
this.logger.debug(`Adding ${tgtId} to execution list of ${originName} (${oId})`);
this.core.addMember(this.activeNode, 'executions', tgtNode);
this.logger.debug(`Creating tag "${execName}"`);
return this.project.createTag(
execName.replace(/[ -]/g, '_'),
execName,
this.currentHash
);
})
.then(() => this.core.loadChildren(node))
.then(children => {
var execName = this.core.getAttribute(tgtNode, 'name');
if (!children.length) {
this.logger.warn('No children in pipeline. Will proceed anyway');
}
this.logger.debug(`Copying operations to "${execName}"`);
return this.copyOperations(children, tgtNode);
})
.then(copiedPairs => {
@@ -138,6 +155,7 @@ define([
.filter(pair => this.core.isTypeOf(pair[0], this.META.Operation));
// Create a mapping of old names to new names
this.logger.debug('Creating mapping of old->new');
return Q.all(opTuples.map(pair =>
// Add the input/output mappings to the dataMapping
this.addDataToMap(originals[pair[1]], pair[0], dataMapping)
@@ -145,22 +163,29 @@ define([
);
})
.then(() => { // datamapping is set!
this.logger.debug('Updating references...');
this.updateReferences(copies, dataMapping);
this.logger.debug('Placing operations in Job containers');
this.boxOperations(opTuples.map(o => o[0]), tgtNode);
this.logger.debug('Finished! Saving...');
return this.save(`Created execution from ${name}`);
})
.then(() => tgtNode); // return tgtNode
};
CreateExecution.prototype.getUniqueExecName = function (basename) {
var name = basename,
taken = {},
var taken = {},
name,
i = 2;
basename = basename.replace(/[^\da-zA-Z_]/g, '_');
name = basename;
// Get a unique name wrt the tags and the other executions
return this.project.getTags()
.then(tags => {
Object.keys(tags).forEach(name => taken[name] = true);
this.logger.debug(`Existing tags are ${Object.keys(tags).join(',')}`);
// Get the other executions
return this.getExecutionDir();
@@ -171,11 +196,13 @@ define([
})
.then(execs => {
var names = execs.map(exec => this.core.getAttribute(exec, 'name'));
this.logger.debug(`Existing names are ${names.join(',')}`);
names.forEach(name => taken[name] = true);
while (taken[name]) {
name = basename + '_' + (i++);
}
this.logger.debug(`Unique name is "${name}"`);
return name;
});
};
@@ -184,6 +211,7 @@ define([
var snapshot = !this.getCurrentConfig().debug;
if (snapshot) {
this.logger.debug('Execution is a snapshot -> severing the inheritance');
return Q.all(nodes.map(node => {
if (this.isLocalOperation(node) ||
this.isMetaTypeOf(node, this.META.Transporter)) {
@@ -198,6 +226,7 @@ define([
);
} else if (nodes.length) {
this.logger.debug('Execution is not a snapshot -> doing a simple copy');
var copies = this.core.copyNodes(nodes, dst);
return nodes.map((node, i) => [node, copies[i]]);
}
+150 -144
Ver Arquivo
@@ -4,18 +4,22 @@
define([
'plugin/PluginBase',
'common/util/guid',
'deepforge/Constants',
'deepforge/utils',
'js/RegistryKeys',
'js/Panels/MetaEditor/MetaEditorConstants',
'underscore',
'text!deepforge/layers.json',
'./schemas/index',
'text!./metadata.json'
], function (
PluginBase,
generateGuid,
Constants,
utils,
REGISTRY_KEYS,
META_CONSTANTS,
_,
DEFAULT_LAYERS,
Schemas,
metadata
) {
'use strict';
@@ -51,110 +55,102 @@ define([
* @param {function(string, plugin.PluginResult)} callback - the result callback
*/
CreateTorchMeta.prototype.main = function (callback) {
// Use self to access core, project, result, logger etc from PluginBase.
// These are all instantiated at this point.
var self = this;
if (!this.META.Language) {
return callback('"Language" container required to run plugin', this.result);
}
// Extra layer names
this.getJsonLayers((err, text) => {
if (err) {
return callback(err, this.result);
// The format is...
// - (Abstract) CategoryLayerTypes
// - LayerName
// - Attributes (if exists)
var layers,
content = {},
categories,
config = this.getCurrentConfig(),
nodes = {};
try {
layers = this.getJsonLayers();
} catch (e) {
return callback('JSON parse error: ' + e, this.result);
}
layers.forEach(layer => {
if (!content[layer.type]) {
content[layer.type] = [];
}
// The format is...
// - (Abstract) CategoryLayerTypes
// - LayerName
// - Attributes (if exists)
var content = {},
categories,
config = this.getCurrentConfig(),
nodes = {},
layers;
try {
layers = JSON.parse(text);
} catch (e) {
return callback('JSON parse error: ' + e, this.result);
}
layers.forEach(layer => {
if (!content[layer.type]) {
content[layer.type] = [];
}
content[layer.type].push(layer);
});
categories = Object.keys(content);
// Create the base class, if needed
if (!this.META.Layer) {
this.META.Layer = this.createMetaNode('Layer', this.META.FCO);
}
// Create the category nodes
categories
.forEach(name => {
// Create a tab for each
this.metaSheets[name] = this.createMetaSheetTab(name);
this.sheetCounts[name] = 0;
nodes[name] = this.createMetaNode(name, this.META.Layer, name);
});
// Make them abstract
categories
.forEach(name => this.core.setRegistry(nodes[name], 'isAbstract', true));
if (config.removeOldLayers) {
var isNewLayer = {},
newLayers = layers.map(layer => layer.name),
oldLayers,
oldNames;
newLayers = newLayers.concat(categories); // add the category nodes
newLayers.forEach(name => isNewLayer[name] = true);
// Set the newLayer nodes 'base' to 'Layer' so we don't accidentally
// delete them
newLayers
.map(name => this.META[name])
.filter(layer => !!layer)
.forEach(layer => this.core.setBase(layer, this.META.Layer));
oldLayers = Object.keys(this.META)
.filter(name => name !== 'Layer')
.map(name => this.META[name])
.filter(node => this.isMetaTypeOf(node, this.META.Layer))
.filter(node => !isNewLayer[this.core.getAttribute(node, 'name')]);
oldNames = oldLayers.map(l => this.core.getAttribute(l, 'name'));
// Get the old layer names
this.logger.debug(`Removing layers: ${oldNames.join(', ')}`);
oldLayers.forEach(layer => this.core.deleteNode(layer));
}
// Create the actual nodes
categories.forEach(cat => {
content[cat]
.forEach(layer => {
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);
});
});
self.save('CreateTorchMeta updated model.', function (err) {
if (err) {
callback(err, self.result);
return;
}
self.result.setSuccess(true);
callback(null, self.result);
});
content[layer.type].push(layer);
});
categories = Object.keys(content);
// Create the base class, if needed
if (!this.META.Layer) {
this.META.Layer = this.createMetaNode('Layer', this.META.FCO);
}
// Create the category nodes
categories
.forEach(name => {
// Create a tab for each
this.metaSheets[name] = this.createMetaSheetTab(name);
this.sheetCounts[name] = 0;
nodes[name] = this.createMetaNode(name, this.META.Layer, name);
});
// Make them abstract
categories
.forEach(name => this.core.setRegistry(nodes[name], 'isAbstract', true));
if (config.removeOldLayers) {
var isNewLayer = {},
newLayers = layers.map(layer => layer.name),
oldLayers,
oldNames;
newLayers = newLayers.concat(categories); // add the category nodes
newLayers.forEach(name => isNewLayer[name] = true);
// Set the newLayer nodes 'base' to 'Layer' so we don't accidentally
// delete them
newLayers
.map(name => this.META[name])
.filter(layer => !!layer)
.forEach(layer => this.core.setBase(layer, this.META.Layer));
oldLayers = Object.keys(this.META)
.filter(name => name !== 'Layer')
.map(name => this.META[name])
.filter(node => this.isMetaTypeOf(node, this.META.Layer))
.filter(node => !isNewLayer[this.core.getAttribute(node, 'name')]);
oldNames = oldLayers.map(l => this.core.getAttribute(l, 'name'));
// Get the old layer names
this.logger.debug(`Removing layers: ${oldNames.join(', ')}`);
oldLayers.forEach(layer => this.core.deleteNode(layer));
}
// Create the actual nodes
categories.forEach(cat => {
content[cat]
.forEach(layer => {
var name = layer.name,
node;
node = this.createMetaNode(name, nodes[cat], cat, layer);
// Make the node non-abstract
if (node) {
this.core.setRegistry(node, 'isAbstract', false);
nodes[name] = node;
}
});
});
this.save('CreateTorchMeta updated model.')
.then(() => {
this.result.setSuccess(true);
callback(null, this.result);
})
.fail(err => callback(err, this.result));
};
CreateTorchMeta.prototype.removeFromMeta = function (nodeId) {
@@ -196,26 +192,27 @@ define([
return sheet.SetID;
};
CreateTorchMeta.prototype.getJsonLayers = function (callback) {
var config = this.getCurrentConfig();
CreateTorchMeta.prototype.getJsonLayers = function () {
var config = this.getCurrentConfig(),
schema = config.layerSchema;
if (config.layerNameHash) {
this.blobClient.getObject(config.layerNameHash, (err, buffer) => {
if (err) {
return callback(err, this.result);
}
var text = String.fromCharCode.apply(null, new Uint8Array(buffer));
return callback(null, text);
});
} else {
return callback(null, DEFAULT_LAYERS);
if (schema === 'all') {
return Object.keys(Schemas).map(key => JSON.parse(Schemas[key]))
.reduce((l1, l2) => l1.concat(l2), []);
}
return JSON.parse(Schemas[schema]);
};
var isBoolean = txt => {
return typeof txt === 'boolean' || (txt === 'false' || txt === 'true');
// Some helper methods w/ attribute handling
var LUA_TO_GME = {
boolean: 'boolean',
number: 'float',
string: 'string'
};
var isLayerAttribute = type => type && type.substring(0, 3) === 'nn.';
CreateTorchMeta.prototype.createMetaNode = function (name, base, tabName, layer) {
var node = this.META[name],
nodeId = node && this.core.getPath(node),
@@ -223,6 +220,8 @@ define([
position = this.getPositionFor(name, tabName),
setters = {},
defaults = {},
types = {},
type,
attrs,
desc;
@@ -230,6 +229,7 @@ define([
attrs = layer.params;
setters = layer.setters;
defaults = layer.defaults;
types = layer.types || types;
}
if (!tabId) {
this.logger.error(`No meta sheet for ${tabName}`);
@@ -273,15 +273,15 @@ define([
// Remove attributes not in the given list
var currentAttrs = this.core.getValidAttributeNames(node),
defVal,
rmAttrs;
rmAttrs,
simpleAttrs,
rmPtrs;
rmAttrs = _.difference(currentAttrs, attrs) // old attribute names
simpleAttrs = attrs.filter(name => !isLayerAttribute(types[name]));
rmAttrs = _.difference(currentAttrs, simpleAttrs) // old attribute names
.filter(attr => attr !== 'name')
.filter(attr => !setters[attr]);
if (rmAttrs.length) {
this.logger.debug(`Removing ${rmAttrs.join(', ')} from ${name}`);
}
rmAttrs.forEach(attr => {
this.core.delAttributeMeta(node, attr);
if (this.core.getOwnAttribute(node, attr) !== undefined) {
@@ -289,35 +289,37 @@ define([
}
});
attrs.forEach((name, index) => {
// Remove all old pointers
rmPtrs = _.difference(this.core.getPointerNames(node), currentAttrs)
.filter(ptr => ptr !== 'base');
if (rmPtrs.length + rmAttrs.length) {
this.logger.debug(`Removing ${rmPtrs.concat(rmAttrs).join(', ')} from ${name}`);
}
rmPtrs.forEach(ptr => this.core.delPointerMeta(node, ptr));
attrs.forEach(name => {
desc = {};
desc.argindex = index;
defVal = defaults.hasOwnProperty(name) ? defaults[name] : '';
this.addAttribute(name, node, desc, defVal);
type = LUA_TO_GME[types[name]];
if (type) {
desc.type = type;
}
if (isLayerAttribute(types[name])) { // Check if it is an nn layer type
// If so, create a pointer rather than attribute
this.addLayerAttribute(name, node);
this.logger.debug(`${name} is a layer type attribute`);
} else {
this.addAttribute(name, node, desc, defVal);
}
});
this.core.setAttribute(node, Constants.CTOR_ARGS_ATTR, attrs.join(','));
// 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';
}
}
}
desc = utils.getSetterSchema(name, setters, defaults);
defVal = desc.default;
delete desc.default;
this.addAttribute(name, node, desc, defVal);
});
}
@@ -353,6 +355,13 @@ define([
};
};
CreateTorchMeta.prototype.addLayerAttribute = function (name, node) {
// No default value support for now...
// Create a pointer of the given type on the node
this.core.setPointerMetaTarget(node, name, this.META.Architecture, 1, 1);
this.core.setPointerMetaLimits(node, name, 1, 1);
};
CreateTorchMeta.prototype.addAttribute = function (name, node, schema, defVal) {
schema.type = schema.type || 'string';
if (schema.type === 'list') { // FIXME: add support for lists
@@ -368,9 +377,6 @@ define([
schema.max = +schema.max;
}
// Add the argindex flag
schema.argindex = schema.argindex;
// Create the attribute and set the schema
this.core.setAttributeMeta(node, name, schema);
+23 -18
Ver Arquivo
@@ -7,24 +7,29 @@
"src": "",
"class": "glyphicon glyphicon-ok-circle"
},
"disableServerSideExecution": false,
"disableServerSideExecution": true,
"disableBrowserSideExecution": false,
"configStructure": [
{
"name": "layerNameHash",
"displayName": "Torch Layers",
"description": "Yaml file of torch layer descriptors (optional)",
"value": "",
"valueType": "asset",
"readOnly": false
},
{
"name": "removeOldLayers",
"displayName": "Delete old layers",
"description": "Delete all layers not in the current description",
"value": true,
"valueType": "boolean",
"readOnly": false
}
{
"name": "layerSchema",
"displayName": "Torch Libraries",
"description": "Torch nn libraries to create layers from",
"value": "all",
"valueItems": [
"nn",
"rnn",
"all"
],
"valueType": "string",
"readOnly": false
},
{
"name": "removeOldLayers",
"displayName": "Delete old layers",
"description": "Delete all layers not in the current description",
"value": true,
"valueType": "boolean",
"readOnly": false
}
]
}
}
+13
Ver Arquivo
@@ -0,0 +1,13 @@
/*globals define*/
define([
'text!./nn.json',
'text!./rnn.json'
], function(
nn,
rnn
) {
return {
nn: nn,
rnn: rnn
};
});
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+178
Ver Arquivo
@@ -0,0 +1,178 @@
[
{
"name": "CopyGrad",
"baseType": "Identity",
"setters": {},
"defaults": {},
"type": "RNN"
},
{
"name": "FastLSTM",
"baseType": "LSTM",
"params": [
"inputSize",
"outputSize",
"rho",
"eps",
"momentum",
"affine"
],
"setters": {},
"types": {
"eps": "number",
"momentum": "number"
},
"defaults": {
"momentum": 0.1,
"eps": 0.1
},
"type": "RNN"
},
{
"name": "LSTM",
"baseType": "AbstractRecurrent",
"params": [
"inputSize",
"outputSize",
"rho",
"cell2gate"
],
"setters": {},
"types": {
"rho": "number"
},
"defaults": {
"rho": 9999
},
"type": "RNN"
},
{
"name": "LinearNoBias",
"baseType": "Linear",
"params": [
"inputSize",
"outputSize"
],
"setters": {},
"types": {},
"defaults": {},
"type": "Simple"
},
{
"name": "LookupTableMaskZero",
"baseType": "LookupTable",
"params": [
"nIndex",
"nOutput"
],
"setters": {},
"types": {},
"defaults": {},
"type": "RNN"
},
{
"name": "NormStabilizer",
"baseType": "AbstractRecurrent",
"params": [
"beta"
],
"setters": {},
"defaults": {},
"type": "RNN"
},
{
"name": "Recurrent",
"baseType": "AbstractRecurrent",
"params": [
"start",
"input",
"feedback",
"transfer",
"rho",
"merge"
],
"setters": {},
"types": {
"start": "nn.Module",
"transfer": "nn.Module",
"feedback": "nn.Module",
"input": "nn.Module"
},
"defaults": {},
"type": "RNN"
},
{
"name": "SAdd",
"baseType": "Module",
"params": [
"addend",
"negate"
],
"setters": {},
"types": {},
"defaults": {},
"type": "RNN"
},
{
"name": "SeqBRNN",
"baseType": "Container",
"params": [
"inputDim",
"hiddenDim",
"batchFirst"
],
"setters": {},
"types": {},
"defaults": {},
"type": "RNN"
},
{
"name": "SeqGRU",
"baseType": "Module",
"params": [
"inputSize",
"outputSize"
],
"setters": {},
"types": {},
"defaults": {},
"type": "RNN"
},
{
"name": "SeqLSTM",
"baseType": "Module",
"params": [
"inputsize",
"hiddensize",
"outputsize"
],
"setters": {},
"types": {},
"defaults": {},
"type": "RNN"
},
{
"name": "SeqLSTMP",
"baseType": "SeqLSTM",
"params": [
"inputsize",
"hiddensize",
"outputsize"
],
"setters": {},
"types": {},
"defaults": {},
"type": "RNN"
},
{
"name": "SeqReverseSequence",
"baseType": "Module",
"params": [
"dim"
],
"setters": {},
"types": {},
"defaults": {},
"type": "RNN"
}
]
@@ -0,0 +1,37 @@
/* eslint-disable no-console */
// Update the metadata and schemas/index based on the new schemas in schemas/
// Update metadata
var fs = require('fs'),
path = require('path'),
schemas,
metadata = require('./metadata.json'),
schemaList;
schemas = fs.readdirSync(__dirname + '/schemas/')
.filter(name => path.extname(name) === '.json')
.map(name => name.replace(/\.json$/, ''));
console.log('Discovered schemas: ' + schemas.join(', '));
schemaList = metadata.configStructure.find(struct => struct.name === 'layerSchema');
schemaList.valueItems = schemas.concat('all');
console.log('Updating metadata...');
fs.writeFileSync(__dirname + '/metadata.json', JSON.stringify(metadata, null, 2));
// Update index.js
var index =
`/*globals define*/
define([
${schemas.map(s => `'text!./${s}.json'`).join(',\n ')}
], function(
${schemas.map(s => s).join(',\n ')}
) {
return {
${schemas.map(s => s + ': ' + s).join(',\n ')}
};
});`;
console.log('Updating index.js...');
fs.writeFileSync(__dirname + '/schemas/index.js', index);
+168 -43
Ver Arquivo
@@ -2,6 +2,7 @@
/*jshint node:true, browser:true*/
define([
'common/storage/constants',
'text!./metadata.json',
'executor/ExecutorClient',
'plugin/PluginBase',
@@ -12,6 +13,7 @@ define([
'q',
'underscore'
], function (
STORAGE_CONSTANTS,
pluginMetadata,
ExecutorClient,
PluginBase,
@@ -46,6 +48,7 @@ define([
this._markForDeletion = {}; // id -> node
this._oldMetadataByName = {}; // name -> id
this.lastAppliedCmd = {};
this.canceled = false;
};
/**
@@ -79,10 +82,43 @@ define([
}
this._callback = callback;
this.currentForkName = null;
this.prepare()
.then(() => this.executeJob(this.activeNode));
};
ExecuteJob.prototype.updateForkName = function (basename) {
basename = basename + '_fork';
basename = basename.replace(/[- ]/g, '_');
return this.project.getBranches().then(branches => {
var names = Object.keys(branches),
name = basename,
i = 2;
while (names.indexOf(name) !== -1) {
name = basename + '_' + i;
i++;
}
this.forkName = name;
});
};
// Override 'save' to notify the user on fork
ExecuteJob.prototype.save = function (msg) {
var name = this.core.getAttribute(this.activeNode, 'name');
return this.updateForkName(name)
.then(() => PluginBase.prototype.save.call(this, msg))
.then(result => {
var msg;
if (result.status === STORAGE_CONSTANTS.FORKED) {
msg = `"${name}" execution has forked to "${result.forkName}"`;
this.currentForkName = result.forkName;
this.sendNotification(msg);
}
});
};
ExecuteJob.prototype.getConnections = function (nodes) {
var conns = [];
for (var i = nodes.length; i--;) {
@@ -177,6 +213,24 @@ define([
}
delete this.lastAppliedCmd[nodeId];
delete this._markForDeletion[nodeId];
this.core.delAttribute(job, 'jobId');
this.core.delAttribute(job, 'secret');
};
ExecuteJob.prototype.resultMsg = function(msg) {
this.sendNotification(msg);
this.createMessage(null, msg);
};
ExecuteJob.prototype.onOperationCanceled = function(op) {
var job = this.core.getParent(op),
name = this.core.getAttribute(op, 'name'),
msg = `"${name}" canceled!`;
this.core.setAttribute(job, 'status', 'canceled');
this.resultMsg(msg);
this.onComplete(op, null);
};
ExecuteJob.prototype.onOperationFail =
@@ -186,8 +240,8 @@ define([
exec = this.core.getParent(job),
name = this.core.getAttribute(job, 'name'),
jobId = this.core.getPath(job),
status = err ? 'fail' : 'success',
msg = err ? `${name} execution failed: ${err}` :
status = err ? 'fail' : (this.canceled ? 'canceled' : 'success'),
msg = err ? `${name} execution failed!` :
`${name} executed successfully!`,
promise = Q();
@@ -195,8 +249,16 @@ define([
this.logger.info(`Setting ${name} (${jobId}) status to ${status}`);
this.clearOldMetadata(job);
if (this.currentForkName) {
// notify client that the job has completed
this.sendNotification(`"${name}" execution completed on branch "${this.currentForkName}"`);
}
if (err) {
this.logger.warn(`${name} failed: ${err}`);
this.core.setAttribute(exec, 'status', 'failed');
} else if (this.canceled) {
// Should I set this to 'canceled'?
this.core.setAttribute(exec, 'status', 'canceled');
} else {
// Check if all the other jobs are successful. If so, set the
// execution status to 'success'
@@ -222,6 +284,7 @@ define([
});
}
this.createMessage(null, msg);
promise
.then(() => this.save(msg))
.then(() => {
@@ -239,6 +302,24 @@ define([
children.find(child => this.isMetaTypeOf(child, this.META.Operation)));
};
ExecuteJob.prototype.onBlobRetrievalFail = function (node, input, err) {
var job = this.core.getParent(node),
e = `Failed to retrieve "${input}" (${err})`,
consoleErr = `Failed to execute operation: ${e}`;
consoleErr += [
'\n\nA couple things to check out:\n',
'- Has the location of DeepForge\'s blob changed?',
' (Configurable using "blob.dir" in the deepforge config' +
' or setting the DEEPFORGE_BLOB_DIR environment variable)\n',
'- Was this project created using a different blob location?'
].join('\n ');
this.core.setAttribute(job, 'stdout', consoleErr);
this.onOperationFail(node, `Blob retrieval failed for "${name}": ${e}`);
};
ExecuteJob.prototype.executeJob = function (job) {
return this.getOperation(job).then(node => {
var jobId = this.core.getPath(job),
@@ -272,37 +353,46 @@ define([
var hash = files.inputAssets[input];
// data asset for "input"
return this.blobClient.getMetadata(hash);
return this.blobClient.getMetadata(hash)
.fail(err => this.onBlobRetrievalFail(job, input, err));
})
);
})
.then(mds => {
// get (input, filename) tuples
// Record the large files
var inputData = {};
mds.forEach((metadata, i) => {
// add the hashes for each input
var input = inputs[i],
name = metadata.name,
hash = files.inputAssets[input];
data['inputs/' + input + '/' + name] = hash;
inputData['inputs/' + input + '/data'] = {
req: hash,
cache: metadata.content
};
});
delete files.inputAssets;
files['input-data.json'] = JSON.stringify(inputData, null, 2);
// Add pointer assets
Object.keys(files.ptrAssets)
.forEach(path => data[path] = files.ptrAssets[path]);
delete files.ptrAssets;
// Add the executor config
return this.getOutputs(node);
})
.then(outputArgs => {
var config,
outputs,
fileList,
ptrFiles = Object.keys(files.ptrAssets),
file;
files['start.js'] = _.template(Templates.START)(CONSTANTS);
delete files.ptrAssets;
fileList = Object.keys(files).concat(ptrFiles);
outputs = outputArgs.map(pair => pair[0])
.map(name => {
return {
@@ -318,7 +408,7 @@ define([
},
{
name: name + '-all-files',
resultPatterns: []
resultPatterns: fileList
}
);
@@ -329,7 +419,6 @@ define([
resultArtifacts: outputs
};
files['executor_config.json'] = JSON.stringify(config, null, 4);
files['start.js'] = _.template(Templates.START)(CONSTANTS);
// Save the artifact
// Remove empty hashes
@@ -382,7 +471,13 @@ define([
this.logger.debug(`Making a commit from ${this.currentHash}`);
this.save(`Queued "${name}" operation in ${this.pipelineName}`)
.then(() => executor.createJob({hash}))
.then(() => this.watchOperation(executor, hash, opNode, job))
.then(info => {
this.core.setAttribute(job, 'jobId', info.hash);
if (info.secret) { // o.w. it is a cached job!
this.core.setAttribute(job, 'secret', info.secret);
}
return this.watchOperation(executor, hash, opNode, job);
})
.catch(err => this.logger.error(`Could not execute "${name}": ${err}`));
};
@@ -570,12 +665,18 @@ define([
})
.then(_tplContents => {
tplContents = _tplContents;
var hashes = inputs
// storing the hash for now...
.map(pair =>
files.inputAssets[pair[0]] = this.core.getAttribute(pair[2], 'data')
);
return Q.all(hashes.map(h => this.blobClient.getMetadata(h)));
var hashes = inputs.map(pair => {
var hash = this.core.getAttribute(pair[2], 'data');
files.inputAssets[pair[0]] = hash;
return {
hash: hash,
name: pair[0]
};
});
return Q.all(hashes.map(pair =>
this.blobClient.getMetadata(pair.hash)
.fail(err => this.onBlobRetrievalFail(node, pair.name, err))));
})
.then(metadatas => {
// Create the deserializer
@@ -703,7 +804,19 @@ define([
var jobId = this.core.getPath(job),
opId = this.core.getPath(op),
info,
name;
secret,
name = this.core.getAttribute(job, 'name');
// If canceled, stop the operation
if (this.canceled) {
secret = this.core.getAttribute(job, 'secret');
if (secret) {
executor.cancelJob(hash, secret);
this.core.delAttribute(job, 'secret');
this.canceled = true;
return this.onOperationCanceled(op);
}
}
return executor.getInfo(hash)
.then(_info => { // Update the job's stdout
@@ -717,8 +830,7 @@ define([
return executor.getOutput(hash, currentLine, actualLine+1)
.then(outputLines => {
var stdout = this.core.getAttribute(job, 'stdout'),
output = outputLines.map(o => o.output).join(''),
jobName = this.core.getAttribute(job, 'name');
output = outputLines.map(o => o.output).join('');
// parse deepforge commands
output = this.parseForMetadataCmds(job, output);
@@ -726,7 +838,7 @@ define([
if (output) {
stdout += output;
this.core.setAttribute(job, 'stdout', stdout);
return this.save(`Received stdout for ${jobName}`);
return this.save(`Received stdout for ${name}`);
}
});
}
@@ -736,7 +848,6 @@ define([
if (info.status === 'RUNNING' &&
this.core.getAttribute(job, 'status') !== 'running') {
name = this.core.getAttribute(job, 'name');
this.core.setAttribute(job, 'status', 'running');
this.save(`Started "${name}" operation in ${this.pipelineName}`);
}
@@ -748,26 +859,40 @@ define([
return;
}
name = this.core.getAttribute(job, 'name');
this.core.setAttribute(job, 'execFiles', info.resultHashes[name + '-all-files']);
return this.blobClient.getArtifact(info.resultHashes.stdout)
.then(artifact => {
var stdoutHash = artifact.descriptor.content[STDOUT_FILE].content;
return this.blobClient.getObjectAsString(stdoutHash);
})
.then(stdout => {
// Parse the remaining code
stdout = this.parseForMetadataCmds(job, stdout, true);
this.core.setAttribute(job, 'stdout', stdout);
if (info.status !== 'SUCCESS') {
// Download all files
this.result.addArtifact(info.resultHashes[name + '-all-files']);
// Set the job to failed! Store the error
this.onOperationFail(op, `Operation "${opId}" failed! ${JSON.stringify(info)}`);
} else {
this.onDistOperationComplete(op, info);
}
});
if (info.status === 'CANCELED') {
// If it was cancelled, the pipeline has been stopped
this.logger.debug(`"${name}" has been CANCELED!`);
this.canceled = true;
return this.onOperationCanceled(op);
}
if (info.status === 'SUCCESS' || info.status === 'FAILED_TO_EXECUTE') {
this.core.setAttribute(job, 'execFiles', info.resultHashes[name + '-all-files']);
return this.blobClient.getArtifact(info.resultHashes.stdout)
.then(artifact => {
var stdoutHash = artifact.descriptor.content[STDOUT_FILE].content;
return this.blobClient.getObjectAsString(stdoutHash);
})
.then(stdout => {
// Parse the remaining code
stdout = this.parseForMetadataCmds(job, stdout, true);
this.core.setAttribute(job, 'stdout', stdout);
if (info.status !== 'SUCCESS') {
// Download all files
this.result.addArtifact(info.resultHashes[name + '-all-files']);
// Set the job to failed! Store the error
this.onOperationFail(op, `Operation "${opId}" failed! ${JSON.stringify(info)}`);
} else {
this.onDistOperationComplete(op, info);
}
});
} else { // something bad happened...
var err = `Failed to execute operation "${opId}": ${info.status}`,
consoleErr = `Failed to execute operation: ${info.status}`;
this.core.setAttribute(job, 'stdout', consoleErr);
this.logger.error(err);
this.onOperationFail(op, err);
}
})
.catch(err => this.logger.error(`Could not get op info for ${opId}: ${err}`));
};
@@ -911,7 +1036,7 @@ define([
ExecuteJob.prototype[CONSTANTS.GRAPH_PLOT] = function (job, id, x, y) {
var jobId = this.core.getPath(job),
nonNum = /[^\d]*/g,
nonNum = /[^\d\.]*/g,
graph,
points;
@@ -37,6 +37,7 @@ function _Line:__init(graphId, name, opts)
end
function _Line:add(x, y)
assert(type(x) == "number" and type(y) == "number", "adding point (" .. tostring(x) .. ", " .. tostring(y) .. ") to " .. self.name .. " failed: expected (number, number)")
deepforge._cmd('<%= GRAPH_PLOT %>', self.id, x, y)
end
@@ -1,6 +1,6 @@
require 'paths'
local path = 'inputs/<%= name %>/<%= filename %>'
local abs_path = paths.concat('inputs', '<%= name %>', '<%= filename %>')
local path = 'inputs/<%= name %>/data'
local abs_path = paths.concat('inputs', '<%= name %>', 'data')
<%= code %>
+150 -8
Ver Arquivo
@@ -3,6 +3,7 @@
// - receives some commands and uploads intermediate data
var spawn = require('child_process').spawn,
fs = require('fs'),
path = require('path'),
log = console.error,
logger = {};
@@ -12,14 +13,19 @@ var spawn = require('child_process').spawn,
// Get the BlobClient...
var COMMAND_PREFIX = '<%= START_CMD %>',
IMAGE = '<%= IMAGE %>',
requirejs = require('webgme').requirejs;
requirejs = require('webgme').requirejs,
remainingImageCount = 0,
exitCode = null;
requirejs([
'q',
'blob/BlobClient'
], function(
Q,
BlobClient
) {
var url = process.env.ORIGIN_URL || 'http://127.0.0.1:8888',
CACHE_DIR = process.env.DEEPFORGE_WORKER_CACHE || './worker-cache',
protocol = url.split('://').shift(),
address,
port = (url.split(':') || ['80']).pop();
@@ -27,6 +33,37 @@ requirejs([
address = url.replace(protocol + '://', '')
.replace(':' + port, '');
// Create CACHE_DIR if it doesn't exist
var prepareCache = function() {
var dirs = CACHE_DIR.replace(/\/$/, '').split('/'),
cacheParent;
dirs.pop();
cacheParent = dirs.join('/');
return makeIfNeeded(cacheParent).then(() => makeIfNeeded(CACHE_DIR));
};
var makeIfNeeded = function(dir) {
var deferred = Q.defer(),
job;
log(`makeIfNeeded: ${JSON.stringify(dir)}`);
fs.lstat(dir, (err, stat) => {
if (err || !stat.isDirectory()) {
fs.mkdir(dir, err => {
if (err) {
return deferred.reject(err);
}
deferred.resolve();
});
} else {
deferred.resolve();
}
});
return deferred.promise;
};
var blobClient = new BlobClient({
server: address,
httpsecure: protocol === 'https',
@@ -34,28 +71,47 @@ requirejs([
logger: logger
});
var checkFinished = () => {
if (exitCode !== null && remainingImageCount === 0) {
log('finished!');
process.exit(exitCode);
}
};
var uploadImage = function(line) {
var args = line.split(/\s+/),
name = args.slice(2).join(' ').replace(/\s+$/, ''),
filename = 'metadata/' + name + '.png';
// Upload the image from metadata/
remainingImageCount++;
fs.readFile(filename, (err, content) => {
if (err) {
console.error(`Could not read ${filename}: ${err}`);
logger.error(`Could not read ${filename}: ${err}`);
return;
}
// Add hash to the image command
log('about to putFile', filename);
blobClient.putFile(filename, content)
.then(hash => {
args.splice(2, 0, hash);
console.log(args.join(' '));
log('printing cmd:', args.join(' '));
--remainingImageCount;
log('finished uploading ' + filename + ' ' + remainingImageCount + ' remain');
checkFinished();
})
.fail(err => console.error(`${filename} upload failed: ${err}`));
.fail(err => logger.error(`${filename} upload failed: ${err}`));
});
};
var onStderr = function(data) {
var text = data.toString();
// Filter out directory label from stack traces
process.stdout.write(text.replace(/\.\.\.\/.*\/(main|deepforge|init).lua/g, '$1'));
};
var onStdout = function(data) {
var lines = data.toString().split('\n'),
result = [],
@@ -74,9 +130,95 @@ requirejs([
process.stdout.write(result.join('\n'));
};
// Run 'th init.lua' and merge the stdout, stderr
var job = spawn('th', ['init.lua']);
job.stdout.on('data', onStdout);
job.stderr.on('data', data => process.stdout.write(data));
job.on('close', code => process.exit(code));
var createCacheDir = function(hash) {
var dir = hash.substring(0, 2);
return makeIfNeeded(CACHE_DIR + '/' + dir);
};
var dataCachePath = function(hash) {
var dir = hash.substring(0, 2),
filename = hash.substring(2),
cachePath = `${CACHE_DIR}/${dir}/${filename}`;
// Get the path for data in the cache
return cachePath;
};
var makeSymLink = function(target, src) {
var deferred = Q.defer(),
job;
src = path.resolve(src);
target = path.resolve(target);
fs.stat(src, err => {
if (err.code === 'ENOENT') {
logger.debug(`creating symlink "ln -s ${target} ${src}"`);
job = spawn('ln', ['-s', target, src || '.']);
job.on('exit', code => {
if (code) {
deferred.reject(`Could not create symlink ${target} -> ${src||'.'}`);
return;
}
deferred.resolve();
});
}
deferred.resolve();
});
return deferred.promise;
};
var getData = function(ipath, hashes) {
// Download the data and put it in the given path
var deferred = Q.defer(),
inputName = ipath.split('/')[1],
cachePath = dataCachePath(hashes.cache);
logger.debug(`retrieving ${ipath}`);
fs.lstat(cachePath, (err, cacheStats) => {
// Check if the data exists in the cache
if (!err && cacheStats.isFile()) {
logger.info(`${inputName} already cached. Skipping retrieval from blob`);
return makeSymLink(cachePath, ipath).then(deferred.resolve);
}
createCacheDir(hashes.cache)
.then(() => blobClient.getObject(hashes.req))
.then(buffer => fs.writeFile(cachePath, buffer, (err, result) => {
if (err) {
logger.error('Retrieving ' + ipath + ' failed!');
return deferred.reject(`Could not write to ${ipath}: ${err}`);
}
// Create the symlink
logger.info('Retrieved ' + ipath);
return makeSymLink(cachePath, ipath).then(deferred.resolve);
}))
.fail(err => deferred.reject(`Could not retrieve "${inputName}" (${err})`));
});
return deferred.promise;
};
// Download the large files
var inputData = JSON.parse(fs.readFileSync('./input-data.json')),
inputPaths = Object.keys(inputData);
// Request the data from the blob
prepareCache()
.then(() => Q.all(inputPaths.map(ipath => getData(ipath, inputData[ipath]))))
.then(() => {
// Run 'th init.lua' and merge the stdout, stderr
var job = spawn('th', ['init.lua']);
job.stdout.on('data', onStdout);
job.stderr.on('data', onStderr);
job.on('close', code => {
exitCode = code;
log('script finished w/ exit code:', code);
checkFinished();
});
})
.fail(err => {
console.log(`Data retrieval failed: ${err}`);
process.exit(1);
});
});
+39 -22
Ver Arquivo
@@ -74,6 +74,7 @@ define([
// - keep track if the pipeline has errored
// - if so, don't start any more jobs
this.pipelineError = null;
this.canceled = false;
this.runningJobs = 0;
// metadata records
@@ -103,15 +104,18 @@ define([
// If starting with a pipeline, we will create an Execution first
startPromise = this.createExecution(this.activeNode)
.then(execNode => {
this.logger.debug(`Finished creating execution "${this.core.getAttribute(execNode, 'name')}"`);
this.activeNode = execNode;
});
} else if (this.core.isTypeOf(this.activeNode, this.META.Execution)) {
this.logger.debug('Restarting execution');
startPromise = Q();
} else {
return callback('Current node is not a Pipeline or Execution!', this.result);
}
this._callback = callback;
this.currentForkName = null;
startPromise
.then(() => this.core.loadSubTree(this.activeNode))
@@ -120,41 +124,29 @@ define([
.filter(n => this.core.getParent(n) === this.activeNode);
this.pipelineName = this.core.getAttribute(this.activeNode, 'name');
this.logger.debug(`Loaded subtree of ${this.pipelineName}. About to build cache`);
this.buildCache(subtree);
this.logger.debug('Parsing execution for job inter-dependencies');
this.parsePipeline(children); // record deps, etc
this.logger.debug('Clearing old results');
return this.clearResults();
})
.then(() => this.executePipeline())
.fail(e => this.logger.error(e));
};
ExecutePipeline.prototype.updateForkName = function () {
var basename = this.pipelineName + '_fork';
return this.project.getBranches().then(branches => {
var names = Object.keys(branches),
name = basename,
i = 2;
while (names.indexOf(name) !== -1) {
name = basename + '_' + i;
i++;
}
this.forkName = name;
});
};
// Override 'save' to prevent race conditions while saving
ExecutePipeline.prototype.save = function (msg) {
// When 'save' is called, it should still finish any current save op
// before continuing
this._currentSave = this._currentSave
.then(() => this.updateForkName())
.then(() => this.updateForkName(this.pipelineName))
.then(() => CreateExecution.prototype.save.call(this, msg))
.then(result => {
var msg;
if (result.status === STORAGE_CONSTANTS.FORKED) {
this.currentForkName = result.forkName;
msg = `"${this.pipelineName}" execution has forked to "${result.forkName}"`;
this.sendNotification(msg);
}
@@ -287,8 +279,17 @@ define([
this.onPipelineComplete(err);
};
ExecutePipeline.prototype.onOperationCanceled = function(op) {
var job = this.core.getParent(op);
this.core.setAttribute(job, 'status', 'canceled');
this.runningJobs--;
this.logger.debug(`${this.core.getAttribute(job, 'name')} has been canceled`);
this.onPipelineComplete();
};
ExecutePipeline.prototype.onPipelineComplete = function(err) {
var name = this.core.getAttribute(this.activeNode, 'name');
var name = this.core.getAttribute(this.activeNode, 'name'),
msg = `"${this.pipelineName}" `;
if (err) {
this.runningJobs--;
@@ -296,17 +297,33 @@ define([
this.pipelineError = this.pipelineError || err;
if (this.pipelineError && this.runningJobs > 0) {
this.logger.info('Pipeline errored but is waiting for the running ' +
this.logger.debug(`${this.runningJobs} remaining jobs`);
if ((this.pipelineError || this.canceled) && this.runningJobs > 0) {
var action = this.pipelineError ? 'error' : 'cancel';
this.logger.info(`Pipeline ${action}ed but is waiting for the running ` +
'jobs to finish');
return;
}
if (this.currentForkName) {
// notify client that the job has completed
this.sendNotification(`"${this.pipelineName}" execution completed on branch "${this.currentForkName}"`);
}
if (this.pipelineError) {
msg += 'failed!';
} else if (this.canceled) {
msg += 'canceled!';
} else {
msg += 'finished!';
}
this.logger.debug(`Pipeline "${name}" complete!`);
this.core.setAttribute(this.activeNode, 'status',
(!this.pipelineError ? 'success' : 'failed'));
(this.pipelineError ? 'failed' : (this.canceled ? 'canceled' : 'success')));
this._finished = true;
this.resultMsg(msg);
this.save('Pipeline execution finished')
.then(() => {
this.result.setSuccess(!this.pipelineError);
@@ -323,7 +340,7 @@ define([
this.logger.info(`About to execute ${readyOps.length} operations`);
// If the pipeline has errored don't start any more jobs
if (this.pipelineError) {
if (this.pipelineError || this.canceled) {
if (this.runningJobs === 0) {
this.onPipelineComplete();
}
+8
Ver Arquivo
@@ -10,6 +10,14 @@
"disableServerSideExecution": false,
"disableBrowserSideExecution": true,
"configStructure": [
{
"name": "name",
"displayName": "Execution name",
"description": "Optional name for this execution instance",
"value": "",
"valueType": "string",
"readOnly": false
},
{
"name": "debug",
"displayName": "Debug Mode",
@@ -40,7 +40,7 @@ define([
this.addCustomLayersToMeta();
this.LayerDict = createLayerDict(this.core, this.META);
this.uniqueId = 2;
this._oldTemplateSettings = _.templateSettings;
this.varnames = {};
return PluginBase.prototype.main.apply(this, arguments);
};
@@ -54,25 +54,36 @@ define([
.forEach(node => this.META[this.core.getAttribute(node, 'name')] = node);
};
GenerateArchitecture.prototype.hoist = function (code) {
this.definitions.push(code);
};
GenerateArchitecture.prototype.createOutputFiles = function (tree) {
var layers = tree[Constants.CHILDREN],
//initialLayers,
result = {},
code = 'require \'nn\'\n';
code = '';
this.definitions = [
'require \'nn\'',
'require \'rnn\''
];
//initialLayers = layers.filter(layer => layer[Constants.PREV].length === 0);
// Add an index to each layer
layers.forEach((l, index) => l[INDEX] = index);
// Define custom layers
if (this.getCurrentConfig().standalone) {
this.logger.debug('Generating layer definitions');
code += this.genLayerDefinitions(layers);
}
this.logger.debug('Generating architecture code...');
code += this.genArchCode(layers);
this.logger.debug('Prepending hoisted code...');
code = this.definitions.join('\n') + '\n' + code;
result[tree.name + '.lua'] = code;
_.templateSettings = this._oldTemplateSettings; // FIXME: Fix this in SimpleNodes
this.logger.debug(`Finished generating ${tree.name}.lua`);
return result;
};
@@ -83,10 +94,38 @@ define([
].join('\n');
};
GenerateArchitecture.prototype.genRawArchCode = function (layers, name) {
var result = '';
if (layers.length > 1) {
return this.createSequential(layers[0], name).code;
} else if (name) {
result = `\nlocal ${name} = `;
}
result += this.createLayer(layers[0]);
return result;
};
GenerateArchitecture.prototype.getVarName = function (base) {
// Check "this.varnames"
var name = base,
i = 2;
while (this.varnames[name]) {
name = base + '_' + (i++);
}
this.varnames[name] = true;
return name;
};
GenerateArchitecture.prototype.createLayer = function (layer) {
var args = this.createArgString(layer);
return `nn.${layer.name}${args}`;
};
GenerateArchitecture.prototype.createSequential = function (layer, name) {
var next = layer[Constants.NEXT][0],
args,
template,
snippet,
snippets,
code = `\nlocal ${name} = nn.Sequential()`,
@@ -101,10 +140,8 @@ define([
next = layer; // the given layer will be added by the caller
break;
} else { // add the given layer
args = this.createArgString(layer);
template = _.template(name + ':add(nn.{{= name }}' + args + ')');
snippet = template(layer);
code += '\n' + snippet;
snippet = this.createLayer(layer);
code += `\n${name}:add(${snippet})`;
}
@@ -113,7 +150,7 @@ define([
this.logger.debug(`detected fork of size ${layer[Constants.NEXT].length}`);
snippets = layer[Constants.NEXT].map(nlayer =>
this.createSequential(nlayer, 'net_'+(this.uniqueId++)));
this.createSequential(nlayer, this.getVarName('net')));
code += '\n' + snippets.map(snippet => snippet.code).join('\n');
// Make sure all snippets end at the same concat node
@@ -151,7 +188,7 @@ define([
// merge the elements in the group
if (snippets.length) { // prepare next iteration
result = this.createSequential(next, 'net_'+(this.uniqueId++));
result = this.createSequential(next, this.getVarName('net'));
code += result.code;
group = [result];
this.logger.debug('updating group ('+ snippets.length+ ' left)');
@@ -171,6 +208,38 @@ define([
};
};
GenerateArchitecture.abbr = function (word) {
word = word.substring(0, 1).toUpperCase() + word.substring(1);
return word.split(/[a-z]+/g).join('').toLowerCase();
};
GenerateArchitecture.prototype.getValue = function (arg, layer) {
var content = layer[arg];
if (typeof content === 'object') { // layer as arg
if (content[Constants.CHILDREN].length) {
// Generate the code for the children of layer[arg]
var name = this.getVarName(GenerateArchitecture.abbr(arg)),
layers;
this.logger.debug(`Adding layer arg for ${arg} (${layer.name})`);
try {
layers = this.genRawArchCode(layer[arg][Constants.CHILDREN], name);
} catch (e) {
this.logger.error(`Layer arg creation failed: ${e}`);
return null;
}
// hoist layer definitions to the top of the file
this.hoist(layers);
return name;
} else {
return null;
}
}
return content;
};
GenerateArchitecture.prototype.createArgString = function (layer) {
var setters = this.LayerDict[layer.name].setters,
setterNames = Object.keys(this.LayerDict[layer.name].setters),
@@ -179,8 +248,9 @@ define([
fn,
layerCode;
this.logger.debug(`Creating arg string for ${layer.name}`);
layerCode = '(' + this.LayerDict[layer.name].args
.map(arg => layer[arg.name])
.map(arg => this.getValue(arg.name, layer))
.filter(GenerateArchitecture.isSet)
.join(', ') + ')';
@@ -194,12 +264,13 @@ define([
fn = desc.setterFn[layer[setterNames[i]]];
layerCode += `:${fn}()`;
}
} else if (layer[setterNames[i]] !== null) {
} else if (layer[setterNames[i]] !== null && layer[setterNames[i]] !== undefined) {
fn = desc.setterFn;
layerCode += `:${fn}(${layer[setterNames[i]]})`;
}
}
this.logger.debug(`Created nn.${layer.name}${layerCode}`);
return layerCode;
};
+3 -9
Ver Arquivo
@@ -72,11 +72,10 @@ define([
this.loadNNMock();
// Cross compile to js and run
src = 'require \'nn\'\n' + src; // guarantee it loads nn
this.bin = this.context.loadString(src);
this.bin();
this.afterExecution();
return this.save('ImportTorch updated model.');
})
.then(() => { // changes saved successfully
@@ -101,15 +100,10 @@ define([
this.context._G.get('package').set('searchers', [function(name) {
if (name === 'nn') {
return lib;
} else {
return () => {};
}
}]);
// Some scripts don't include `require 'nn'`. I may have to add the
// "nn" package to the global scope...
};
ImportTorch.prototype.afterExecution = function () {
// TODO
};
return ImportTorch;
+90 -15
Ver Arquivo
@@ -7,7 +7,7 @@ define([
], function(
createLayerDict,
assert,
luajs
lua
) {
'use strict';
@@ -19,7 +19,8 @@ define([
LayerDict = createLayerDict(core, META),
helpers = context.__helpers,
oldSet = helpers.__set,
isSetting = false;
isSetting = false,
connsFrom = {};
// Override the helper's '__set' method to detect
// if the code is in the middle of a "set".
@@ -29,24 +30,68 @@ define([
isSetting = false;
};
var stringify = function(table) {
var strings = table.array.map(val => {
if (val instanceof lua.types.LuaTable) {
return stringify(val);
} else {
return val;
}
});
return '{' + strings.join(', ') + '}';
};
var allConnectedTo = function(current) {
var connectedIds = {},
node,
id;
while (current.length) {
node = current.shift();
id = core.getGuid(node);
if (connectedIds[id]) {
continue;
}
connectedIds[id] = node;
if (connsFrom[id]) {
current = current.concat(connsFrom[id]);
}
}
// Return an array of all things connected to the
// given node
return Object.keys(connectedIds).map(key => connectedIds[key]);
};
var connect = function(src, dst) {
var conn = core.createNode({
var conn,
id;
conn = core.createNode({
parent: parent,
base: META.Connection
});
core.setPointer(conn, 'src', src);
core.setPointer(conn, 'dst', dst);
// Record this
id = core.getGuid(src);
if (!connsFrom[id]) {
connsFrom[id] = [];
}
connsFrom[id].push(conn, dst);
};
// nn drawing library
var Layer = function(base, attrs, args) {
this._base = base;
this._attrs = attrs;
for (var i = 0; i < attrs.length; i++) {
this[attrs[i].name] = args[i];
}
// inputs/outputs used for being added to containers
this._values = args;
this._cachedNode = null;
this._inputs = [this._node()];
this._outputs = [this._node()];
@@ -55,6 +100,10 @@ define([
Layer.prototype._node = function() {
var name,
node,
nodes,
cntr,
layer,
cntrName,
value;
if (this._cachedNode) {
@@ -70,16 +119,42 @@ define([
for (var i = this._attrs.length; i--;) {
name = this._attrs[i].name;
value = this[name];
if ((typeof value) === 'object') {
// special lua.js object
value = value.valueOf();
}
value = this._values[i];
// TODO: Update this to check if inferred and the value matches
// our inferred value. If so, skip it
if (value !== undefined/*&& !this._attrs[i].infer*/) {
core.setAttribute(node, name, value);
if (value instanceof lua.types.LuaTable) {
layer = value.get('_node');
if (layer) { // layer arg!
// add all the inputs, outputs (and connected elements) to
// be in an "Architecture" node in the current node
cntr = core.createNode({
base: META.Architecture,
parent: node
});
cntrName = `${name} (${this._base})`;
logger.debug(`Naming layer arg ${cntrName}`);
core.setAttribute(cntr, 'name', cntrName);
// Move all connecting elements of the value to
// the cntr
nodes = allConnectedTo(layer._inputs.concat(layer._outputs));
for (var j = nodes.length; j--;) {
core.moveNode(nodes[j], cntr);
}
core.setPointer(node, name, cntr);
logger.debug(`Moving ${nodes.length} to ${name}(${this._base})`);
} else { // Something like {1, 2, 3}
value = stringify(value);
logger.debug(`Setting ${name} to ${value} (${this._base})`);
core.setAttribute(node, name, value);
}
} else { // attribute value
if ((typeof value) === 'object') {
// special lua.js object
value = value.valueOf();
}
if (value !== undefined) {
logger.debug(`Setting ${name} to ${value} (${this._base})`);
core.setAttribute(node, name, value);
}
}
}
@@ -197,9 +272,9 @@ define([
};
var CreateLayer = function(type) {
var res = luajs.newContext()._G,
var res = lua.newContext()._G,
attrs = [].slice.call(arguments, 1),
ltGet = luajs.types.LuaTable.prototype.get,
ltGet = lua.types.LuaTable.prototype.get,
setters = [],
args = [],
node;
@@ -253,7 +328,7 @@ define([
}
// TODO: Create the nn object
var nn = luajs.newContext()._G,
var nn = lua.newContext()._G,
names = Object.keys(LayerDict);
for (var i = names.length; i--;) {
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
+6
Ver Arquivo
@@ -94,5 +94,11 @@
"title": "ImageViewer",
"panel": "panels/ImageViewer/ImageViewerPanel",
"DEBUG_ONLY": false
},
{
"id": "ExecutionIndex",
"title": "ExecutionIndex",
"panel": "panels/ExecutionIndex/ExecutionIndexPanel",
"DEBUG_ONLY": false
}
]
@@ -2,12 +2,14 @@
/*jshint browser: true*/
define([
'deepforge/Constants',
'deepforge/globals',
'panels/EasyDAG/EasyDAGControl',
'js/NodePropertyNames',
'js/Utils/ComponentSettings',
'underscore'
], function (
Constants,
DeepForge,
EasyDAGControl,
nodePropertyNames,
@@ -38,6 +40,7 @@ define([
_.extend(ArchEditorControl.prototype, EasyDAGControl.prototype);
ArchEditorControl.prototype.TERRITORY_RULE = {children: 1};
ArchEditorControl.prototype.DEFAULT_DECORATOR = 'LayerDecorator';
ArchEditorControl.prototype.getComponentId = function() {
return 'ArchEditor';
};
@@ -59,13 +62,24 @@ define([
if (!desc.isConnection) {
var allAttrs = desc.attributes,
names = Object.keys(allAttrs),
schema;
ctorInfo = desc.attributes[Constants.CTOR_ARGS_ATTR],
ctorAttrs = ctorInfo ? ctorInfo.value.split(','): [],
schema,
i;
desc.attributes = {};
for (var i = names.length; i--;) {
// add ctor attributes
for (i = 0; i < ctorAttrs.length; i++) {
if (allAttrs[ctorAttrs[i]]) { // (not a ref to a layer)
desc.attributes[ctorAttrs[i]] = allAttrs[ctorAttrs[i]];
}
}
for (i = names.length; i--;) {
// check if it is a setter
schema = this._client.getAttributeSchema(id, names[i]);
if (names[i] === 'name' || schema.hasOwnProperty('argindex') ||
schema.setterType) {
if (names[i] === 'name' || schema.setterType) {
desc.attributes[names[i]] = allAttrs[names[i]];
}
}
@@ -164,7 +178,7 @@ define([
ArchEditorControl.prototype.getCreateNewDecorator = function() {
return this._client.decoratorManager.getDecoratorForWidget(
'EllipseDecorator',
'LayerDecorator',
'EasyDAG'
);
};
@@ -0,0 +1,302 @@
/*globals define, WebGMEGlobal*/
/*jshint browser: true*/
define([
'js/Constants'
], function (
CONSTANTS
) {
'use strict';
var ExecutionIndexControl;
ExecutionIndexControl = function (options) {
this._logger = options.logger.fork('Control');
this._client = options.client;
this._embedded = options.embedded;
// Initialize core collections and variables
this._widget = options.widget;
this._currentNodeId = null;
this.displayedExecutions = {};
this._linesForExecution = {};
this._lineToExec = {};
this._pipelineNames = {};
this._initWidgetEventHandlers();
this._logger.debug('ctor finished');
};
ExecutionIndexControl.prototype._initWidgetEventHandlers = function () {
this._widget.setExecutionDisplayed = this.setExecutionDisplayed.bind(this);
};
ExecutionIndexControl.prototype.setExecutionDisplayed = function (id, bool) {
var lines = this._linesForExecution[id] || [],
action = bool ? 'addNode' : 'removeNode';
// If removing, just get the ids
lines = bool ? lines : lines.map(line => line.id);
this._logger.info(`setting execution ${id} to ${bool ? 'displayed' : 'hidden'}`);
this.displayedExecutions[id] = bool;
// update the given lines
for (var i = lines.length; i--;) {
this._widget[action](lines[i]);
}
};
ExecutionIndexControl.prototype.clearTerritory = function () {
if (this._territoryId) {
this._client.removeUI(this._territoryId);
this._territoryId = null;
}
};
/* * * * * * * * Visualizer content update callbacks * * * * * * * */
ExecutionIndexControl.prototype.selectedObjectChanged = function (nodeId) {
var self = this;
self._logger.debug('activeObject nodeId \'' + nodeId + '\'');
// Remove current territory patterns
self.clearTerritory();
self._currentNodeId = nodeId;
if (typeof self._currentNodeId === 'string') {
// Create a territory for the executions
self._selfPatterns = {};
self._territoryId = self._client.addUI(self, function (events) {
self._eventCallback(events);
});
// Update the territory
self._selfPatterns[nodeId] = {children: 4};
self._client.updateTerritory(self._territoryId, self._selfPatterns);
}
};
// This next function retrieves the relevant node information for the widget
ExecutionIndexControl.prototype._getObjectDescriptor = function (nodeId) {
var node = this._client.getNode(nodeId),
childIds,
desc,
base,
type;
if (node) {
base = this._client.getNode(node.getBaseId());
type = base.getAttribute('name');
desc = {
id: node.getId(),
type: type,
name: node.getAttribute('name')
};
if (type === 'Execution') {
desc.status = node.getAttribute('status');
desc.originTime = node.getAttribute('createdAt');
desc.originId = node.getPointer('origin').to;
desc.pipelineName = this._pipelineNames[desc.originId];
this._logger.debug(`Looking up pipeline name for ${desc.name}: ${desc.pipelineName}`);
// Create a territory for this origin and update it!
this._selfPatterns[desc.originId] = {children: 0};
setTimeout(() => this._client.updateTerritory(this._territoryId, this._selfPatterns), 0);
} else if (type === 'Line') {
desc = this.getLineDesc(node);
} else if (type === 'Pipeline') {
desc.execs = node.getMemberIds('executions');
this._pipelineNames[desc.id] = desc.name;
} else if (type === 'Graph') {
childIds = node.getChildrenIds();
desc.lines = childIds.map(id => {
var n = this._client.getNode(id);
return this.getLineDesc(n);
});
}
}
return desc;
};
ExecutionIndexControl.prototype.getLineDesc = function (node) {
var id = node.getId(),
graphId = node.getParentId(),
jobId = this._client.getNode(graphId).getParentId(),
execId = this._client.getNode(jobId).getParentId(),
points,
desc;
points = node.getAttribute('points').split(';')
.filter(data => !!data) // remove any ''
.map(pair => {
var nums = pair.split(',').map(num => parseFloat(num));
return {
x: nums[0],
y: nums[1]
};
});
desc = {
id: id,
//execName: execName,
execId: execId,
lineName: node.getAttribute('name'),
name: node.getAttribute('name'),
type: 'line',
points: points
};
// Update records
if (!this._linesForExecution[execId]) {
this._linesForExecution[execId] = [];
}
this._linesForExecution[execId].push(desc);
this._lineToExec[id] = execId;
return desc;
};
/* * * * * * * * Node Event Handling * * * * * * * */
ExecutionIndexControl.prototype._eventCallback = function (events) {
var event;
events = events.filter(event => event.eid !== this._currentNodeId);
this._logger.debug('received \'' + events.length + '\' events');
for (var i = events.length; i--;) {
event = events[i];
switch (event.etype) {
case CONSTANTS.TERRITORY_EVENT_LOAD:
this._onLoad(event.eid);
break;
case CONSTANTS.TERRITORY_EVENT_UPDATE:
this._onUpdate(event.eid);
break;
case CONSTANTS.TERRITORY_EVENT_UNLOAD:
this._onUnload(event.eid);
break;
default:
break;
}
}
this._logger.debug('finished processing events!');
};
ExecutionIndexControl.prototype._onLoad = function (gmeId) {
var desc = this._getObjectDescriptor(gmeId);
this._logger.debug(`Loading node of type ${desc.type}`);
if (desc.type === 'Execution') {
this._logger.debug('Adding node to widget...');
this._logger.debug('desc:', desc);
this._widget.addNode(desc);
} else if (desc.type === 'line' && this.isLineDisplayed(desc)) {
this._widget.addNode(desc);
} else if (desc.type === 'Pipeline') {
this.updatePipelineNames(desc);
}
};
ExecutionIndexControl.prototype._onUpdate = function (gmeId) {
var desc = this._getObjectDescriptor(gmeId);
if (desc.type === 'Execution') {
this._widget.updateNode(desc);
} else if (desc.type === 'line' && this.isLineDisplayed(desc)) {
this._widget.updateNode(desc);
} else if (desc.type === 'Pipeline') {
this.updatePipelineNames(desc);
}
};
ExecutionIndexControl.prototype.updatePipelineNames = function (desc) {
// Get all associated executions and update their pipeline name
this._logger.debug('updating pipeline name for ' + desc.execs.join(', '));
for (var i = desc.execs.length; i--;) {
this._widget.updatePipelineName(desc.execs[i], desc.name);
}
if (desc.execs.length === 0) {
// Executions have been deleted - no longer relevant
this._logger.debug('pipeline has 0 executions... removing it', desc.id);
delete this._selfPatterns[desc.id];
delete this._pipelineNames[desc.id];
}
};
ExecutionIndexControl.prototype._onUnload = function (id) {
var execId = this._lineToExec[id];
if (execId) { // it is a line
delete this._lineToExec[id];
for (var k = this._linesForExecution[execId].length; k--;) {
if (this._linesForExecution[execId][k].id === id) {
this._linesForExecution[execId].splice(k, 1);
break;
}
}
}
this._widget.removeNode(id);
};
ExecutionIndexControl.prototype.isLineDisplayed = function (line) {
// lines are only displayed if their execution is checked
return this.displayedExecutions[line.execId];
};
ExecutionIndexControl.prototype._stateActiveObjectChanged = function (model, activeObjectId) {
if (this._currentNodeId === activeObjectId) {
// The same node selected as before - do not trigger
} else {
this.selectedObjectChanged(activeObjectId);
}
};
/* * * * * * * * Visualizer life cycle callbacks * * * * * * * */
ExecutionIndexControl.prototype.destroy = function () {
this._detachClientEventListeners();
this.clearTerritory();
};
ExecutionIndexControl.prototype._attachClientEventListeners = function () {
this._detachClientEventListeners();
if (!this._embedded) {
WebGMEGlobal.State.on('change:' + CONSTANTS.STATE_ACTIVE_OBJECT,
this._stateActiveObjectChanged, this);
}
};
ExecutionIndexControl.prototype._detachClientEventListeners = function () {
if (!this._embedded) {
WebGMEGlobal.State.off('change:' + CONSTANTS.STATE_ACTIVE_OBJECT,
this._stateActiveObjectChanged);
}
};
ExecutionIndexControl.prototype.onActivate = function () {
this._attachClientEventListeners();
if (typeof this._currentNodeId === 'string') {
WebGMEGlobal.State.registerSuppressVisualizerFromNode(true);
WebGMEGlobal.State.registerActiveObject(this._currentNodeId);
WebGMEGlobal.State.registerSuppressVisualizerFromNode(false);
}
};
ExecutionIndexControl.prototype.onDeactivate = function () {
this._detachClientEventListeners();
};
return ExecutionIndexControl;
});
@@ -0,0 +1,93 @@
/*globals define, _, WebGMEGlobal*/
/*jshint browser: true*/
define([
'js/PanelBase/PanelBase',
'js/PanelManager/IActivePanel',
'widgets/ExecutionIndex/ExecutionIndexWidget',
'./ExecutionIndexControl'
], function (
PanelBase,
IActivePanel,
ExecutionIndexWidget,
ExecutionIndexControl
) {
'use strict';
var ExecutionIndexPanel;
ExecutionIndexPanel = function (layoutManager, params) {
var options = {};
//set properties from options
options[PanelBase.OPTIONS.LOGGER_INSTANCE_NAME] = 'ExecutionIndexPanel';
options[PanelBase.OPTIONS.FLOATING_TITLE] = true;
//call parent's constructor
PanelBase.apply(this, [options, layoutManager]);
this._client = params.client;
this._embedded = params.embedded;
//initialize UI
this._initialize();
this.logger.debug('ctor finished');
};
//inherit from PanelBase
_.extend(ExecutionIndexPanel.prototype, PanelBase.prototype);
_.extend(ExecutionIndexPanel.prototype, IActivePanel.prototype);
ExecutionIndexPanel.prototype._initialize = function () {
//set Widget title
this.widget = new ExecutionIndexWidget(this.logger, this.$el);
this.control = new ExecutionIndexControl({
logger: this.logger,
client: this._client,
embedded: this._embedded,
widget: this.widget
});
this.onActivate();
};
/* OVERRIDE FROM WIDGET-WITH-HEADER */
/* METHOD CALLED WHEN THE WIDGET'S READ-ONLY PROPERTY CHANGES */
ExecutionIndexPanel.prototype.onReadOnlyChanged = function (isReadOnly) {
//apply parent's onReadOnlyChanged
PanelBase.prototype.onReadOnlyChanged.call(this, isReadOnly);
};
ExecutionIndexPanel.prototype.onResize = function (width, height) {
this.logger.debug('onResize --> width: ' + width + ', height: ' + height);
this.widget.onWidgetContainerResize(width, height);
};
/* * * * * * * * Visualizer life cycle callbacks * * * * * * * */
ExecutionIndexPanel.prototype.destroy = function () {
this.control.destroy();
this.widget.destroy();
PanelBase.prototype.destroy.call(this);
WebGMEGlobal.KeyboardManager.setListener(undefined);
WebGMEGlobal.Toolbar.refresh();
};
ExecutionIndexPanel.prototype.onActivate = function () {
this.widget.onActivate();
this.control.onActivate();
WebGMEGlobal.KeyboardManager.setListener(this.widget);
WebGMEGlobal.Toolbar.refresh();
};
ExecutionIndexPanel.prototype.onDeactivate = function () {
this.widget.onDeactivate();
this.control.onDeactivate();
WebGMEGlobal.KeyboardManager.setListener(undefined);
WebGMEGlobal.Toolbar.refresh();
};
return ExecutionIndexPanel;
});
@@ -1,11 +1,13 @@
/*globals DeepForge, define, $, Materialize, WebGMEGlobal*/
/*globals DeepForge, define, $, WebGMEGlobal*/
// These are actions defined for specific meta types. They are evaluated from
// the context of the ForgeActionButton
define([
'panel/FloatingActionButton/styles/Materialize',
'q',
'js/RegistryKeys',
'deepforge/globals'
], function(
Materialize,
Q,
REGISTRY_KEYS
) {
@@ -103,6 +105,7 @@ define([
name: `Return to ${fromType}`,
icon: 'input',
priority: 2,
color: 'teal',
filter: () => {
return DeepForge.last[fromType];
},
@@ -112,6 +115,7 @@ define([
name: `Delete ${type} Definition`,
icon: 'delete',
priority: 1,
color: 'red',
action: function() {
// Delete and go to the last pipeline?
var node = this.client.getNode(this._currentNodeId),
@@ -139,6 +143,11 @@ define([
name: 'Restart ' + name,
icon: 'replay',
priority: 1000,
color: 'red',
filter: function() {
// Only show if stopped!
return !this.isRunning();
},
action: function(event) {
this.runExecutionPlugin(pluginId, event.shiftKey);
}
@@ -215,9 +224,46 @@ define([
icon: 'play_for_work',
priority: 1,
href: download.execFiles
},
// Stop execution button
{
name: 'Stop Current Job',
icon: 'stop',
priority: 1001,
filter: function() {
return this.isRunning();
},
action: function() {
this.stopJob();
}
}
],
Execution: [
makeRestartButton('Execution', 'ExecutePipeline'),
// Stop execution button
{
name: 'Stop Running Execution',
icon: 'stop',
priority: 1001,
filter: function() {
return this.isRunning();
},
action: function() {
// Stop every running job
var execNode = this.client.getNode(this._currentNodeId),
jobIds = execNode.getChildrenIds(),
msg = `Canceling ${execNode.getAttribute('name')} execution`;
this.client.startTransaction(msg);
jobIds.map(id => this.client.getNode(id))
.filter(job => this.isRunning(job)) // get running jobs
.forEach(job => this.stopJob(job)); // stop them
this.client.setAttributes(execNode.getId(), 'status', 'canceled');
this.client.completeTransaction();
}
}
],
Execution: [makeRestartButton('Execution', 'ExecutePipeline')],
Pipeline: [
{
name: 'Create new node',
@@ -1,8 +1,10 @@
/*globals DeepForge, $, Materialize, define, _ */
/*globals DeepForge, $, WebGMEGlobal, window, define, _ */
/*jshint browser: true*/
define([
'panel/FloatingActionButton/styles/Materialize',
'blob/BlobClient',
'executor/ExecutorClient',
'js/Constants',
'panel/FloatingActionButton/FloatingActionButton',
'deepforge/viz/PipelineControl',
@@ -15,7 +17,9 @@ define([
'text!./PluginConfig.json',
'deepforge/globals'
], function (
Materialize,
BlobClient,
ExecutorClient,
CONSTANTS,
PluginButton,
PipelineControl,
@@ -33,6 +37,11 @@ define([
var ForgeActionButton= function (layoutManager, params) {
PluginButton.call(this, layoutManager, params);
this._pluginConfig = JSON.parse(PluginConfig);
this._executor = new ExecutorClient({
logger: this.logger.fork('ExecutorClient'),
serverPort: WebGMEGlobal.gmeConfig.server.port,
httpsecure: window.location.protocol === 'https:'
});
this._client = this.client;
this._actions = [];
this._blobClient = new BlobClient({
@@ -60,7 +69,7 @@ define([
if (!base) { // must be ROOT or FCO
basename = node.getAttribute('name') || 'ROOT_NODE';
actions = (ACTIONS[basename] || [])
.filter(action => !action.filter || action.filter());
.filter(action => !action.filter || action.filter.call(this));
return actions;
}
@@ -69,7 +78,7 @@ define([
base = this.client.getNode(base.getBaseId());
actions = ACTIONS[basename];
if (actions) {
actions = actions.filter(action => !action.filter || action.filter());
actions = actions.filter(action => !action.filter || action.filter.call(this));
}
}
@@ -328,14 +337,67 @@ define([
context.managerConfig.namespace = 'pipeline';
method = useSecondary ? 'runBrowserPlugin' : 'runServerPlugin';
this.client[method](pluginId, context, err => {
if (err) {
return Materialize.toast(`${name} failed!`, 4000);
this.client[method](pluginId, context, (err, result) => {
var msg = err ? `${name} failed!` : `${name} executed successfully!`,
duration = err ? 4000 : 2000;
// Check if it was canceled - if so, show that type of message
if (result) {
msg = result.messages[0].message;
duration = 4000;
}
Materialize.toast(`${name} executed successfully!`, 2000);
Materialize.toast(msg, duration);
});
};
ForgeActionButton.prototype.isRunning = function(node) {
var baseId,
base,
type;
node = node || this.client.getNode(this._currentNodeId);
baseId = node.getBaseId();
base = this.client.getNode(baseId);
type = base.getAttribute('name');
if (type === 'Execution') {
return node.getAttribute('status') === 'running';
} else if (type === 'Job') {
return this.isRunningJob(node);
}
return false;
};
ForgeActionButton.prototype.isRunningJob = function(job) {
var status = job.getAttribute('status');
return (status === 'running' || status === 'pending') &&
job.getAttribute('secret') && job.getAttribute('jobId');
};
ForgeActionButton.prototype.stopJob = function(job) {
var jobHash,
jobId,
secret;
job = job || this.client.getNode(this._currentNodeId);
jobId = job.getId();
jobHash = job.getAttribute('jobId');
secret = job.getAttribute('secret');
if (!jobHash || !secret) {
this.logger.error('Cannot stop job. Missing jobHash or secret');
return;
}
this.client.delAttributes(jobId, 'jobId');
this.client.delAttributes(jobId, 'secret');
this.client.setAttributes(jobId, 'status', 'canceled');
return this._executor.cancelJob(jobHash, secret)
.then(() => this.logger.info(`${jobHash} has been cancelled!`))
.fail(err => this.logger.error(`Job cancel failed: ${err}`));
};
return ForgeActionButton;
});
@@ -5,6 +5,7 @@
},
"ExecutePipeline": {
"icon": "play_arrow",
"color": "green",
"priority": 1
},
"ImportTorch": {
@@ -2,9 +2,15 @@
/*jshint browser: true*/
define([
'panels/TextEditor/TextEditorControl'
'panels/TextEditor/TextEditorControl',
'deepforge/LayerParser',
'deepforge/utils',
'deepforge/Constants'
], function (
TextEditorControl
TextEditorControl,
LayerParser,
utils,
Constants
) {
'use strict';
@@ -50,62 +56,120 @@ define([
};
LayerEditorControl.prototype.saveTextFor = function (id, text) {
var r = /:__init\((.*)\)/,
match = text.match(r),
textMatch = match && match[1],
node = this._client.getNode(id),
var node = this._client.getNode(id),
currentAttrs = node.getValidAttributeNames(),
attributes = [],
msg = `Updating layer definition for ${node.getAttribute('name')}`;
types,
ctorAttrs = [],
setterNames,
schema,
currentPtrs = {base: true},
type,
ptr,
msg = `Updating layer definition for ${node.getAttribute('name')}`,
i;
// Parse the attributes and update the node!
if (textMatch) {
attributes = textMatch.split(',')
.map(arg => arg.replace(/\s+/g, '')) // trim white space
.filter(arg => !!arg); // no empty strings!
// Parse the ctorAttrs and update the node!
var layerSchema = LayerParser.parse(text);
if (!layerSchema) {
return TextEditorControl.prototype.saveTextFor.call(this, id, text);
}
if (layerSchema.params) {
ctorAttrs = layerSchema.params;
} else { // inheriting __init
attributes = this.getInheritedAttrs(text);
ctorAttrs = this.getInheritedAttrs(layerSchema);
}
this._client.startTransaction(msg);
TextEditorControl.prototype.saveTextFor.call(this, id, text);
this._client.setAttributes(id, 'name', layerSchema.name);
this._logger.debug(`Setting ctor args to ${ctorAttrs.join(',')}`);
this._client.setAttributes(id, Constants.CTOR_ARGS_ATTR, ctorAttrs.join(','));
types = layerSchema.types || {};
schema = this.getPointerMeta();
// Handle pointer types
for (i = ctorAttrs.length; i--;) {
type = types[ctorAttrs[i]];
if (type && type.substring(0, 3) === 'nn.') {
ptr = ctorAttrs.splice(i, 1)[0];
this._client.setPointerMeta(id, ptr, schema);
currentPtrs[ptr] = true;
}
}
// Remove old pointers
node.getPointerNames().filter(ptr => !currentPtrs[ptr])
.forEach(ptr => this._client.deleteMetaPointer(id, ptr));
// Remove old attributes
_.difference(currentAttrs, attributes)
setterNames = Object.keys(layerSchema.setters);
_.difference(currentAttrs, ctorAttrs, setterNames)
.forEach(attr => this._client.removeAttributeSchema(id, attr));
attributes.forEach((attr, i) =>
this._client.setAttributeSchema(id, attr, {type: 'string', argindex: i}));
// Add setters
for (i = setterNames.length; i--;) {
schema = utils.getSetterSchema(setterNames[i], layerSchema.setters, layerSchema.defaults);
// Get setter attr schema
if (schema.hasOwnProperty('default')) {
this._client.setAttributes(id, setterNames[i], schema.default);
delete schema.default;
}
if (types[setterNames[i]]) {
schema.type = types[setterNames[i]];
}
this._client.setAttributeSchema(id, setterNames[i], schema);
}
ctorAttrs.forEach(attr =>
this._client.setAttributeSchema(id, attr, {
type: types[attr] || 'string'
})
);
this._client.completeTransaction();
};
LayerEditorControl.prototype.getInheritedAttrs = function (code) {
LayerEditorControl.prototype.getPointerMeta = function () {
var archNode = this._client.getAllMetaNodes()
.find(node => node.getAttribute('name') === 'Architecture');
if (!archNode) {
throw 'Could not find the "Architecture" node!';
}
return {
min: 1,
max: 1,
items: [
{
id: archNode.getId(),
max: 1
}
]
};
};
LayerEditorControl.prototype.getInheritedAttrs = function (layerSchema) {
// Get the base class
var r = /torch.class\((.*)\)/,
match = code.match(r),
baseType,
metanode,
textMatch = match && match[1];
var metanode;
if (textMatch) {
baseType = textMatch.split(',')[1]
.replace(/^\s*['"]nn\./, '')
.replace(/['"]\s*$/, '');
this._logger.debug(`inheriting the attributes from ${baseType}`);
if (layerSchema.baseType) {
this._logger.debug(`inheriting the attributes from ${layerSchema.baseType}`);
// Get the meta node and valid attribute names
metanode = this._client.getAllMetaNodes()
.find(node => node.getAttribute('name') === baseType);
.find(node => node.getAttribute('name') === layerSchema.baseType);
if (metanode) {
return metanode.getValidAttributeNames()
.filter(attr => attr !== 'name');
} else {
// Check if the type is known by torch
this._logger.warn(`Unknown base type ${baseType}. Assuming attributes are []`);
this._logger.warn(`Unknown base type ${layerSchema.baseType}. Assuming attributes are []`);
}
}
return [];
@@ -83,17 +83,20 @@ define([
// Check if it is a line
if (desc.id !== this._currentNodeId) {
var points = (node.getAttribute('points') || '').split(';')
.map(pair => {
var nums = pair.split(','),
x = parseFloat(nums[0]),
y = parseFloat(nums[1]);
var rawPoints = node.getAttribute('points') || '',
points = rawPoints.split(';')
.filter(data => !!data) // remove any ''
.map(pair => {
var nums = pair.split(','),
x = parseFloat(nums[0]),
y = parseFloat(nums[1]);
return {
x: x,
y:y
};
});
return {
x: x,
y:y
};
});
desc.type = 'line';
desc.points = points;
}
@@ -65,6 +65,8 @@ define([
return null;
}
};
this._widget.toggleEmbeddedPanel = () => this.toggleEmbeddedPanel();
};
/* * * * * * * * Visualizer content update callbacks * * * * * * * */
+43 -10
Ver Arquivo
@@ -9,6 +9,7 @@ define([
'widgets/MainView/MainViewWidget',
'./MainViewControl',
'panels/PipelineIndex/PipelineIndexPanel',
'panels/ExecutionIndex/ExecutionIndexPanel',
'deepforge/globals'
], function (
PanelBaseWithHeader,
@@ -16,6 +17,7 @@ define([
MainViewWidget,
MainViewControl,
PipelineIndexPanel,
ExecutionIndexPanel,
DeepForge
) {
'use strict';
@@ -38,12 +40,14 @@ define([
this.$nav = $('<div>', {id: 'nav-container'});
this.$el.css({padding: 0});
this.embeddedPanel = new PipelineIndexPanel(layoutManager, params);
this.$embedded = this.embeddedPanel.$el;
this.$embedded.addClass('embedded');
this.$el.append(this.$nav, this.$embedded);
this.embeddedPanels = [
PipelineIndexPanel,
ExecutionIndexPanel
];
this.nextPanelIndex = 0;
this._lm = layoutManager;
this._params = params;
this.$el.append(this.$nav);
this._initialize();
this.logger.debug('ctor finished');
@@ -66,15 +70,42 @@ define([
widget: this.widget
});
var controlObjectChanged = this.control.selectedObjectChanged;
this.control.selectedObjectChanged = nodeId => {
this.embeddedPanel.control.selectedObjectChanged(DeepForge.places.MyPipelines);
return controlObjectChanged.call(this.control, nodeId);
this.control.toggleEmbeddedPanel = this.toggleEmbeddedPanel.bind(this);
var selectedObjectChanged = this.control.selectedObjectChanged;
this.control.selectedObjectChanged = id => {
this.embeddedPanel.control.selectedObjectChanged(this.getEmbeddedNode());
selectedObjectChanged.call(this.control, id);
};
this.toggleEmbeddedPanel(true);
this.onActivate();
};
MainViewPanel.prototype.getEmbeddedNode = function() {
return this.nextPanelIndex === 1 ? DeepForge.places.MyPipelines : DeepForge.places.MyExecutions;
};
MainViewPanel.prototype.toggleEmbeddedPanel = function (silent) {
var Panel = this.embeddedPanels[this.nextPanelIndex];
this.nextPanelIndex = (this.nextPanelIndex + 1) % this.embeddedPanels.length;
if (this.embeddedPanel) { // Remove current
this.embeddedPanel.destroy();
this.$embedded.remove();
}
this.embeddedPanel = new Panel(this._lm, this._params);
this.$embedded = this.embeddedPanel.$el;
this.$embedded.addClass('main-view-embedded');
this.$el.append(this.$embedded);
// Call on Resize and selectedObjectChanged
this.onResize(this.width, this.height);
if (!silent) {
this.embeddedPanel.control.selectedObjectChanged(this.getEmbeddedNode());
}
};
/* OVERRIDE FROM WIDGET-WITH-HEADER */
/* METHOD CALLED WHEN THE WIDGET'S READ-ONLY PROPERTY CHANGES */
MainViewPanel.prototype.onReadOnlyChanged = function (isReadOnly) {
@@ -98,6 +129,8 @@ define([
margin: 'inherit'
});
this.embeddedPanel.onResize(embeddedWidth, height);
this.width = width;
this.height = height;
};
/* * * * * * * * Visualizer life cycle callbacks * * * * * * * */
@@ -92,13 +92,18 @@ define([
OutputViewerPanel.prototype.selectOutput = function (element) {
if (this.$selected !== element) {
// Update the panel
var dataId = element.data('id');
while (element.prop('tagName').toLowerCase() !== 'a' && element.length) {
element = element.parent();
}
dataId = element.data('id');
this.$selected.parent().removeClass('active');
element.parent().addClass('active');
this.$selected = element;
// Update the panel
var dataId = element.data('id');
if (dataId) {
this.loadOutputFor(dataId);
} else { // Set the logviewer
@@ -300,6 +305,7 @@ define([
/* * * * * * * * Visualizer life cycle callbacks * * * * * * * */
OutputViewerPanel.prototype.destroy = function () {
this.activePanel.destroy();
this.clearTerritory();
PanelBaseWithHeader.prototype.destroy.call(this);
WebGMEGlobal.KeyboardManager.setListener(undefined);
WebGMEGlobal.Toolbar.refresh();
@@ -5,6 +5,7 @@ define([
'deepforge/globals',
'widgets/EasyDAG/EasyDAGWidget',
'widgets/EasyDAG/AddNodeDialog',
'./SelectionManager',
'./Layer',
'q',
'underscore',
@@ -13,6 +14,7 @@ define([
DeepForge,
EasyDAGWidget,
AddNodeDialog,
SelectionManager,
Layer,
Q,
_
@@ -31,6 +33,7 @@ define([
_.extend(ArchEditorWidget.prototype, EasyDAGWidget.prototype);
ArchEditorWidget.prototype.ItemClass = Layer;
ArchEditorWidget.prototype.SelectionManager = SelectionManager;
ArchEditorWidget.prototype.onCreateInitialNode = function() {
var nodes = this.getValidInitialNodes();
@@ -0,0 +1,52 @@
/* globals _, WebGMEGlobal, define*/
define([
'widgets/EasyDAG/SelectionManager',
'deepforge/viz/Buttons'
], function(
ManagerBase,
Buttons
) {
var client = WebGMEGlobal.Client;
var SelectionManager = function() {
ManagerBase.apply(this, arguments);
};
_.extend(SelectionManager.prototype, ManagerBase.prototype);
SelectionManager.prototype.createActionButtons = function(width, height) {
var disabled,
btn;
ManagerBase.prototype.createActionButtons.call(this, width, height);
if (!this.selectedItem.isConnection) {
disabled = !this._isCustomLayer();
// Check that the base type
btn = new Buttons.GoToBase({
$pEl: this.$selection,
context: this._widget,
item: this.selectedItem,
disabled: disabled,
x: width,
y: 0
});
}
return btn;
};
SelectionManager.prototype._isCustomLayer = function() {
var node = client.getNode(this.selectedItem.id),
attrNames;
if (node) {
attrNames = node.getAttributeNames();
return attrNames.indexOf('code') !== -1;
}
return false;
};
return SelectionManager;
});
@@ -0,0 +1,12 @@
<table class="table">
<thead>
<tr>
<td></td>
<td>Name</td>
<td>Creation Date</td>
<td>Origin Pipeline</td>
</tr>
</thead>
<tbody class="execs-content">
</tbody>
</table>
@@ -0,0 +1,226 @@
/*globals define, WebGMEGlobal, $*/
/*jshint browser: true*/
define([
'deepforge/viz/Utils',
'widgets/LineGraph/LineGraphWidget',
'text!./ExecTable.html',
'css!./styles/ExecutionIndexWidget.css'
], function (
Utils,
LineGraphWidget,
TableHtml
) {
'use strict';
var ExecutionIndexWidget,
WIDGET_CLASS = 'execution-index';
ExecutionIndexWidget = function (logger, container) {
this._logger = logger.fork('Widget');
this.$el = container;
this.nodes = {};
this.graphs = {};
this._initialize();
this._logger.debug('ctor finished');
};
ExecutionIndexWidget.prototype._initialize = function () {
// set widget class
this.$el.addClass(WIDGET_CLASS);
// Create split screen
this.$left = $('<div>', {class: 'left'});
this.$right = $('<div>', {class: 'right'});
this.$el.append(this.$left, this.$right);
// Create the table
this.$table = $(TableHtml);
this.$table.on('click', '.exec-row', event => this.onExecutionClicked(event));
this.$table.on('click', '.node-nav', event => this.navToNode(event));
this.$left.append(this.$table);
this.$execList = this.$table.find('.execs-content');
// Create the graph in the right half
this.lineGraph = new LineGraphWidget(this._logger, this.$right);
this.defaultSelection = null;
this.hasRunning = false;
};
ExecutionIndexWidget.prototype.navToNode = function (event) {
var id = event.target.getAttribute('data-id');
if (typeof id === 'string') {
WebGMEGlobal.State.registerActiveObject(id);
event.stopPropagation();
}
this._logger.warn('No node id found for node-nav!');
};
ExecutionIndexWidget.prototype.onExecutionClicked = function (event) {
var target = event.target,
checked,
id;
while (!target.getAttribute('data-id')) {
if (!target.parentNode) {
this._logger.error('could not find execution id for ' + event);
return;
}
target = target.parentNode;
}
id = target.getAttribute('data-id');
checked = this.nodes[id].$checkbox.checked;
if (event.target.tagName.toLowerCase() !== 'input') {
this.setSelect(id, !checked);
} else {
this.setExecutionDisplayed(id, checked);
}
};
ExecutionIndexWidget.prototype.onWidgetContainerResize = function (width, height) {
this.$left.css({
width: width/2,
height: height
});
this.$right.css({
left: width/2,
width: width/2,
height: height
});
this.lineGraph.onWidgetContainerResize(width/2, height);
this._logger.debug('Widget is resizing...');
};
// Adding/Removing/Updating items
ExecutionIndexWidget.prototype.addNode = function (desc) {
if (desc.type === 'Execution') {
// Add node to a table of nodes
this.addExecLine(desc);
this.updateSelected(desc);
} else if (desc.type === 'line') {
desc.type = 'line';
this.lineGraph.addNode(desc);
}
};
ExecutionIndexWidget.prototype.updatePipelineName = function (execId, name) {
if (this.nodes[execId]) {
this.nodes[execId].$pipeline.text(name);
}
};
ExecutionIndexWidget.prototype.addExecLine = function (desc) {
var row = $('<tr>', {class: 'exec-row', 'data-id': desc.id}),
checkBox = $('<input>', {type: 'checkbox'}),
statusClass = Utils.ClassForJobStatus[desc.status],
fields,
pipeline,
name,
td;
pipeline = $('<a>', {
class: 'node-nav',
'data-id': desc.originId
}).text(desc.pipelineName || 'view pipeline');
name = $('<a>', {class: 'node-nav', 'data-id': desc.id}).text(desc.name);
fields = [
checkBox,
name,
Utils.getDisplayTime(desc.originTime),
pipeline
];
for (var i = 0; i < fields.length; i++) {
td = $('<td>');
if ((typeof fields[i]) === 'string') {
td.text(fields[i]);
} else {
td.append(fields[i]);
}
row.append(td);
}
this._logger.debug(`Adding execution ${desc.name} (${desc.id}) to list`);
this.$execList.append(row);
row.addClass(statusClass);
this.nodes[desc.id] = {
statusClass: statusClass,
$el: row,
$checkbox: checkBox[0],
$pipeline: pipeline,
$name: name
};
};
ExecutionIndexWidget.prototype.removeNode = function (id) {
if (this.nodes[id]) {
this.nodes[id].$el.remove();
} else if (this.graphs[id]) {
delete this.graphs[id];
}
delete this.nodes[id];
this.lineGraph.removeNode(id); // 'nop' if node is not line
};
ExecutionIndexWidget.prototype.updateSelected = function (desc) {
// If the running pipeline has been unselected, don't reselect it!
if (desc.status === 'running') {
this.hasRunning = true;
this.setSelect(desc.id, true);
if (this.defaultSelection) {
this.setSelect(this.defaultSelection, false);
}
} else if (!this.hasRunning && !this.defaultSelection) {
this.defaultSelection = desc.id;
this.setSelect(desc.id, true);
}
};
ExecutionIndexWidget.prototype.setSelect = function (id, checked) {
this.nodes[id].$checkbox.checked = checked;
this.setExecutionDisplayed(id, checked);
};
ExecutionIndexWidget.prototype.updateNode = function (desc) {
var node = this.nodes[desc.id];
if (node) {
node.$name.text(desc.name);
node.$el.removeClass(node.statusClass);
node.$el.addClass(Utils.ClassForJobStatus[desc.status]);
if (Utils.ClassForJobStatus[desc.status] !== node.statusClass) {
// Only update the selection if the status has changed.
// ie, it has started running
this.updateSelected(desc);
}
this._logger.debug(`setting execution ${desc.id} to ${desc.status}`);
node.statusClass = Utils.ClassForJobStatus[desc.status];
} else if (desc.type === 'line') {
this.lineGraph.updateNode(desc);
}
};
/* * * * * * * * Visualizer life cycle callbacks * * * * * * * */
ExecutionIndexWidget.prototype.destroy = function () {
};
ExecutionIndexWidget.prototype.onActivate = function () {
this._logger.debug('ExecutionIndexWidget has been activated');
};
ExecutionIndexWidget.prototype.onDeactivate = function () {
this._logger.debug('ExecutionIndexWidget has been deactivated');
};
return ExecutionIndexWidget;
});
@@ -0,0 +1,21 @@
/**
* This file is for any css that you may want for this visualizer.
*
* Ideally, you would use the scss file also provided in this directory
* and then generate this file automatically from that. However, you can
* simply write css if you prefer
*/
.execution-index.panel-body {
padding: 0;
}
.execution-index .left {
position: absolute;
background-color: #eee;
}
.execution-index .right {
position: absolute;
background-color: #eee;
}
@@ -0,0 +1,7 @@
/**
* This file is for any scss that you may want for this visualizer.
*/
.execution-index {
outline: none;
}
@@ -48,8 +48,8 @@ define([
var title = nodeName === undefined ? this._currentTitle : nodeName;
this._currentTitle = title;
if (this.isSnapshot) {
title += ' (SNAPSHOT)';
if (!this.isSnapshot) {
title += ' (DEBUG)';
}
this._setTitle(title);
@@ -1,4 +1,4 @@
/*globals define, d3, nv */
/*globals define, d3, nv, _ */
/*jshint browser: true*/
define([
@@ -35,7 +35,6 @@ define([
this.$chart = d3.select(this.$el[0]).append('svg');
nv.addGraph(() => {
var chart = nv.models.lineChart()
//.margin({left: 100})
.useInteractiveGuideline(true)
.showLegend(true)
.showYAxis(true)
@@ -82,20 +81,20 @@ define([
values: desc.points
};
}
this.updateChartData();
this.refreshChart();
}
};
LineGraphWidget.prototype.removeNode = function (id) {
delete this.lineData[id];
this.updateChartData();
this.refreshChart();
};
LineGraphWidget.prototype.updateNode = function (desc) {
if (desc && this.lineData[desc.id]) {
this.lineData[desc.id].values = desc.points;
this.lineData[desc.id].key = desc.name;
this.updateChartData();
this.refreshChart();
}
};
@@ -115,6 +114,9 @@ define([
}
};
LineGraphWidget.prototype.refreshChart =
_.debounce(LineGraphWidget.prototype.updateChartData, 50);
LineGraphWidget.prototype.updateChart = function () {
if (this.chart) {
this.chart.update();
@@ -17,12 +17,17 @@ define([
var MainViewWidget,
WIDGET_CLASS = 'main-view',
CreateListItem = _.template(ListItem);
CreateListItem = _.template(ListItem),
ToggleLabels = [
'Executions',
'Pipelines'
];
MainViewWidget = function (logger, container) {
this._logger = logger.fork('Widget');
this.$el = container;
this.$el.addClass(WIDGET_CLASS);
this.toggleIndex = 0;
this.initialize();
this._logger.debug('ctor finished');
};
@@ -32,6 +37,19 @@ define([
this.$nav = $(NavBarHTML);
this.$el.append(this.$nav);
// Execution support
this.$toggle = this.$nav.find('#toggle-main');
this.$toggleLabel = this.$nav.find('.toggle-label');
this.$toggle.on('click', () => {
if (this._closed) { // shouldn't be clicked when closed (but it is possible)
return;
}
this.toggleEmbeddedPanel();
// Update the toggle name
this.toggleIndex = (this.toggleIndex + 1) % 2;
this.$toggleLabel.text(ToggleLabels[this.toggleIndex]);
});
this.$archlist = this.$nav.find('#arch-list-content');
this.$artifacts = this.$nav.find('#artifact-list-content');
@@ -1,6 +1,13 @@
<nav class="side-nav fixed closed hide-list">
<li class="pull-right side-nav-control">
<span class="glyphicon glyphicon-menu-hamburger" aria-hidden="true"></span>
</li >
<li class="no-padding" id="toggle-main">
<ul>
<li class="no-padding">
<a class="toggle-label">Executions</a>
</li>
</ul>
</li>
<li class="no-padding">
<ul class="collapsible" data-collapsible="accordion">
@@ -1,3 +1,7 @@
.main-view-embedded {
position: absolute;
}
.main-view .side-nav-control {
padding-right: 1em;
padding-top: 1em;
@@ -1,14 +1,11 @@
/*globals WebGMEGlobal, $, define*/
/*jshint browser: true*/
/**
* Generated by VisualizerGenerator 1.7.0 from webgme on Thu May 19 2016 14:04:47 GMT-0500 (CDT).
*/
define([
'widgets/EasyDAG/AddNodeDialog',
'widgets/EasyDAG/EasyDAGWidget',
'deepforge/viz/PipelineControl',
'deepforge/viz/Utils',
'deepforge/globals',
'./OperationNode',
'./Connection',
@@ -19,6 +16,7 @@ define([
AddNodeDialog,
EasyDAGWidget,
PipelineControl,
Utils,
DeepForge,
OperationNode,
Connection,
@@ -35,12 +33,7 @@ define([
DEFAULT: 'default',
CONNECTING: 'connecting'
},
UPLOAD_ARTIFACT_ID = '__UPLOAD_ARTIFACT__',
STATUS_TO_CLASS = {
running: 'warning',
success: 'success',
failed: 'danger'
};
UPLOAD_ARTIFACT_ID = '__UPLOAD_ARTIFACT__';
PipelineEditorWidget = function (logger, container, execCntr) {
EasyDAGWidget.call(this, logger, container);
@@ -321,14 +314,10 @@ define([
var row = $('<tr>'),
title = $('<td>', {class: 'execution-name'}),
timestamp = $('<td>'),
className = STATUS_TO_CLASS[exec.status] || '',
today = new Date().toLocaleDateString(),
date = new Date(exec.createdAt).toLocaleDateString(),
className = Utils.ClassForJobStatus[exec.status] || '',
date = Utils.getDisplayTime(exec.createdAt),
rmIcon = $(REMOVE_ICON);
if (date === today) {
date = `Today (${new Date(exec.createdAt).toLocaleTimeString()})`;
}
timestamp.text(date);
title.append($('<a>').text(exec.name));
-1
Ver Arquivo
@@ -1 +0,0 @@
{"http://localhost:8888":{}}
+68 -55
Ver Arquivo
@@ -1,7 +1,4 @@
/*jshint node:true, mocha:true*/
/**
* Generated by PluginGenerator 0.14.0 from webgme on Thu Mar 10 2016 04:16:02 GMT-0600 (CST).
*/
'use strict';
var testFixture = require('../../globals'),
@@ -63,7 +60,7 @@ describe('ImportTorch', function () {
checker = new GraphChecker({
core: core,
ignore: {
attributes: []
attributes: ['ctor_arg_order']
}
});
return project.createBranch('test', commitHash);
@@ -103,60 +100,16 @@ describe('ImportTorch', function () {
});
var runTest = function(name, done) {
var manager = new PluginCliManager(null, logger, gmeConfig),
pluginConfig = {},
context = {
namespace: 'nn',
project: project,
branchName: 'test',
activeNode: ''
},
data = fs.readFileSync(path.join(TEST_CASE_DIR, name), 'utf8'),
var data = fs.readFileSync(path.join(TEST_CASE_DIR, name), 'utf8'),
ymlFile = path.join(YAML_DIR, name.replace(/lua$/, 'yml')),
yml = fs.readFileSync(ymlFile, 'utf8'),
initModels;
yml = fs.readFileSync(ymlFile, 'utf8');
// Load the children from the head of the 'test' branch
project.getBranchHash('test')
.then(function (branchHash) {
return Q.ninvoke(project, 'loadObject', branchHash);
})
.then(function (commitObject) {
return Q.ninvoke(core, 'loadRoot', commitObject.root);
})
.then(function (root) {
return core.loadChildren(root);
})
.then(children => {
initModels = children.map(core.getPath);
return blobClient.putFile(name, data); // upload the file
})
.then(hash => {
pluginConfig.srcHash = hash;
return Q.nfcall(
manager.executePlugin.bind(manager),
pluginName,
pluginConfig,
context
);
})
.then(pluginResult => {
expect(typeof pluginResult).to.equal('object');
expect(pluginResult.success).to.equal(true);
return project.getBranchHash('test');
})
importTorch(name, data)
// Use the check-model object to check the result models!
.then(function (branchHash) {
return Q.ninvoke(project, 'loadObject', branchHash);
})
.then(function (commitObject) {
return Q.ninvoke(core, 'loadRoot', commitObject.root);
})
.then(function (root) {
return core.loadChildren(root);
})
.then(children => {
var newModel = children.find(model =>
.then(groups => {
var children = groups[1],
initModels = groups[0],
newModel = children.find(model =>
initModels.indexOf(core.getPath(model)) === -1);
expect(initModels.length+1).to.equal(children.length);
@@ -176,6 +129,56 @@ describe('ImportTorch', function () {
.nodeify(done);
};
var importTorch = function(name, code) {
var manager = new PluginCliManager(null, logger, gmeConfig),
pluginConfig = {},
context = {
namespace: 'nn',
project: project,
branchName: 'test',
activeNode: ''
},
initModels;
// Load the children from the head of the 'test' branch
return project.getBranchHash('test')
.then(function (branchHash) {
return Q.ninvoke(project, 'loadObject', branchHash);
})
.then(function (commitObject) {
return Q.ninvoke(core, 'loadRoot', commitObject.root);
})
.then(function (root) {
return core.loadChildren(root);
})
.then(children => {
initModels = children.map(core.getPath);
return blobClient.putFile(name, code); // upload the file
})
.then(hash => {
pluginConfig.srcHash = hash;
return Q.nfcall(
manager.executePlugin.bind(manager),
pluginName,
pluginConfig,
context
);
})
.then(pluginResult => {
expect(typeof pluginResult).to.equal('object');
expect(pluginResult.success).to.equal(true);
return project.getBranchHash('test');
})
.then(function (branchHash) {
return Q.ninvoke(project, 'loadObject', branchHash);
})
.then(function (commitObject) {
return Q.ninvoke(core, 'loadRoot', commitObject.root);
})
.then(root => core.loadChildren(root))
.then(children => [initModels, children]);
};
describe('run test cases', function() {
var cases = fs.readdirSync(TEST_CASE_DIR)
.filter(name => path.extname(name) === '.lua')
@@ -186,4 +189,14 @@ describe('ImportTorch', function () {
// one test for each test name
cases.forEach(name => it(`should run test "${name}"`, runTest.bind(this, name)));
});
it('should support "require \'rnn\'"', function(done) {
importTorch('test', 'require \'nn\'\nrequire \'rnn\'')
.nodeify(done);
});
it('should not need require \'nn\'', function(done) {
importTorch('test', 'nn.Sequential():add(nn.Linear(100, 50))')
.nodeify(done);
});
});
+5
Ver Arquivo
@@ -0,0 +1,5 @@
local net = nn.Sequential()
net:add(nn.Transpose({ 1, 2 }))
net:add(nn.Transpose({ {1, 2}, {3, 4} }))
return net;
+177 -176
Ver Arquivo
@@ -1,340 +1,341 @@
require 'nn'
require 'rnn'
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, 0, 0))
net:add(nn.SpatialConvolution(64, 64, 1, 1, 0))
net:add(nn.SpatialMaxPooling(3, 3, 2, 2))
net:add(nn.SpatialConvolution(64, 64, 1, 1))
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, 0, 0))
net:add(nn.SpatialMaxPooling(3, 3, 2, 2))
local net = nn.Sequential()
net:add(nn.SpatialConvolution(192, 64, 1, 1, 1, 1))
net:add(nn.ReLU(true))
net:add(nn.SpatialConvolution(64, 96, 3, 3, 1, 1, 1, 1))
net:add(nn.ReLU(true))
net:add(nn.SpatialConvolution(96, 96, 3, 3, 1, 1, 1, 1))
net:add(nn.ReLU(true))
local net_2 = nn.Sequential()
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))
net_2:add(nn.SpatialConvolution(96, 96, 3, 3, 1, 1, 1, 1))
net_2:add(nn.SpatialConvolution(192, 64, 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, 0))
net_3:add(nn.SpatialConvolution(192, 64, 1, 1, 1, 1))
net_3:add(nn.ReLU(true))
net_3:add(nn.SpatialConvolution(64, 64, 3, 3, 1, 1, 1, 1))
net_3:add(nn.ReLU(true))
local net_4 = nn.Sequential()
net_4:add(nn.SpatialConvolution(192, 64, 1, 1, 1, 1, 0))
net_4:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_4:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_4:add(nn.SpatialConvolution(192, 32, 1, 1, 1, 1))
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, 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)
concat_24:add(net_5)
concat_24:add(net_4)
concat_24:add(net_3)
concat_24:add(net_2)
concat_24:add(net)
net:add(concat_24)
local net_5 = nn.Sequential()
net_5:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1))
net_5:add(nn.ReLU(true))
local net_6 = nn.Sequential()
net_6:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1, 0))
net_6:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1))
net_6:add(nn.ReLU(true))
net_6:add(nn.SpatialConvolution(64, 96, 3, 3, 1, 1, 1, 1))
net_6:add(nn.ReLU(true))
local net_7 = nn.Sequential()
net_7:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1, 0))
net_7:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1))
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))
net_7:add(nn.SpatialConvolution(96, 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, 0))
net_8:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_8:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_8:add(nn.SpatialConvolution(256, 64, 1, 1, 1, 1))
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))
net_8:add(nn.SpatialConvolution(96, 96, 3, 3, 1, 1, 1, 1))
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, 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)
concat_41:add(net_9)
concat_41:add(net_8)
concat_41:add(net_7)
concat_41:add(net_6)
concat_41:add(net_5)
net:add(concat_41)
local net_9 = nn.Sequential()
net_9:add(nn.SpatialConvolution(320, 128, 1, 1, 1, 1))
net_9:add(nn.ReLU(true))
net_9:add(nn.SpatialConvolution(128, 160, 3, 3, 1, 1, 1, 1))
net_9:add(nn.ReLU(true))
local net_10 = nn.Sequential()
net_10:add(nn.SpatialConvolution(320, 128, 1, 1, 1, 1, 0))
net_10:add(nn.SpatialConvolution(320, 64, 1, 1, 1, 1))
net_10:add(nn.ReLU(true))
net_10:add(nn.SpatialConvolution(128, 160, 3, 3, 1, 1, 1, 1))
net_10:add(nn.SpatialConvolution(64, 96, 3, 3, 1, 1, 1, 1))
net_10:add(nn.ReLU(true))
net_10:add(nn.SpatialConvolution(96, 96, 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, 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))
net_11:add(nn.SpatialConvolution(96, 96, 3, 3, 1, 1, 1, 1))
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, 0, 0))
net_11:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_11:add(nn.SpatialMaxPooling(3, 3, 1, 1))
local concat_54 = nn.Concat(2)
concat_54:add(net_12)
concat_54:add(net_11)
concat_54:add(net_10)
concat_54:add(net_9)
net:add(concat_54)
net:add(nn.SpatialConvolution(576, 576, 2, 2, 2, 2, 0))
net:add(nn.SpatialConvolution(576, 576, 2, 2, 2, 2))
local net_12 = nn.Sequential()
net_12:add(nn.SpatialConvolution(576, 224, 1, 1, 1, 1))
net_12:add(nn.ReLU(true))
local net_13 = nn.Sequential()
net_13:add(nn.SpatialConvolution(576, 224, 1, 1, 1, 1, 0))
net_13:add(nn.SpatialConvolution(576, 64, 1, 1, 1, 1))
net_13:add(nn.ReLU(true))
net_13:add(nn.SpatialConvolution(64, 96, 3, 3, 1, 1, 1, 1))
net_13:add(nn.ReLU(true))
local net_14 = nn.Sequential()
net_14:add(nn.SpatialConvolution(576, 64, 1, 1, 1, 1, 0))
net_14:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1))
net_14:add(nn.ReLU(true))
net_14:add(nn.SpatialConvolution(64, 96, 3, 3, 1, 1, 1, 1))
net_14:add(nn.SpatialConvolution(96, 128, 3, 3, 1, 1, 1, 1))
net_14:add(nn.ReLU(true))
net_14:add(nn.SpatialConvolution(128, 128, 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, 0))
net_15:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_15:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_15:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
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))
net_15:add(nn.SpatialConvolution(128, 128, 3, 3, 1, 1, 1, 1))
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, 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)
concat_72:add(net_16)
concat_72:add(net_15)
concat_72:add(net_14)
concat_72:add(net_13)
concat_72:add(net_12)
net:add(concat_72)
local net_16 = nn.Sequential()
net_16:add(nn.SpatialConvolution(576, 192, 1, 1, 1, 1))
net_16:add(nn.ReLU(true))
local net_17 = nn.Sequential()
net_17:add(nn.SpatialConvolution(576, 192, 1, 1, 1, 1, 0))
net_17:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1))
net_17:add(nn.ReLU(true))
net_17:add(nn.SpatialConvolution(96, 128, 3, 3, 1, 1, 1, 1))
net_17:add(nn.ReLU(true))
local net_18 = nn.Sequential()
net_18:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1, 0))
net_18:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1))
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))
net_18:add(nn.SpatialConvolution(128, 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, 0))
net_19:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_19:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_19:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
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))
net_19:add(nn.SpatialConvolution(128, 128, 3, 3, 1, 1, 1, 1))
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, 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)
concat_89:add(net_20)
concat_89:add(net_19)
concat_89:add(net_18)
concat_89:add(net_17)
concat_89:add(net_16)
net:add(concat_89)
local net_20 = nn.Sequential()
net_20:add(nn.SpatialConvolution(576, 160, 1, 1, 1, 1))
net_20:add(nn.ReLU(true))
local net_21 = nn.Sequential()
net_21:add(nn.SpatialConvolution(576, 160, 1, 1, 1, 1, 0))
net_21:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
net_21:add(nn.ReLU(true))
net_21:add(nn.SpatialConvolution(128, 160, 3, 3, 1, 1, 1, 1))
net_21:add(nn.ReLU(true))
local net_22 = nn.Sequential()
net_22:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1, 0))
net_22:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
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))
net_22:add(nn.SpatialConvolution(160, 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, 0))
net_23:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_23:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_23:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1))
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))
net_23:add(nn.SpatialConvolution(160, 160, 3, 3, 1, 1, 1, 1))
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, 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)
concat_106:add(net_24)
concat_106:add(net_23)
concat_106:add(net_22)
concat_106:add(net_21)
concat_106:add(net_20)
net:add(concat_106)
local net_24 = nn.Sequential()
net_24:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1))
net_24:add(nn.ReLU(true))
local net_25 = nn.Sequential()
net_25:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1, 0))
net_25:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
net_25:add(nn.ReLU(true))
net_25:add(nn.SpatialConvolution(128, 192, 3, 3, 1, 1, 1, 1))
net_25:add(nn.ReLU(true))
local net_26 = nn.Sequential()
net_26:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1, 0))
net_26:add(nn.SpatialConvolution(576, 160, 1, 1, 1, 1))
net_26:add(nn.ReLU(true))
net_26:add(nn.SpatialConvolution(128, 192, 3, 3, 1, 1, 1, 1))
net_26:add(nn.SpatialConvolution(160, 192, 3, 3, 1, 1, 1, 1))
net_26:add(nn.ReLU(true))
net_26:add(nn.SpatialConvolution(192, 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, 0))
net_27:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_27:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_27:add(nn.SpatialConvolution(576, 96, 1, 1, 1, 1))
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))
net_27:add(nn.SpatialConvolution(192, 192, 3, 3, 1, 1, 1, 1))
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, 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)
concat_123:add(net_28)
concat_123:add(net_27)
concat_123:add(net_26)
concat_123:add(net_25)
concat_123:add(net_24)
net:add(concat_123)
local net_28 = nn.Sequential()
net_28:add(nn.SpatialConvolution(576, 192, 1, 1, 1, 1))
net_28:add(nn.ReLU(true))
net_28:add(nn.SpatialConvolution(192, 256, 3, 3, 1, 1, 1, 1))
net_28:add(nn.ReLU(true))
net_28:add(nn.SpatialConvolution(256, 256, 3, 3, 1, 1, 1, 1))
net_28:add(nn.ReLU(true))
local net_29 = nn.Sequential()
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))
net_29:add(nn.SpatialConvolution(256, 256, 3, 3, 1, 1, 1, 1))
net_29:add(nn.ReLU(true))
net_29:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_29:add(nn.SpatialMaxPooling(3, 3, 1, 1))
local net_30 = nn.Sequential()
net_30:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_30:add(nn.SpatialMaxPooling(3, 3, 1, 1, 0, 0))
net_30:add(nn.SpatialAveragePooling(5, 5, 3, 3))
net_30:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
net_30:add(nn.View())
net_30:add(nn.Linear(2048, 768))
net_30:add(nn.ReLU())
net_30:add(nn.Linear(768, 4))
net_30:add(nn.LogSoftMax())
local net_31 = nn.Sequential()
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())
net_31:add(nn.Linear(768, 4))
net_31:add(nn.LogSoftMax())
net_31:add(nn.SpatialConvolution(576, 128, 1, 1, 1, 1))
net_31:add(nn.ReLU(true))
net_31:add(nn.SpatialConvolution(128, 192, 3, 3, 1, 1, 1, 1))
net_31:add(nn.ReLU(true))
local concat_143 = nn.Concat(2)
concat_143:add(net_31)
concat_143:add(net_29)
concat_143:add(net_28)
net:add(concat_143)
local net_32 = nn.Sequential()
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))
net_32:add(nn.SpatialConvolution(1024, 1024, 2, 2, 2, 2))
local concat_136 = nn.Concat(2)
concat_136:add(net_32)
concat_136:add(net_30)
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, 0))
net_33:add(nn.SpatialConvolution(1024, 352, 1, 1, 1, 1))
net_33:add(nn.ReLU(true))
local net_34 = nn.Sequential()
net_34:add(nn.SpatialConvolution(1024, 352, 1, 1, 1, 1, 0))
net_34:add(nn.SpatialConvolution(1024, 192, 1, 1, 1, 1))
net_34:add(nn.ReLU(true))
net_34:add(nn.SpatialConvolution(192, 320, 3, 3, 1, 1, 1, 1))
net_34:add(nn.ReLU(true))
local net_35 = nn.Sequential()
net_35:add(nn.SpatialConvolution(1024, 192, 1, 1, 1, 1, 0))
net_35:add(nn.SpatialConvolution(1024, 160, 1, 1, 1, 1))
net_35:add(nn.ReLU(true))
net_35:add(nn.SpatialConvolution(192, 320, 3, 3, 1, 1, 1, 1))
net_35:add(nn.SpatialConvolution(160, 224, 3, 3, 1, 1, 1, 1))
net_35:add(nn.ReLU(true))
net_35:add(nn.SpatialConvolution(224, 224, 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, 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))
net_36:add(nn.SpatialConvolution(224, 224, 3, 3, 1, 1, 1, 1))
net_36:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_36:add(nn.SpatialAveragePooling(3, 3, 1, 1))
net_36:add(nn.SpatialConvolution(1024, 128, 1, 1, 1, 1))
net_36:add(nn.ReLU(true))
local concat_161 = nn.Concat(2)
concat_161:add(net_36)
concat_161:add(net_35)
concat_161:add(net_34)
concat_161:add(net_33)
net_32:add(concat_161)
local net_37 = nn.Sequential()
net_37:add(nn.SpatialZeroPadding(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.SpatialConvolution(1024, 352, 1, 1, 1, 1))
net_37:add(nn.ReLU(true))
local concat_154 = nn.Concat(2)
concat_154:add(net_37)
concat_154:add(net_36)
concat_154:add(net_35)
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, 0))
net_38:add(nn.SpatialConvolution(1024, 192, 1, 1, 1, 1))
net_38:add(nn.ReLU(true))
net_38:add(nn.SpatialConvolution(192, 320, 3, 3, 1, 1, 1, 1))
net_38:add(nn.ReLU(true))
local net_39 = nn.Sequential()
net_39:add(nn.SpatialConvolution(1024, 192, 1, 1, 1, 1, 0))
net_39:add(nn.SpatialConvolution(1024, 192, 1, 1, 1, 1))
net_39:add(nn.ReLU(true))
net_39:add(nn.SpatialConvolution(192, 320, 3, 3, 1, 1, 1, 1))
net_39:add(nn.SpatialConvolution(192, 224, 3, 3, 1, 1, 1, 1))
net_39:add(nn.ReLU(true))
net_39:add(nn.SpatialConvolution(224, 224, 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, 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))
net_40:add(nn.SpatialConvolution(224, 224, 3, 3, 1, 1, 1, 1))
net_40:add(nn.SpatialZeroPadding(1, 1, 1, 1))
net_40:add(nn.SpatialMaxPooling(3, 3, 1, 1))
net_40:add(nn.SpatialConvolution(1024, 128, 1, 1, 1, 1))
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, 0, 0))
net_41:add(nn.SpatialConvolution(1024, 128, 1, 1, 1, 1, 0))
net_41:add(nn.ReLU(true))
local concat_178 = nn.Concat(2)
concat_178:add(net_40)
concat_178:add(net_39)
concat_178:add(net_38)
concat_178:add(net_37)
local concat_171 = nn.Concat(2)
concat_171:add(net_41)
concat_171:add(net_40)
concat_171:add(net_39)
concat_171:add(net_38)
net_33:add(concat_171)
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())
net_32:add(concat_178)
net_32:add(nn.SpatialAveragePooling(7, 7, 1, 1))
net_32:add(nn.View())
net_32:add(nn.Linear(1024, 4))
net_32:add(nn.LogSoftMax())
local concat_183 = nn.Concat(2)
concat_183:add(net_33)
concat_183:add(net_31)
concat_183:add(net_32)
concat_183:add(net_30)
net:add(concat_183)
+6 -5
Ver Arquivo
@@ -1,19 +1,20 @@
require 'nn'
require 'rnn'
local net = nn.Sequential()
net:add(nn.SpatialConvolution(3, 96, 11, 11, 4, 4, 0))
net:add(nn.SpatialConvolution(3, 96, 11, 11, 4, 4))
net:add(nn.ReLU(true))
net:add(nn.SpatialMaxPooling(2, 2, 2, 2, 0, 0))
net:add(nn.SpatialConvolution(96, 256, 5, 5, 1, 1, 0))
net:add(nn.SpatialMaxPooling(2, 2, 2, 2))
net:add(nn.SpatialConvolution(96, 256, 5, 5, 1, 1))
net:add(nn.ReLU(true))
net:add(nn.SpatialMaxPooling(2, 2, 2, 2, 0, 0))
net:add(nn.SpatialMaxPooling(2, 2, 2, 2))
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, 0, 0))
net:add(nn.SpatialMaxPooling(2, 2, 2, 2))
net:add(nn.View())
net:add(nn.Dropout(0.5))
net:add(nn.Linear(25600, 3072))
+156 -138
Ver Arquivo
@@ -1,8 +1,30 @@
- type: SpatialConvolution
id: /P/0
- type: ReLU
id: /b/6
next:
- /P/2
- /b/oG
attributes:
p: ''
ctor_arg_order: p
- type: ReLU
id: /b/7
next:
- /b/u4
attributes:
p: ''
ctor_arg_order: p
- type: ReLU
id: /b/9
next:
- /b/X
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /b/I8
next:
- /b/9
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
@@ -12,32 +34,46 @@
nOutputPlane: 384
nInputPlane: 192
- type: ReLU
id: /P/2
id: /b/K
next:
- /P/fX
- /b/w
attributes:
ctor_arg_order: p
p: true
- type: Dropout
id: /P/6
- type: ReLU
id: /b/N
next:
- /P/C
- /b/s
attributes:
v1: ''
inplace: ''
p: 0.5
- type: Linear
id: /P/8p
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /b/U
next:
- /P/S8
- /b/W
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 3
kW: 3
- type: Linear
id: /b/V
next:
- /b/7
attributes:
bias: ''
outputSize: 5
inputSize: 4096
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 9216
- type: SpatialConvolution
id: /P/A
id: /b/W
next:
- /P/j
- /b/N
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 2
padW: 2
dH: 1
@@ -46,108 +82,12 @@
kW: 5
nOutputPlane: 192
nInputPlane: 64
- type: Linear
id: /P/C
next:
- /P/mQ
attributes:
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
id: /b/X
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: ReLU
id: /P/e
next:
- /P/8p
attributes:
p: ''
- type: SpatialConvolution
id: /P/fX
next:
- /P/F
- /b/o
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
@@ -156,39 +96,117 @@
kW: 3
nOutputPlane: 256
nInputPlane: 384
- type: ReLU
id: /P/i
- type: SpatialConvolution
id: /b/b
next:
- /P/n5
- /b/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: View
id: /b/c
next:
- /b/v
attributes:
ctor_arg_order: params
params: 9216
- type: SpatialConvolution
id: /b/d
next:
- /b/q
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: LogSoftMax
id: /b/iW
next: []
attributes:
ctor_arg_order: ''
- type: ReLU
id: /b/o
next:
- /b/b
attributes:
ctor_arg_order: p
p: true
- type: ReLU
id: /P/j
- type: Linear
id: /b/oG
next:
- /P/c
- /b/iW
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 5
inputSize: 4096
- type: ReLU
id: /b/q
next:
- /b/U
attributes:
ctor_arg_order: p
p: true
- type: ReLU
id: /P/mQ
next:
- /P/L
attributes:
p: ''
- type: SpatialMaxPooling
id: /P/n5
id: /b/s
next:
- /P/M
- /b/I8
attributes:
padW: 0
padH: 0
ceil_mode: false
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 3
kW: 3
- type: ReLU
id: /P/q
- type: Dropout
id: /b/u4
next:
- /P/J
- /b/x
attributes:
p: true
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace'
p: 0.5
- type: Dropout
id: /b/v
next:
- /b/V
attributes:
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace'
p: 0.5
- type: SpatialMaxPooling
id: /b/w
next:
- /b/c
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 3
kW: 3
- type: Linear
id: /b/x
next:
- /b/6
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 4096
+217 -192
Ver Arquivo
@@ -1,8 +1,46 @@
- type: SpatialConvolution
id: /A/0
- type: ReLU
id: /V/1
next:
- /A/w
- /V/M
attributes:
ctor_arg_order: p
p: true
- type: Linear
id: /V/29
next:
- /V/s
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 10
inputSize: 4096
- type: Dropout
id: /V/3
next:
- /V/Q
attributes:
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace'
p: 0.5
- type: SpatialMaxPooling
id: /V/4
next:
- /V/o
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 3
kW: 3
- type: SpatialConvolution
id: /V/6
next:
- /V/Z
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
@@ -11,171 +49,67 @@
kW: 3
nOutputPlane: 384
nInputPlane: 192
- type: LogSoftMax
id: /A/2
next: []
attributes: {}
- type: ReLU
id: /A/3
- type: SpatialBatchNormalization
id: /V/8
next:
- /A/H
- /V/R
attributes:
p: ''
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 64
- type: ReLU
id: /A/6
id: /V/F
next:
- /A/NJ
- /V/a
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /A/7
- type: SpatialBatchNormalization
id: /V/G
next:
- /A/G
- /V/O
attributes:
padW: 0
padH: 0
ceil_mode: false
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: 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
id: /V/N
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
- /V/g
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
@@ -184,35 +118,19 @@
kW: 3
nOutputPlane: 256
nInputPlane: 384
- type: SpatialMaxPooling
id: /A/nm
- type: ReLU
id: /V/O
next:
- /A/0
- /V/k
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
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /A/r
id: /V/P
next:
- /A/l
- /V/8
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 2
padW: 2
dH: 4
@@ -221,32 +139,103 @@
kW: 11
nOutputPlane: 64
nInputPlane: 3
- type: ReLU
id: /A/r7
- type: Linear
id: /V/Q
next:
- /A/h
- /V/Qm
attributes:
p: ''
- type: ReLU
id: /A/t
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 4096
- type: BatchNormalization
id: /V/Qm
next:
- /A/nm
attributes:
p: true
- type: SpatialBatchNormalization
id: /A/w
next:
- /A/d
- /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
next:
- /V/H
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 384
- type: SpatialConvolution
id: /A/y
id: /V/a
next:
- /A/I
- /V/z
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: 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
next:
- /V/F
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 256
- type: Linear
id: /V/iP
next:
- /V/b
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 9216
- type: SpatialMaxPooling
id: /V/k
next:
- /V/6
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
@@ -255,3 +244,39 @@
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'
eps: 0.001
nOutput: 256
+63 -52
Ver Arquivo
@@ -1,76 +1,87 @@
- type: Reshape
id: /J/1
next:
- /J/5
attributes:
params: 100
- type: Linear
id: /J/5
id: /k/5
next:
- /J/x
- /k/a
attributes:
bias: ''
outputSize: 300
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 100
inputSize: 100
- type: Sigmoid
id: /J/F
next:
- /J/z
attributes: {}
- type: ReLU
id: /J/G
next:
- /J/q
attributes:
p: ''
- type: SoftMax
id: /J/Y
next: []
attributes: {}
- type: LeakyReLU
id: /J/c
next:
- /J/m
attributes:
negval: ''
ip: false
- type: Linear
id: /J/d
id: /k/6
next:
- /J/G
- /k/Y
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 100
inputSize: 300
- type: SoftMax
id: /k/O
next: []
attributes:
ctor_arg_order: ''
- type: Linear
id: /J/m
id: /k/S
next:
- /J/Y
- /k/y
attributes:
bias: ''
outputSize: 5
inputSize: 120
- type: Linear
id: /J/q
next:
- /J/F
attributes:
bias: ''
outputSize: 100
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 120
inputSize: 100
- type: RReLU
id: /J/x
- type: Linear
id: /k/V
next:
- /J/d
- /k/i
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 300
inputSize: 100
- type: ReLU
id: /k/Y
next:
- /k/5
attributes:
p: ''
ctor_arg_order: p
- type: Sigmoid
id: /k/a
next:
- /k/S
attributes:
ctor_arg_order: ''
- type: RReLU
id: /k/i
next:
- /k/6
attributes:
l: ''
u: ''
ip: false
ip: ''
ctor_arg_order: 'l,u,ip'
- type: Linear
id: /J/z
id: /k/p
next:
- /J/c
- /k/O
attributes:
bias: ''
outputSize: 120
inputSize: 100
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 5
inputSize: 120
- type: Reshape
id: /k/q
next:
- /k/V
attributes:
ctor_arg_order: params
params: 100
- type: LeakyReLU
id: /k/y
next:
- /k/p
attributes:
negval: ''
ip: ''
ctor_arg_order: 'negval,ip'
+15 -12
Ver Arquivo
@@ -1,29 +1,32 @@
- type: Reshape
id: /x/3
next:
- /x/K
attributes:
params: 100
- type: Linear
id: /x/K
id: /Q/E
next:
- /x/e
- /Q/e
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 300
inputSize: 100
- type: Linear
id: /x/N
id: /Q/Q
next: []
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 10
inputSize: 300
- type: HardTanh
id: /x/e
id: /Q/e
next:
- /x/N
- /Q/Q
attributes:
min_value: ''
max_value: 1
inplace: ''
ctor_arg_order: 'min_value,max_value'
- type: Reshape
id: /Q/j
next:
- /Q/E
attributes:
ctor_arg_order: params
params: 100
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+101 -91
Ver Arquivo
@@ -1,109 +1,119 @@
- type: LogSoftMax
id: /g/2
next: []
attributes: {}
- type: View
id: /g/5
next:
- /g/U
attributes:
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
id: /K/3
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
- /K/P
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 120
inputSize: 400
- type: SpatialMaxPooling
id: /g/W
- type: Linear
id: /K/8
next:
- /g/5
- /K/t
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 84
inputSize: 120
- type: SpatialConvolution
id: /g/X
id: /K/B
next:
- /g/m
- /K/m
attributes:
dW: ''
dH: ''
padW: 0
padH: ''
kH: 5
kW: 5
nOutputPlane: 16
nInputPlane: 6
- type: ReLU
id: /g/g
next:
- /g/E
attributes:
p: ''
- type: ReLU
id: /g/m
next:
- /g/W
attributes:
p: ''
- type: SpatialConvolution
id: /g/w
next:
- /g/H
attributes:
dW: ''
dH: ''
padW: 0
padW: ''
padH: ''
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
kH: 5
kW: 5
nOutputPlane: 6
nInputPlane: 3
- type: SpatialConvolution
id: /K/E
next:
- /K/e
attributes:
dW: ''
dH: ''
padW: ''
padH: ''
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
kH: 5
kW: 5
nOutputPlane: 16
nInputPlane: 6
- type: SpatialMaxPooling
id: /K/K
next:
- /K/E
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: LogSoftMax
id: /K/N
next: []
attributes:
ctor_arg_order: ''
- type: ReLU
id: /K/P
next:
- /K/8
attributes:
p: ''
ctor_arg_order: p
- type: ReLU
id: /K/e
next:
- /K/j
attributes:
p: ''
ctor_arg_order: p
- type: SpatialMaxPooling
id: /K/j
next:
- /K/z9
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: ReLU
id: /K/m
next:
- /K/K
attributes:
p: ''
ctor_arg_order: p
- type: ReLU
id: /K/t
next:
- /K/u
attributes:
p: ''
ctor_arg_order: p
- type: Linear
id: /K/u
next:
- /K/N
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 10
inputSize: 84
- type: View
id: /K/z9
next:
- /K/3
attributes:
ctor_arg_order: params
params: 400
+415 -376
Ver Arquivo
@@ -1,370 +1,9 @@
- 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
id: /J/1
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
- /J/G
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 5
padW: 5
dH: 4
@@ -373,11 +12,170 @@
kW: 11
nOutputPlane: 96
nInputPlane: 3
- type: SpatialConvolution
id: /k/x2
- type: ReLU
id: /J/1n
next:
- /k/p
- /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
next:
- /J/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
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
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /J/P
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
@@ -386,19 +184,260 @@
kW: 3
nOutputPlane: 1024
nInputPlane: 384
- type: View
id: /k/yv
- type: SpatialConvolution
id: /J/W
next:
- /k/S
- /J/E
attributes:
params: -1
numInputDims: 3
- type: SpatialBatchNormalization
id: /k/z
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: ReLU
id: /J/X
next:
- /k/A
- /J/h
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: 96
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
next:
- /J/Xj
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: SpatialConvolution
id: /J/b
next:
- /J/q
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: 256
nInputPlane: 96
- type: SpatialConvolution
id: /J/c
next:
- /J/95
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: /J/d
next:
- /J/Y
attributes:
ctor_arg_order: p
p: true
- type: SpatialBatchNormalization
id: /J/e
next:
- /J/n
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 256
- type: ReLU
id: /J/f
next:
- /J/4l
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /J/g
next:
- /J/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: 384
nInputPlane: 256
- type: SpatialConvolution
id: /J/h
next:
- /J/6
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
- type: ReLU
id: /J/n
next:
- /J/8
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
next:
- /J/F
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: /J/q
next:
- /J/N
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
next:
- /J/KE
attributes:
momentum: ''
affine: ''
ctor_arg_order: 'nOutput,eps,momentum,affine'
eps: 0.001
nOutput: 1024
+141 -123
Ver Arquivo
@@ -1,99 +1,80 @@
- type: Linear
id: /9/2
id: /x/0
next:
- /9/U
- /x/E
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,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
id: /x/6
next:
- /9/p
- /x/R
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
padW: ''
padH: ''
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
dH: 1
dW: 1
kH: 5
kW: 5
nOutputPlane: 256
nInputPlane: 96
- type: Linear
id: /9/AQ
- type: SpatialConvolution
id: /x/8
next:
- /9/m
- /x/K
attributes:
padW: ''
padH: ''
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
dH: 4
dW: 4
kH: 11
kW: 11
nOutputPlane: 96
nInputPlane: 3
- type: Linear
id: /x/9
next:
- /x/u
attributes:
bias: ''
outputSize: 7
inputSize: 4096
- type: View
id: /9/Ae
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 3072
inputSize: 25600
- type: Dropout
id: /x/A
next:
- /9/V
- /x/0
attributes:
numInputDims: null
params: 25600
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace'
p: 0.5
- type: ReLU
id: /9/F
id: /x/D
next:
- /9/3
- /x/J
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /9/I
- type: Threshold
id: /x/E
next:
- /9/A
- /x/o
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
ip: ''
ctor_arg_order: 'th,v,ip'
v: 0.000001
th: 0
- type: SpatialConvolution
id: /9/L
id: /x/J
next:
- /9/z
- /x/Q
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
@@ -101,56 +82,116 @@
kH: 3
kW: 3
nOutputPlane: 1024
nInputPlane: 512
nInputPlane: 1024
- type: ReLU
id: /9/P
id: /x/K
next:
- /9/J
- /x/X
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /x/N
next:
- /x/x
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: ReLU
id: /x/Q
next:
- /x/j
attributes:
ctor_arg_order: p
p: true
- type: ReLU
id: /9/Q
id: /x/R
next:
- /9/L
- /x/N
attributes:
ctor_arg_order: p
p: true
- type: View
id: /x/U
next:
- /x/r
attributes:
ctor_arg_order: params
params: 25600
- type: SpatialMaxPooling
id: /x/X
next:
- /x/6
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: LogSoftMax
id: /x/d
next: []
attributes:
ctor_arg_order: ''
- type: SpatialMaxPooling
id: /x/j
next:
- /x/U
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: Linear
id: /9/T
id: /x/o
next:
- /9/UZ
- /x/d
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
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 7
inputSize: 4096
- type: Dropout
id: /9/V
id: /x/r
next:
- /9/T
- /x/9
attributes:
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace'
p: 0.5
- type: SpatialConvolution
id: /9/a
- type: ReLU
id: /x/t
next:
- /9/Q
- /x/z
attributes:
ctor_arg_order: p
p: true
- type: Threshold
id: /x/u
next:
- /x/A
attributes:
ip: ''
ctor_arg_order: 'th,v,ip'
v: 0.000001
th: 0
- type: SpatialConvolution
id: /x/x
next:
- /x/t
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
@@ -160,10 +201,11 @@
nOutputPlane: 512
nInputPlane: 256
- type: SpatialConvolution
id: /9/l
id: /x/z
next:
- /9/F
- /x/D
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
@@ -171,28 +213,4 @@
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
nInputPlane: 512
+13
Ver Arquivo
@@ -0,0 +1,13 @@
- type: Transpose
id: /O/c
next:
- /O/j
attributes:
ctor_arg_order: params
params: '{1, 2}'
- type: Transpose
id: /O/j
next: []
attributes:
ctor_arg_order: params
params: '{{1, 2}, {3, 4}}'
+271 -247
Ver Arquivo
@@ -1,261 +1,28 @@
- type: ReLU
id: /2/4
id: /d/1
next:
- /2/i
attributes:
p: true
- type: Linear
id: /2/6
next:
- /2/X
attributes:
bias: ''
outputSize: 10
inputSize: 4096
- type: Linear
id: /2/7
next:
- /2/74
attributes:
bias: ''
outputSize: 4096
inputSize: 25088
- type: Threshold
id: /2/74
next:
- /2/Yu
attributes:
ip: ''
v: 0.000001
th: 0
- type: ReLU
id: /2/9
next:
- /2/m
attributes:
p: true
- type: SpatialConvolution
id: /2/C
next:
- /2/mo
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 512
nInputPlane: 512
- type: ReLU
id: /2/D
next:
- /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
- /d/r
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /2/O
id: /d/3
next:
- /2/u
- /d/v
attributes:
padW: 0
padH: 0
ceil_mode: false
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialConvolution
id: /2/P
id: /d/5
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
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 256
nInputPlane: 128
- type: SpatialConvolution
id: /2/i
next:
- /2/e
attributes:
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 256
nInputPlane: 256
- type: Threshold
id: /2/j
next:
- /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: SpatialConvolution
id: /2/q
next:
- /2/M
attributes:
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
- /d/q
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
@@ -264,11 +31,224 @@
kW: 3
nOutputPlane: 64
nInputPlane: 3
- type: SpatialConvolution
id: /2/z
- type: Linear
id: /d/8
next:
- /2/9
- /d/n
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 25088
- type: SpatialConvolution
id: /d/C
next:
- /d/H
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: SpatialConvolution
id: /d/Cc
next:
- /d/S
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: /d/F
next:
- /d/U
attributes:
ctor_arg_order: p
p: true
- type: Linear
id: /d/Fd
next:
- /d/XQ
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 10
inputSize: 4096
- type: ReLU
id: /d/H
next:
- /d/L
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /d/L
next:
- /d/x
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: SpatialMaxPooling
id: /d/M
next:
- /d/t
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: ReLU
id: /d/RS
next:
- /d/Cc
attributes:
ctor_arg_order: p
p: true
- type: ReLU
id: /d/S
next:
- /d/W
attributes:
ctor_arg_order: p
p: true
- type: SpatialMaxPooling
id: /d/U
next:
- /d/C
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialMaxPooling
id: /d/W
next:
- /d/e
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: LogSoftMax
id: /d/XQ
next: []
attributes:
ctor_arg_order: ''
- type: ReLU
id: /d/Y
next:
- /d/c
attributes:
ctor_arg_order: p
p: true
- type: Dropout
id: /d/Z
next:
- /d/bt
attributes:
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace'
p: 0.5
- type: Dropout
id: /d/Z5
next:
- /d/Fd
attributes:
v1: ''
inplace: ''
ctor_arg_order: 'p,v1,inplace'
p: 0.5
- type: Linear
id: /d/bt
next:
- /d/tR
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 4096
- type: SpatialMaxPooling
id: /d/c
next:
- /d/y
attributes:
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: View
id: /d/e
next:
- /d/8
attributes:
ctor_arg_order: params
params: 25088
- type: Threshold
id: /d/n
next:
- /d/Z
attributes:
ip: ''
ctor_arg_order: 'th,v,ip'
v: 0.000001
th: 0
- type: ReLU
id: /d/q
next:
- /d/M
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /d/r
next:
- /d/F
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: SpatialConvolution
id: /d/t
next:
- /d/Y
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
@@ -277,3 +257,47 @@
kW: 3
nOutputPlane: 128
nInputPlane: 64
- type: Threshold
id: /d/tR
next:
- /d/Z5
attributes:
ip: ''
ctor_arg_order: 'th,v,ip'
v: 0.000001
th: 0
- type: SpatialConvolution
id: /d/v
next:
- /d/RS
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: /d/x
next:
- /d/3
attributes:
ctor_arg_order: p
p: true
- type: SpatialConvolution
id: /d/y
next:
- /d/1
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
+256 -230
Ver Arquivo
@@ -1,147 +1,264 @@
- type: Linear
id: /S/1
next:
- /S/s
attributes:
bias: ''
outputSize: 4096
inputSize: 4096
- type: SpatialMaxPooling
id: /S/4
id: /f/0
next:
- /S/fu
- /f/y
attributes:
padW: 0
padH: 0
ceil_mode: false
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
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
id: /f/1V
next:
- /S/WQ
- /f/R
attributes:
numInputDims: null
ctor_arg_order: params
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
id: /f/3
next:
- /S/Iz
- /f/vo
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 1000
inputSize: 4096
- type: SpatialConvolution
id: /S/R
id: /f/4
next:
- /S/T
- /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: 128
nInputPlane: 64
- type: ReLU
id: /S/T
nOutputPlane: 512
nInputPlane: 512
- type: BatchNormalization
id: /f/4R
next:
- /S/M
- /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: /S/WQ
id: /f/R
next:
- /S/Ee
- /f/i
attributes:
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 25088
- type: SpatialConvolution
id: /S/X
- type: SpatialMaxPooling
id: /f/U
next:
- /S/7
- /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
@@ -150,137 +267,38 @@
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
id: /f/q
next:
- /S/B
- /f/n
attributes:
padW: 0
padH: 0
ceil_mode: false
padW: ''
padH: ''
ctor_arg_order: 'kW,kH,dW,dH,padW,padH'
dH: 2
dW: 2
kH: 2
kW: 2
- type: SpatialMaxPooling
id: /S/w
- type: Linear
id: /f/s
next:
- /S/R
- /f/6
attributes:
padW: 0
padH: 0
ceil_mode: false
dH: 2
dW: 2
kH: 2
kW: 2
bias: ''
ctor_arg_order: 'inputSize,outputSize,bias'
outputSize: 4096
inputSize: 4096
- type: LogSoftMax
id: /f/vo
next: []
attributes:
ctor_arg_order: ''
- type: SpatialConvolution
id: /S/x
id: /f/w
next:
- /S/C
- /f/N
attributes:
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
@@ -289,9 +307,17 @@
kW: 3
nOutputPlane: 64
nInputPlane: 3
- type: ReLU
id: /S/y
- type: SpatialConvolution
id: /f/y
next:
- /S/H
- /f/Y
attributes:
p: true
ctor_arg_order: 'nInputPlane,nOutputPlane,kW,kH,dW,dH,padW,padH'
padH: 1
padW: 1
dH: 1
dW: 1
kH: 3
kW: 3
nOutputPlane: 128
nInputPlane: 64
+7
Ver Arquivo
@@ -0,0 +1,7 @@
{
"Recurrent": {
"feedback": "nn.Module",
"input": "nn.Module",
"transfer": "nn.Module"
}
}
+29
Ver Arquivo
@@ -1,4 +1,32 @@
{
"RNN": [
"BiSequencer",
"BiSequencerLM",
"GRU",
"MaskZero",
"MaskZeroCriterion",
"Recurrence",
"Recurrent",
"RecurrentAttention",
"Recursor",
"Repeater",
"RepeaterCriterion",
"Sequencer",
"SequencerCriterion",
"TrimZero",
"CopyGrad",
"FastLSTM",
"LSTM",
"LookupTableMaskZero",
"NormStabilizer",
"SAdd",
"SeqBRNN",
"SeqGRU",
"SeqLSTM",
"SeqLSTMP",
"SeqReverseSequence"
],
"Convolution": [
"TemporalConvolution",
"TemporalMaxPooling",
@@ -65,6 +93,7 @@
],
"Simple": [
"Linear",
"LinearNoBias",
"SparseLinear",
"Dropout",
"Abs",
+51 -7
Ver Arquivo
@@ -7,20 +7,30 @@ var fs = require('fs'),
skipLayerList = require('./skipLayers.json'),
categories = require('./categories.json'),
SKIP_ARGS = require('./skipArgs.json'),
ARG_TYPES = require('./argTypes.json'),
catNames = Object.keys(categories),
exists = require('exists-file'),
configDir = process.env.HOME + '/.deepforge/',
configPath = configDir + 'config.json',
layerToCategory = {},
outputName = 'nn',
outputDst = 'src/plugins/CreateTorchMeta/schemas/',
config;
// Check the deepforge config
if (process.argv[2]) {
outputName = process.argv[2];
}
// Find the given package in the torch installation
torchPath = process.env.HOME + '/torch';
if (exists.sync(configPath)) {
if (exists.sync(configPath)) { // Check the deepforge config
config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
torchPath = (config.torch && config.torch.dir) || (configDir + 'torch');
}
torchPath += '/extra/nn/';
torchPath += `/install/share/lua/5.1/${outputName}/`;
console.log(`parsing ${outputName} from ${torchPath}`);
skipLayerList.forEach(name => SKIP_LAYERS[name] = true);
catNames.forEach(cat => // create layer -> category dictionary
@@ -40,7 +50,6 @@ 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 => LayerParser.parse(code))
.filter(layer => !!layer && layer.name);
@@ -53,17 +62,52 @@ fs.readdir(torchPath, function(err,files){
// handle inheritance
layers.forEach(layer => {
var iter = layer,
params = layer.params;
params = layer.params,
unsupArgs = SKIP_ARGS[layer.name],
type,
i;
while (iter && params === undefined) {
params = iter.params;
iter = layerByName[iter.baseType];
}
// Remove any unsupported (optional) args
if (unsupArgs) {
for (var k = params.length; k--;) {
i = unsupArgs.indexOf(params[k]);
if (i !== -1) {
// eslint-disable-next-line no-console
console.log(`Removing "${params[k]}" param from ${layer.name}`);
params = params.splice(0, k);
}
}
}
layer.params = params;
// Add any explicit types from argTypes.json
if (ARG_TYPES[layer.name]) {
for (i = layer.params.length; i--;) {
type = ARG_TYPES[layer.name][layer.params[i]];
if (type) {
// eslint-disable-next-line no-console
console.log(`Setting "${layer.params[i]}" (${layer.name}) to ${type}`);
layer.types[layer.params[i]] = type;
}
}
}
});
layers = layers.filter(layer => !SKIP_LAYERS[layer.name]);
outputDst += outputName + '.json';
// eslint-disable-next-line no-console
console.log('Saved nn interface to src/common/layers.json');
fs.writeFileSync('src/common/layers.json', JSON.stringify(layers, null, 2));
console.log('Saved nn interface to ' + outputDst);
fs.writeFileSync(outputDst, JSON.stringify(layers, null, 2));
// Update the CreateTorchMeta index
var updateSchemas = `${__dirname}/../src/plugins/CreateTorchMeta/update-schemas.js`,
job = require('child_process').fork(updateSchemas);
job.on('close', code => {
process.exit(code);
});
});
+5
Ver Arquivo
@@ -0,0 +1,5 @@
{
"SeqBRNN": [
"merge"
]
}
+19
Ver Arquivo
@@ -1,4 +1,23 @@
[
"AbstractRecurrent",
"AbstractSequencer",
"BiSequencer",
"BiSequencerLM",
"GRU",
"MaskZero",
"MaskZeroCriterion",
"Recurrence",
"RecurrentAttention",
"Recursor",
"Repeater",
"RepeaterCriterion",
"Sequencer",
"SequencerCriterion",
"TrimZero",
"Bottle",
"GPU",
"Sequential",
"Container",
"Criterion",
+10
Ver Arquivo
@@ -215,6 +215,13 @@
"panel": "src/visualizers/panels/ImageViewer",
"secondary": false,
"widget": "src/visualizers/widgets/ImageViewer"
},
"ExecutionIndex": {
"src": "panels/ExecutionIndex/ExecutionIndexPanel",
"title": "ExecutionIndex",
"panel": "src/visualizers/panels/ExecutionIndex",
"secondary": false,
"widget": "src/visualizers/widgets/ExecutionIndex"
}
},
"addons": {},
@@ -236,6 +243,9 @@
},
"ArtifactOpDecorator": {
"src": "src/decorators/ArtifactOpDecorator"
},
"LayerDecorator": {
"src": "src/decorators/LayerDecorator"
}
},
"seeds": {