input/output size = 1. Read by brain.js as:
1, then2, then3, then4, then55, then4, then3, then2, then1
net.train([
[1,2,3,4,5],| const { GPU } = require('gpu.js'); | |
| const gpu = new GPU({ mode: 'gpu' }); | |
| const a = [1, 2, 3, 4, 5]; | |
| const b = [1, 2, 3, 4, 5]; | |
| const kernels = gpu.createKernel(function(a, b) { | |
| let sum = 0; | |
| for (let i = 0; i < 5; i++) { | |
| sum += a[i] + b[i]; | |
| } |
| // | |
| // Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| // | |
| // entry_points_gles_2_0_ext.cpp : Implements the GLES 2.0 extension entry points. | |
| #include "libGLESv2/entry_points_gles_2_0_ext.h" | |
| #include "libGLESv2/global_state.h" |
| // works good | |
| #include <algorithm> | |
| #include <vector> | |
| #include <map> | |
| #include <utility> | |
| #include <node.h> | |
| #include "nan.h" | |
| #include <v8.h> |
| // at end of list of items that call "JS_GL_METHOD" | |
| JS_GL_METHOD("drawBuffers", DrawBuffers); | |
| JS_GL_METHOD("extWEBGL_draw_buffers", EXTWEBGL_draw_buffers); |
| precision highp float; | |
| precision highp int; | |
| precision highp sampler2D; | |
| uniform ivec3 uOutputDim; | |
| uniform ivec2 uTexSize; | |
| varying vec2 vTexCoord; | |
| const vec4 SCALE_FACTOR_INV = vec4(1.0, 0.00390625, 0.0000152587890625, 0.0); // 1, 1/256, 1/65536 | |
| vec2 integerMod(vec2 x, float y) { |
| "scripts": { | |
| "format": "clang-format -i -style=Google binding/*.cc binding/*.h", | |
| "install": "node scripts/install.js && npm run build", | |
| "build": "tsc -p ." | |
| }, |
| const createContext = require('gl'); | |
| function main () { | |
| // Create context | |
| var width = 6; | |
| var height = 1; | |
| var gl = createContext(width, height); | |
| var vertexSrc = `precision highp float; | |
| precision highp int; |
| module.exports = () => { | |
| function kernelRunShortcut(kernel) { | |
| const shortcut = function() { | |
| return kernel.run.apply(kernel, arguments); | |
| }; | |
| utils.allPropertiesOf(kernel).forEach((key) => { | |
| if (key[0] === '_' && key[1] === '_') return; | |
| if (typeof kernel[key] === 'function') { | |
| if (key.substring(0, 3) === 'add' || key.substring(0, 3) === 'set') { |
| class Item { | |
| public static async get<Options extends { id: string }>(o: Options, api: Api): Promise<Item> { | |
| return new Promise<Item>((accept, reject) => { | |
| console.log(api); | |
| accept(new Item()); | |
| }); | |
| } | |
| public static async search<Options extends { query: string }>(o: Options, api: Api): Promise<Item[]> { | |
| return new Promise<Item[]>((accept, reject) => { | |
| console.log(api); |