Jelajahi Sumber

Update brace-style lint rule

Lutz Roeder 3 tahun lalu
induk
melakukan
f7c60d5291
18 mengubah file dengan 318 tambahan dan 123 penghapusan
  1. 1 1
      package.json
  2. 26 26
      source/app.js
  3. 3 1
      source/barracuda.js
  4. 3 1
      source/caffe.js
  5. 1 1
      source/cntk.js
  6. 32 29
      source/dagre.js
  7. 2 2
      source/dnn.js
  8. 3 1
      source/message.js
  9. 66 18
      source/mlnet.js
  10. 1 1
      source/mxnet.js
  11. 3 1
      source/onnx.js
  12. 1 1
      source/openvino.js
  13. 1 1
      source/paddle.js
  14. 3 1
      source/python.js
  15. 21 7
      source/pytorch.js
  16. 3 1
      source/tnn.js
  17. 145 29
      source/torch.js
  18. 3 1
      source/view.js

+ 1 - 1
package.json

@@ -39,7 +39,7 @@
         },
         "rules": {
             "array-callback-return": "error",
-            "brace-style": [ "error", "stroustrup", { "allowSingleLine": true } ],
+            "brace-style": [ "error", "stroustrup"  ],
             "curly": "error",
             "consistent-return": "error",
             "default-case": "error",

+ 26 - 26
source/app.js

@@ -402,7 +402,7 @@ class Application {
                     path: recent.path,
                     label: Application.minimizePath(recent.path),
                     accelerator: ((process.platform === 'darwin') ? 'Cmd+' : 'Ctrl+') + (i + 1).toString(),
-                    click: (item) => { this._openPath(item.path); }
+                    click: (item) => this._openPath(item.path)
                 });
             }
         }
@@ -433,7 +433,7 @@ class Application {
                 {
                     label: '&Open...',
                     accelerator: 'CmdOrCtrl+O',
-                    click: () => { this._openFileDialog(); }
+                    click: () => this._openFileDialog()
                 },
                 {
                     label: 'Open &Recent',
@@ -521,7 +521,7 @@ class Application {
                 {
                     id: 'view.toggle-direction',
                     accelerator: 'CmdOrCtrl+K',
-                    click: () => { this.execute('toggle', 'direction'); }
+                    click: () => this.execute('toggle', 'direction')
                 },
                 {
                     id: 'view.toggle-mousewheel',
@@ -584,11 +584,11 @@ class Application {
         const helpSubmenu = [
             {
                 label: '&Search Feature Requests',
-                click: () => { electron.shell.openExternal('https://www.github.com/' + this._package.repository + '/issues'); }
+                click: () => electron.shell.openExternal('https://www.github.com/' + this._package.repository + '/issues')
             },
             {
                 label: 'Report &Issues',
-                click: () => { electron.shell.openExternal('https://www.github.com/' + this._package.repository + '/issues/new'); }
+                click: () => electron.shell.openExternal('https://www.github.com/' + this._package.repository + '/issues/new')
             }
         ];
 
@@ -607,57 +607,57 @@ class Application {
 
         const commandTable = new Map();
         commandTable.set('file.export', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; }
+            enabled: (context) => context.view && context.view.path ? true : false
         });
         commandTable.set('edit.cut', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; }
+            enabled: (context) => context.view && context.view.path ? true : false
         });
         commandTable.set('edit.copy', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; }
+            enabled: (context) => context.view && context.view.path ? true : false
         });
         commandTable.set('edit.paste', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; }
+            enabled: (context) => context.view && context.view.path ? true : false
         });
         commandTable.set('edit.select-all', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; }
+            enabled: (context) => context.view && context.view.path ? true : false
         });
         commandTable.set('edit.find', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; }
+            enabled: (context) => context.view && context.view.path ? true : false
         });
         commandTable.set('view.toggle-attributes', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; },
-            label: (context) => { return !context.view || context.view.get('attributes') ? 'Hide &Attributes' : 'Show &Attributes'; }
+            enabled: (context) => context.view && context.view.path ? true : false,
+            label: (context) => !context.view || context.view.get('attributes') ? 'Hide &Attributes' : 'Show &Attributes'
         });
         commandTable.set('view.toggle-initializers', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; },
-            label: (context) => { return !context.view || context.view.get('initializers') ? 'Hide &Initializers' : 'Show &Initializers'; }
+            enabled: (context) => context.view && context.view.path ? true : false,
+            label: (context) => !context.view || context.view.get('initializers') ? 'Hide &Initializers' : 'Show &Initializers'
         });
         commandTable.set('view.toggle-names', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; },
-            label: (context) => { return !context.view || context.view.get('names') ? 'Hide &Names' : 'Show &Names'; }
+            enabled: (context) => context.view && context.view.path ? true : false,
+            label: (context) => !context.view || context.view.get('names') ? 'Hide &Names' : 'Show &Names'
         });
         commandTable.set('view.toggle-direction', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; },
-            label: (context) => { return !context.view || context.view.get('direction') === 'vertical' ? 'Show &Horizontal' : 'Show &Vertical'; }
+            enabled: (context) => context.view && context.view.path ? true : false,
+            label: (context) => !context.view || context.view.get('direction') === 'vertical' ? 'Show &Horizontal' : 'Show &Vertical'
         });
         commandTable.set('view.toggle-mousewheel', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; },
-            label: (context) => { return !context.view || context.view.get('mousewheel') === 'scroll' ? '&Mouse Wheel: Zoom' : '&Mouse Wheel: Scroll'; }
+            enabled: (context) => context.view && context.view.path ? true : false,
+            label: (context) => !context.view || context.view.get('mousewheel') === 'scroll' ? '&Mouse Wheel: Zoom' : '&Mouse Wheel: Scroll'
         });
         commandTable.set('view.reload', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; }
+            enabled: (context) => context.view && context.view.path ? true : false
         });
         commandTable.set('view.reset-zoom', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; }
+            enabled: (context) => context.view && context.view.path ? true : false
         });
         commandTable.set('view.zoom-in', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; }
+            enabled: (context) => context.view && context.view.path ? true : false
         });
         commandTable.set('view.zoom-out', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; }
+            enabled: (context) => context.view && context.view.path ? true : false
         });
         commandTable.set('view.show-properties', {
-            enabled: (context) => { return context.view && context.view.path ? true : false; }
+            enabled: (context) => context.view && context.view.path ? true : false
         });
 
         this._menu.build(menuTemplate, commandTable, this._views.views.map((view) => view.window));

+ 3 - 1
source/barracuda.js

@@ -540,7 +540,9 @@ barracuda.Metadata = class {
     constructor() {
         this._types = new Map();
         const register = (id, name, category, inputs) => {
-            this._types.set(id, { name: name, category: category, inputs: (inputs || []).map((input) => { return { name: input }; }) });
+            this._types.set(id, { name: name, category: category, inputs: (inputs || []).map((input) => {
+                return { name: input };
+            }) });
         };
         register(0, 'Nop', '');
         register(1, 'Dense', 'Layer', [ 'input', 'kernel', 'bias' ]);

+ 3 - 1
source/caffe.js

@@ -571,7 +571,9 @@ caffe.Attribute = class {
             }
             else if (Array.isArray(this._value) && Array.isArray(defaultValue)) {
                 if (this._value.length == defaultValue.length &&
-                    this._value.every((item, index) => { return item == defaultValue[index]; })) {
+                    this._value.every((item, index) => {
+                        return item == defaultValue[index];
+                    })) {
                     this._visible = false;
                 }
             }

+ 1 - 1
source/cntk.js

@@ -507,7 +507,7 @@ cntk.Attribute = class {
                             defaultValue.push(defaultValue[defaultValue.length - 1]);
                         }
                     }
-                    if (value.every((item, index) => { return item == defaultValue[index]; })) {
+                    if (value.every((item, index) => item == defaultValue[index])) {
                         this._visible = false;
                     }
                 }

+ 32 - 29
source/dagre.js

@@ -1300,7 +1300,10 @@ dagre.layout = (graph, options) => {
                 }
                 const graph = new dagre.Graph({ compound: true });
                 graph.options = { root: root };
-                graph.setDefaultNodeLabel((v) => { const node = g.node(v); return node ? node.label : undefined; });
+                graph.setDefaultNodeLabel((v) => {
+                    const node = g.node(v);
+                    return node ? node.label : undefined;
+                });
                 const length = nodes.length;
                 let i = 0;
                 while (i < length) {
@@ -1973,31 +1976,31 @@ dagre.layout = (graph, options) => {
             }
         };
 
-        time('    makeSpaceForEdgeLabels',        () => { makeSpaceForEdgeLabels(g); });
-        time('    removeSelfEdges',               () => { removeSelfEdges(g); });
-        time('    acyclic_run',                   () => { acyclic_run(g); });
-        time('    nestingGraph_run',              () => { nestingGraph_run(g); });
-        time('    rank',                          () => { rank(asNonCompoundGraph(g)); });
-        time('    injectEdgeLabelProxies',        () => { injectEdgeLabelProxies(g); });
-        time('    removeEmptyRanks',              () => { removeEmptyRanks(g); });
-        time('    nestingGraph_cleanup',          () => { nestingGraph_cleanup(g); });
-        time('    assignRankMinMax',              () => { assignRankMinMax(g); });
-        time('    removeEdgeLabelProxies',        () => { removeEdgeLabelProxies(g); });
-        time('    normalize',                     () => { normalize(g); });
-        time('    parentDummyChains',             () => { parentDummyChains(g); });
-        time('    addBorderSegments',             () => { addBorderSegments(g); });
-        time('    order',                         () => { order(g); });
-        time('    insertSelfEdges',               () => { insertSelfEdges(g); });
-        time('    coordinateSystem_adjust',       () => { coordinateSystem_adjust(g); });
-        time('    position',                      () => { position(g); });
-        time('    positionSelfEdges',             () => { positionSelfEdges(g); });
-        time('    removeBorderNodes',             () => { removeBorderNodes(g); });
-        time('    denormalize',                   () => { denormalize(g); });
-        time('    fixupEdgeLabelCoords',          () => { fixupEdgeLabelCoords(g); });
-        time('    coordinateSystem_undo',         () => { coordinateSystem_undo(g); });
-        time('    translateGraph',                () => { translateGraph(g); });
-        time('    assignNodeIntersects',          () => { assignNodeIntersects(g); });
-        time('    acyclic_undo',                  () => { acyclic_undo(g); });
+        time('    makeSpaceForEdgeLabels',        () => makeSpaceForEdgeLabels(g));
+        time('    removeSelfEdges',               () => removeSelfEdges(g));
+        time('    acyclic_run',                   () => acyclic_run(g));
+        time('    nestingGraph_run',              () => nestingGraph_run(g));
+        time('    rank',                          () => rank(asNonCompoundGraph(g)));
+        time('    injectEdgeLabelProxies',        () => injectEdgeLabelProxies(g));
+        time('    removeEmptyRanks',              () => removeEmptyRanks(g));
+        time('    nestingGraph_cleanup',          () => nestingGraph_cleanup(g));
+        time('    assignRankMinMax',              () => assignRankMinMax(g));
+        time('    removeEdgeLabelProxies',        () => removeEdgeLabelProxies(g));
+        time('    normalize',                     () => normalize(g));
+        time('    parentDummyChains',             () => parentDummyChains(g));
+        time('    addBorderSegments',             () => addBorderSegments(g));
+        time('    order',                         () => order(g));
+        time('    insertSelfEdges',               () => insertSelfEdges(g));
+        time('    coordinateSystem_adjust',       () => coordinateSystem_adjust(g));
+        time('    position',                      () => position(g));
+        time('    positionSelfEdges',             () => positionSelfEdges(g));
+        time('    removeBorderNodes',             () => removeBorderNodes(g));
+        time('    denormalize',                   () => denormalize(g));
+        time('    fixupEdgeLabelCoords',          () => fixupEdgeLabelCoords(g));
+        time('    coordinateSystem_undo',         () => coordinateSystem_undo(g));
+        time('    translateGraph',                () => translateGraph(g));
+        time('    assignNodeIntersects',          () => assignNodeIntersects(g));
+        time('    acyclic_undo',                  () => acyclic_undo(g));
     };
 
     // Copies final layout information from the layout graph back to the input graph.
@@ -2031,9 +2034,9 @@ dagre.layout = (graph, options) => {
 
     time('layout', () => {
         const layoutGraph =
-        time('  buildLayoutGraph',  () => { return buildLayoutGraph(graph); });
-        time('  runLayout',         () => { runLayout(layoutGraph, time); });
-        time('  updateSourceGraph', () => { updateSourceGraph(graph, layoutGraph); });
+        time('  buildLayoutGraph',  () => buildLayoutGraph(graph));
+        time('  runLayout',         () => runLayout(layoutGraph, time));
+        time('  updateSourceGraph', () => updateSourceGraph(graph, layoutGraph));
     });
 };
 

+ 2 - 2
source/dnn.js

@@ -187,7 +187,7 @@ dnn.Node = class {
         this._inputs = [];
         this._outputs = [];
 
-        const inputs = node.input.map((input) => { return arg(input); });
+        const inputs = node.input.map((input) => arg(input));
         for (const weight of layer.weight) {
             let quantization = null;
             if (layer.is_quantized && weight === layer.weight[0] && layer.quantization && layer.quantization.data) {
@@ -201,7 +201,7 @@ dnn.Node = class {
             const initializer = new dnn.Tensor(weight, quantization);
             inputs.push(new dnn.Argument('', initializer.type, initializer, quantization));
         }
-        const outputs = node.output.map((output) => { return arg(output); });
+        const outputs = node.output.map((output) => arg(output));
 
         if (inputs && inputs.length > 0) {
             let inputIndex = 0;

+ 3 - 1
source/message.js

@@ -28,7 +28,9 @@ message.Model = class {
         this._producer = data.producer || '';
         this._version = data.version || '';
         this._description = data.description || '';
-        this._metadata = (data.metadata || []).map((entry) => { return { name: entry.name, value: entry.value }; });
+        this._metadata = (data.metadata || []).map((entry) => {
+            return { name: entry.name, value: entry.value };
+        });
         this._graphs = (data.graphs || []).map((graph) => new message.Graph(graph));
     }
 

+ 66 - 18
source/mlnet.js

@@ -2044,9 +2044,17 @@ mlnet.FastTreeTweedieModelParameters = class extends mlnet.TreeEnsembleModelPara
         super(context);
     }
 
-    get VerNumFeaturesSerialized() { return 0x00010001; }
-    get VerDefaultValueSerialized() { return 0x00010002; }
-    get VerCategoricalSplitSerialized() { return 0x00010003; }
+    get VerNumFeaturesSerialized() {
+        return 0x00010001;
+    }
+
+    get VerDefaultValueSerialized() {
+        return 0x00010002;
+    }
+
+    get VerCategoricalSplitSerialized() {
+        return 0x00010003;
+    }
 };
 
 mlnet.FastTreeRankingModelParameters = class extends mlnet.TreeEnsembleModelParametersBasedOnRegressionTree {
@@ -2055,9 +2063,17 @@ mlnet.FastTreeRankingModelParameters = class extends mlnet.TreeEnsembleModelPara
         super(context);
     }
 
-    get VerNumFeaturesSerialized() { return 0x00010002; }
-    get VerDefaultValueSerialized() { return 0x00010004; }
-    get VerCategoricalSplitSerialized() { return 0x00010005; }
+    get VerNumFeaturesSerialized() {
+        return 0x00010002;
+    }
+
+    get VerDefaultValueSerialized() {
+        return 0x00010004;
+    }
+
+    get VerCategoricalSplitSerialized() {
+        return 0x00010005;
+    }
 };
 
 mlnet.FastTreeBinaryModelParameters = class extends mlnet.TreeEnsembleModelParametersBasedOnRegressionTree {
@@ -2066,9 +2082,17 @@ mlnet.FastTreeBinaryModelParameters = class extends mlnet.TreeEnsembleModelParam
         super(context);
     }
 
-    get VerNumFeaturesSerialized() { return 0x00010002; }
-    get VerDefaultValueSerialized() { return 0x00010004; }
-    get VerCategoricalSplitSerialized() { return 0x00010005; }
+    get VerNumFeaturesSerialized() {
+        return 0x00010002;
+    }
+
+    get VerDefaultValueSerialized() {
+        return 0x00010004;
+    }
+
+    get VerCategoricalSplitSerialized() {
+        return 0x00010005;
+    }
 };
 
 mlnet.FastTreeRegressionModelParameters = class extends mlnet.TreeEnsembleModelParametersBasedOnRegressionTree {
@@ -2077,9 +2101,17 @@ mlnet.FastTreeRegressionModelParameters = class extends mlnet.TreeEnsembleModelP
         super(context);
     }
 
-    get VerNumFeaturesSerialized() { return 0x00010002; }
-    get VerDefaultValueSerialized() { return 0x00010004; }
-    get VerCategoricalSplitSerialized() { return 0x00010005; }
+    get VerNumFeaturesSerialized() {
+        return 0x00010002;
+    }
+
+    get VerDefaultValueSerialized() {
+        return 0x00010004;
+    }
+
+    get VerCategoricalSplitSerialized() {
+        return 0x00010005;
+    }
 };
 
 mlnet.LightGbmRegressionModelParameters = class extends mlnet.TreeEnsembleModelParametersBasedOnRegressionTree {
@@ -2088,9 +2120,17 @@ mlnet.LightGbmRegressionModelParameters = class extends mlnet.TreeEnsembleModelP
         super(context);
     }
 
-    get VerNumFeaturesSerialized() { return 0x00010002; }
-    get VerDefaultValueSerialized() { return 0x00010004; }
-    get VerCategoricalSplitSerialized() { return 0x00010005; }
+    get VerNumFeaturesSerialized() {
+        return 0x00010002;
+    }
+
+    get VerDefaultValueSerialized() {
+        return 0x00010004;
+    }
+
+    get VerCategoricalSplitSerialized() {
+        return 0x00010005;
+    }
 };
 
 mlnet.LightGbmBinaryModelParameters = class extends mlnet.TreeEnsembleModelParametersBasedOnRegressionTree {
@@ -2099,9 +2139,17 @@ mlnet.LightGbmBinaryModelParameters = class extends mlnet.TreeEnsembleModelParam
         super(context);
     }
 
-    get VerNumFeaturesSerialized() { return 0x00010002; }
-    get VerDefaultValueSerialized() { return 0x00010004; }
-    get VerCategoricalSplitSerialized() { return 0x00010005; }
+    get VerNumFeaturesSerialized() {
+        return 0x00010002;
+    }
+
+    get VerDefaultValueSerialized() {
+        return 0x00010004;
+    }
+
+    get VerCategoricalSplitSerialized() {
+        return 0x00010005;
+    }
 };
 
 mlnet.FeatureWeightsCalibratedModelParameters = class extends mlnet.ValueMapperCalibratedModelParametersBase {

+ 1 - 1
source/mxnet.js

@@ -742,7 +742,7 @@ mxnet.Attribute = class {
                             defaultValue.push(defaultValue[defaultValue.length - 1]);
                         }
                     }
-                    if (this._value.every((item, index) => { return item == defaultValue[index]; })) {
+                    if (this._value.every((item, index) => item == defaultValue[index])) {
                         this._visible = false;
                     }
                 }

+ 3 - 1
source/onnx.js

@@ -1289,7 +1289,9 @@ onnx.Function = class {
         this._description = func.doc_string;
         this._inputs = [];
         this._outputs = [];
-        this._attributes = func.attribute.map((attribtue) => { return { name: attribtue }; });
+        this._attributes = func.attribute.map((attribtue) => {
+            return { name: attribtue };
+        });
         context = new onnx.GraphContext(context, func.node);
         func.input = func.input.map((input) => context.tensor(input));
         func.output = func.output.map((output) => context.tensor(output));

+ 1 - 1
source/openvino.js

@@ -745,7 +745,7 @@ openvino.Attribute = class {
                             defaultValue.push(defaultValue[defaultValue.length - 1]);
                         }
                     }
-                    if (this._value.every((item, index) => { return item == defaultValue[index]; })) {
+                    if (this._value.every((item, index) => item == defaultValue[index])) {
                         this._visible = false;
                     }
                 }

+ 1 - 1
source/paddle.js

@@ -567,7 +567,7 @@ paddle.Attribute = class {
                     this._visible = false;
                 }
                 else if (Array.isArray(value) && Array.isArray(defaultValue) && value.length == defaultValue.length) {
-                    if (value.every((item, index) => { return item == defaultValue[index]; })) {
+                    if (value.every((item, index) => item == defaultValue[index])) {
                         this._visible = false;
                     }
                 }

+ 3 - 1
source/python.js

@@ -2246,7 +2246,9 @@ python.Execution = class {
                 if (this.const_val !== null) {
                     content += this.const_val;
                 }
-                else {content += '[';}
+                else {
+                    content += '[';
+                }
                 for (var t of Object.values(this.type)) {
                     content += t.__name__;
                 }

+ 21 - 7
source/pytorch.js

@@ -899,12 +899,16 @@ pytorch.Execution = class extends python.Execution {
                     type: new pytorch.nnapi.Graph(this.serialized_model),
                     attributes: [],
                     inputs: [
-                        inputs.map((input) => { return { id: input.__variable__ }; }),
+                        inputs.map((input) => {
+                            return { id: input.__variable__ };
+                        }),
                         // [ { id: this.serialized_model_tensor.__variable__ } ] //,
                         // this.parameter_buffers.map((buffer) => { return { id: buffer.__variable__ }; })
                     ],
                     outputs: [
-                        outputs.map((output) => { return { id: output.__variable__ }; })
+                        outputs.map((output) => {
+                            return { id: output.__variable__ };
+                        })
                     ],
                 });
             }
@@ -2816,7 +2820,9 @@ pytorch.Utility = class {
                     }
                     const objKeys = Object.keys(obj).filter((key) => obj[key] && obj[key]._modules);
                     if (objKeys.length > 1) {
-                        return objKeys.map((key) => { return { name: key, data: obj[key] }; });
+                        return objKeys.map((key) => {
+                            return { name: key, data: obj[key] };
+                        });
                     }
                 }
             }
@@ -3090,7 +3096,9 @@ pytorch.Utility = class {
                         }
                     }
                     else if (value && Array.isArray(value) && value.every((item) => pytorch.Utility.isTensor(item))) {
-                        layer.states.push({ name: parameter, arguments: value.map((item) => { return { id: '', value: item }; }) });
+                        layer.states.push({ name: parameter, arguments: value.map((item) => {
+                            return { id: '', value: item };
+                        }) });
                     }
                     else if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
                         layer.attributes.push({ name: parameter, value: value });
@@ -3360,9 +3368,15 @@ pytorch.nnapi.Metadata = class {
         attributes = attributes || [];
         const type = {
             name: name,
-            inputs: inputs.map((name) => { return { name: name, type: 'Tensor' }; }),
-            outputs: outputs.map((name) => { return { name: name, type: 'Tensor' }; }),
-            attributes: attributes.map((pair) => { return { name: pair[0], type: pair[1] }; })
+            inputs: inputs.map((name) => {
+                return { name: name, type: 'Tensor' };
+            }),
+            outputs: outputs.map((name) => {
+                return { name: name, type: 'Tensor' };
+            }),
+            attributes: attributes.map((pair) => {
+                return { name: pair[0], type: pair[1] };
+            })
         };
         if (category) {
             type.category = category;

+ 3 - 1
source/tnn.js

@@ -637,7 +637,9 @@ tnn.TextProtoReader = class {
             };
         });
         lines.shift();
-        this._outputs = split(lines.shift(), ' ', true, false).map((output) => { return { name: output }; });
+        this._outputs = split(lines.shift(), ' ', true, false).map((output) => {
+            return { name: output };
+        });
         lines.shift();
         this._layers = [];
         while (lines.length > 0) {

+ 145 - 29
source/torch.js

@@ -837,35 +837,151 @@ torch.T7Reader = class {
         this.register('nngraph.Node');
         this.register('graph.Edge');
         this.register('graph.Graph');
-        this.register('torch.ByteTensor', class extends Tensor { constructor() { super('uint8'); } });
-        this.register('torch.CharTensor', class extends Tensor { constructor() { super('int8'); } });
-        this.register('torch.ShortTensor', class extends Tensor { constructor() { super('int16'); } });
-        this.register('torch.IntTensor', class extends Tensor { constructor() { super('int32'); } });
-        this.register('torch.LongTensor', class extends Tensor { constructor() { super('int64'); } });
-        this.register('torch.FloatTensor', class extends Tensor { constructor() { super('float32'); } });
-        this.register('torch.DoubleTensor', class extends Tensor { constructor() { super('float64'); } });
-        this.register('torch.CudaByteTensor', class extends Tensor { constructor() { super('uint8'); } });
-        this.register('torch.CudaCharTensor', class extends Tensor { constructor() { super('int8'); } });
-        this.register('torch.CudaShortTensor', class extends Tensor { constructor() { super('int16'); } });
-        this.register('torch.CudaIntTensor', class extends Tensor { constructor() { super('int32'); } });
-        this.register('torch.CudaLongTensor', class extends Tensor { constructor() { super('int64'); } });
-        this.register('torch.CudaTensor', class extends Tensor { constructor() { super('float32'); } });
-        this.register('torch.CudaDoubleTensor', class extends Tensor { constructor() { super('float64'); } });
-        this.register('torch.ByteStorage', class extends Storage { constructor() { super('uint8', 1); } });
-        this.register('torch.CharStorage', class extends Storage { constructor() { super('int8', 1); } });
-        this.register('torch.ShortStorage', class extends Storage { constructor() { super('int16', 2); } });
-        this.register('torch.IntStorage', class extends Storage { constructor() { super('int32', 4); } });
-        this.register('torch.LongStorage', class extends Storage { constructor() { super('int64', 8); } });
-        this.register('torch.FloatStorage', class extends Storage { constructor() { super('float32', 4); } });
-        this.register('torch.DoubleStorage', class extends Storage { constructor() { super('float64', 8); } });
-        this.register('torch.CudaByteStorage', class extends Storage { constructor() { super('uint8', 1); } });
-        this.register('torch.CudaCharStorage', class extends Storage { constructor() { super('int8', 1); } });
-        this.register('torch.CudaShortStorage', class extends Storage { constructor() { super('int16', 2); } });
-        this.register('torch.CudaIntStorage', class extends Storage { constructor() { super('int32', 4); } });
-        this.register('torch.CudaLongStorage', class extends Storage { constructor() { super('int64', 8); } });
-        this.register('torch.CudaIntStorage', class extends Storage { constructor() { super('int32', 4); } });
-        this.register('torch.CudaStorage', class extends Storage { constructor() { super('float32', 4); } });
-        this.register('torch.CudaFloatStorage', class extends Storage { constructor() { super('float64', 8); } });
+        this.register('torch.ByteTensor', class extends Tensor {
+            constructor() {
+                super('uint8');
+            }
+        });
+        this.register('torch.CharTensor', class extends Tensor {
+            constructor() {
+                super('int8');
+            }
+        });
+        this.register('torch.ShortTensor', class extends Tensor {
+            constructor() {
+                super('int16');
+            }
+        });
+        this.register('torch.IntTensor', class extends Tensor {
+            constructor() {
+                super('int32');
+            }
+        });
+        this.register('torch.LongTensor', class extends Tensor {
+            constructor() {
+                super('int64');
+            }
+        });
+        this.register('torch.FloatTensor', class extends Tensor {
+            constructor() {
+                super('float32');
+            }
+        });
+        this.register('torch.DoubleTensor', class extends Tensor {
+            constructor() {
+                super('float64');
+            }
+        });
+        this.register('torch.CudaByteTensor', class extends Tensor {
+            constructor() {
+                super('uint8');
+            }
+        });
+        this.register('torch.CudaCharTensor', class extends Tensor {
+            constructor() {
+                super('int8');
+            }
+        });
+        this.register('torch.CudaShortTensor', class extends Tensor {
+            constructor() {
+                super('int16');
+            }
+        });
+        this.register('torch.CudaIntTensor', class extends Tensor {
+            constructor() {
+                super('int32');
+            }
+        });
+        this.register('torch.CudaLongTensor', class extends Tensor {
+            constructor() {
+                super('int64');
+            }
+        });
+        this.register('torch.CudaTensor', class extends Tensor {
+            constructor() {
+                super('float32');
+            }
+        });
+        this.register('torch.CudaDoubleTensor', class extends Tensor {
+            constructor() {
+                super('float64');
+            }
+        });
+        this.register('torch.ByteStorage', class extends Storage {
+            constructor() {
+                super('uint8', 1);
+            }
+        });
+        this.register('torch.CharStorage', class extends Storage {
+            constructor() {
+                super('int8', 1);
+            }
+        });
+        this.register('torch.ShortStorage', class extends Storage {
+            constructor() {
+                super('int16', 2);
+            }
+        });
+        this.register('torch.IntStorage', class extends Storage {
+            constructor() {
+                super('int32', 4);
+            }
+        });
+        this.register('torch.LongStorage', class extends Storage {
+            constructor() {
+                super('int64', 8);
+            }
+        });
+        this.register('torch.FloatStorage', class extends Storage {
+            constructor() {
+                super('float32', 4);
+            }
+        });
+        this.register('torch.DoubleStorage', class extends Storage {
+            constructor() {
+                super('float64', 8);
+            }
+        });
+        this.register('torch.CudaByteStorage', class extends Storage {
+            constructor() {
+                super('uint8', 1);
+            }
+        });
+        this.register('torch.CudaCharStorage', class extends Storage {
+            constructor() {
+                super('int8', 1);
+            }
+        });
+        this.register('torch.CudaShortStorage', class extends Storage {
+            constructor() {
+                super('int16', 2);
+            }
+        });
+        this.register('torch.CudaIntStorage', class extends Storage {
+            constructor() {
+                super('int32', 4);
+            }
+        });
+        this.register('torch.CudaLongStorage', class extends Storage {
+            constructor() {
+                super('int64', 8);
+            }
+        });
+        this.register('torch.CudaIntStorage', class extends Storage {
+            constructor() {
+                super('int32', 4);
+            }
+        });
+        this.register('torch.CudaStorage', class extends Storage {
+            constructor() {
+                super('float32', 4);
+            }
+        });
+        this.register('torch.CudaFloatStorage', class extends Storage {
+            constructor() {
+                super('float64', 8);
+            }
+        });
         this.register('w2nn.AuxiliaryLossTable');
         this.register('w2nn.InplaceClip01');
         this.register('w2nn.ScaleTable');

+ 3 - 1
source/view.js

@@ -165,7 +165,9 @@ view.View = class {
 
     _timeout(time) {
         return new Promise((resolve) => {
-            setTimeout(() => { resolve(); }, time);
+            setTimeout(() => {
+                resolve();
+            }, time);
         });
     }