* * @param data * @param options * @protected * @return { data, status, endTime }
(data, options)
| 347 | * @return { data, status, endTime } |
| 348 | */ |
| 349 | _prepTraining(data, options) { |
| 350 | this._updateTrainingOptions(options); |
| 351 | data = this._formatData(data); |
| 352 | const endTime = Date.now() + this.trainOpts.timeout; |
| 353 | |
| 354 | const status = { |
| 355 | error: 1, |
| 356 | iterations: 0 |
| 357 | }; |
| 358 | |
| 359 | this._verifyIsInitialized(data); |
| 360 | |
| 361 | const texturizeOutputData = this.gpu.createKernel(function(value) { |
| 362 | return value[this.thread.x]; |
| 363 | }, { |
| 364 | output: [data[0].output.length], |
| 365 | outputToTexture: true, |
| 366 | hardcodeConstants: true, |
| 367 | outputImmutable: true |
| 368 | }); |
| 369 | |
| 370 | return { |
| 371 | data: data.map((set) => { |
| 372 | return { |
| 373 | size: set.size, |
| 374 | input: this._texturizeInputData(set.input), |
| 375 | output: texturizeOutputData(set.output) |
| 376 | } |
| 377 | }), |
| 378 | status, |
| 379 | endTime |
| 380 | }; |
| 381 | } |
| 382 | |
| 383 | toFunction() { |
| 384 | throw new Error('not implemented on NeuralNetworkGPU'); |
nothing calls this directly
no test coverage detected