Skip to content

Commit e9ec361

Browse files
Merge pull request #105 from shimondoodkin/master
change data.constructor !== Array to Array.isArray
2 parents 366cde6 + 44a86f5 commit e9ec361

12 files changed

+251
-264
lines changed

browser.js

Lines changed: 164 additions & 154 deletions
Large diffs are not rendered by default.

browser.min.js

Lines changed: 69 additions & 92 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/neural-network-gpu.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/neural-network-gpu.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/neural-network.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/neural-network.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/train-stream.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/train-stream.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "brain.js",
33
"description": "Neural network library",
4-
"version": "1.0.0-rc.5",
4+
"version": "1.0.0-rc.6",
55
"author": "Heather Arthur <[email protected]>",
66
"repository": {
77
"type": "git",

src/neural-network-gpu.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,14 @@ export default class NeuralNetworkGPU extends NeuralNetwork {
283283
* @returns {*}
284284
*/
285285
formatData(data) {
286-
if (data.constructor !== Array) { // turn stream datum into array
286+
if (!Array.isArray(data)) { // turn stream datum into array
287287
let tmp = [];
288288
tmp.push(data);
289289
data = tmp;
290290
}
291291
// turn sparse hash input into arrays with 0s as filler
292292
let datum = data[0].input;
293-
if (datum.constructor !== Array && !(datum instanceof Float64Array)) {
293+
if (!Array.isArray(datum) && !(datum instanceof Float64Array)) {
294294
if (!this.inputLookup) {
295295
this.inputLookup = lookup.buildLookup(data.map(value => value['input']));
296296
}
@@ -300,7 +300,7 @@ export default class NeuralNetworkGPU extends NeuralNetwork {
300300
}, this);
301301
}
302302

303-
if (data[0].output.constructor !== Array) {
303+
if (!Array.isArray(data[0].output)) {
304304
if (!this.outputLookup) {
305305
this.outputLookup = lookup.buildLookup(data.map(value => value['output']));
306306
}

0 commit comments

Comments
 (0)