Skip to content

Commit

Permalink
Spread output of runInput for both NN and NNGPU, NNGPU does a `toAr…
Browse files Browse the repository at this point in the history
…ray(this.gpu)` first. This prevents object sharing issues.
  • Loading branch information
perkyguy committed Jan 19, 2018
1 parent b057d4c commit 8e84766
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/neural-network-gpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export default class NeuralNetworkGPU extends NeuralNetwork {
if (this.inputLookup) {
input = lookup.toArray(this.inputLookup, input);
}
let output = this.runInput(input);
let output = [...this.runInput(input).toArray(this.gpu)];

if (this.outputLookup) {
output = lookup.toHash(this.outputLookup, output);
Expand Down
2 changes: 1 addition & 1 deletion src/neural-network.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default class NeuralNetwork {
input = lookup.toArray(this.inputLookup, input);
}

let output = this.runInput(input);
let output = [...this.runInput(input)];

if (this.outputLookup) {
output = lookup.toHash(this.outputLookup, output);
Expand Down

0 comments on commit 8e84766

Please sign in to comment.