/** * @param data * @private */ _trainPatterns(data) { for (let i = 0; i < data.length; ++i) { this._trainPattern(data[i].input, data[i].output, false); } }
/** * * @param flip * @return {Uint8ClampedArray} */ getPixels(flip) { const [width, height] = this.output; // cpu is not flipped by default return flip ? utils.flipPixels(this._imageData.data, width, height) : this._imageData.data.slice(0); }
function log(text) { if(typeof(text)=="object") { text=JSON.stringify(text).replace(/\s/g," "); } root.output+="["+moment().format("YYYY-MM-DD HH:mm:ss")+"]"+text+"<br>"; }
function compare2D(target, exponentials) { let indicator = 0; const index = this.thread.x + this.thread.y * this.output.x; if (index === target) { indicator = 1; } return -(indicator - exponentials[this.thread.y][this.thread.x]); }
setOutput(output) { super.setOutput(output); const [width, height] = this.output; if (this.graphical) { this._imageData = this.context.createImageData(width, height); this._colorData = new Uint8ClampedArray(width * height * 4); } }
(async function () { try { await webpackCompiler(webpackConfig) fs.copySync(path.resolve(webpackConfig.resolve.root, 'static'), webpackConfig.output.path) } catch (e) { debug('Compiler encountered an error.', e) process.exit(1) } })()
server.hooks.afterSetup.tap('develop', server => { const devMiddleware = require('webpack-dev-middleware')(compiler, { pathPrefix: webpackConfig.output.pathPrefix, watchOptions: webpackConfig.devServer ? webpackConfig.devServer.watchOptions : null, logLevel: 'silent' }) server.use(devMiddleware) })
(function initWebpack() { var webpack = require('webpack'); var webpackConfig = require('./webpack.config'); var compiler = webpack(webpackConfig); app.use(require('webpack-dev-middleware')(compiler, { noInfo: true, publicPath: webpackConfig.output.publicPath })); app.use(require('webpack-hot-middleware')(compiler, { log: console.log, path: '/__webpack_hmr', heartbeat: 10 * 1000 })); })();
/** * @return {string} */ toString() { return this.output || `{${this.type}: ${this.value}}`; }
function testBitwise(data) { const net = new NeuralNetwork(); net.train(data, { errorThresh: 0.003 }); data.forEach((d) => { const actual = net.run(d.input); const expected = d.output; expect(isAround(actual[0], expected[0])).toBe(true); }); }
componentWillUnmount() { this.unsubscribe(); let cli = ReplLanguages.getREPL(); cli.output.write = () => {}; cli.displayPrompt = this.displayPrompt; }
test('setOutput() when not dynamicOutput and not already compiled', () => { const mockInstance = { toKernelOutput: () => [100, 100], dynamicOutput: false, output: null, }; GLKernel.prototype.setOutput.call(mockInstance, [100, 100]); assert.deepEqual(mockInstance.output, [100, 100]); });
_graphicalKernelBody(kernelThreadString) { switch (this.output.length) { case 2: return this._graphicalKernel2DLoop(kernelThreadString) + this._graphicalOutput(); default: throw new Error('unsupported size kernel'); } }
static toOutputTable(data) { const table = {}; let tableIndex = 0; for (let dataIndex = 0; dataIndex < data.length; dataIndex++) { for (const p in data[dataIndex].output) { if (!table.hasOwnProperty(p)) { table[p] = tableIndex++; } } } return table; }