Skip to content

Commit

Permalink
Added support for variable arguments in nn importer. Fixes #328
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy Whitaker committed Jun 20, 2016
1 parent f301e93 commit f24f9bd
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 8 deletions.
52 changes: 44 additions & 8 deletions src/common/layers.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@
{
"name": "CMul",
"baseType": "Module",
"params": [],
"params": [
"VariableArguments"
],
"type": "Simple",
"setters": []
},
Expand Down Expand Up @@ -285,7 +287,9 @@
{
"name": "GradientReversal",
"baseType": "Module",
"params": [],
"params": [
"lambda"
],
"type": "Misc",
"setters": []
},
Expand Down Expand Up @@ -394,9 +398,7 @@
{
"name": "Log",
"baseType": "Module",
"params": [
"inputSize"
],
"params": [],
"type": "Misc",
"setters": []
},
Expand Down Expand Up @@ -712,7 +714,9 @@
{
"name": "Reshape",
"baseType": "Module",
"params": [],
"params": [
"VariableArguments"
],
"type": "Simple",
"setters": []
},
Expand Down Expand Up @@ -844,6 +848,16 @@
"type": "Convolution",
"setters": []
},
{
"name": "SpatialClassNLLCriterion",
"baseType": "Criterion",
"params": [
"weights",
"sizeAverage"
],
"type": "Criterion",
"setters": []
},
{
"name": "SpatialContrastiveNormalization",
"baseType": "Module",
Expand Down Expand Up @@ -931,6 +945,24 @@
"type": "Convolution",
"setters": []
},
{
"name": "SpatialDilatedConvolution",
"baseType": "SpatialConvolution",
"params": [
"nInputPlane",
"nOutputPlane",
"kW",
"kH",
"dW",
"dH",
"padW",
"padH",
"dilationH",
"dilationW"
],
"type": "Convolution",
"setters": []
},
{
"name": "SpatialDivisiveNormalization",
"baseType": "Module",
Expand Down Expand Up @@ -1217,7 +1249,9 @@
{
"name": "Transpose",
"baseType": "Module",
"params": [],
"params": [
"VariableArguments"
],
"type": "Misc",
"setters": []
},
Expand All @@ -1234,7 +1268,9 @@
{
"name": "View",
"baseType": "Module",
"params": [],
"params": [
"VariableArguments"
],
"type": "Simple",
"setters": []
},
Expand Down
3 changes: 3 additions & 0 deletions utils/nn-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ var findInitParams = function(ast){
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] = 'VariableArguments'
}
}
});
return params;
Expand Down

0 comments on commit f24f9bd

Please sign in to comment.