function predict(weights1, weights2) { let sum = 0; for (let i = 0; i < this.constants.size; i++) { sum += weights1[this.thread.y][i] * weights2[i][this.thread.x]; } return sum; }
//arrghghh new TWEEN.Tween({x: 0, y: 0}) .to({x: 50, y: 50}, 2000) .easing( TWEEN.Easing.Elastic.Out ) .onUpdate(function(){ _this.marker.scale.set(this.x, this.y); }) .delay((this.previous ? _this.opts.drawTime : 0)) .start();
test('works with input array', () => { const gpu = new GPU({ mode: 'dev' }); const kernel = gpu.createKernel(function(value) { return value[this.thread.x]; }, { output: [4] }); assert.deepEqual(kernel(input([1,2,3,4], [4])), new Float32Array([1,2,3,4])); gpu.destroy(); });
new TWEEN.Tween(point) .to( {x: point.x*altitude, y: point.y*altitude, z: point.z*altitude}, 1500 ) .easing( TWEEN.Easing.Elastic.Out ) .onUpdate(function(){ _this.lineGeometry.vertices[1].x = this.x; _this.lineGeometry.vertices[1].y = this.y; _this.lineGeometry.vertices[1].z = this.z; _this.lineGeometry.verticesNeedUpdate = true; }).start();
const defaultLayout = i => ({ x: i.layout.x || 0, y: i.layout.y || 0, w: i.layout.w || 4, h: i.layout.h || 8, minW: 4, minH: 8 })
gpu.createKernel(function(a) { const pixel = a[this.thread.y][this.thread.x]; return pixel.a * 255; }, { output: [image.width, image.height], precision: 'unsigned', argumentTypes: { a: 'HTMLImage' }, })
render(props, {}) { const boxData = get(props, `${DASHBOARD_BOX_DATA_KEY}TemperatureInRoom.${props.x}_${props.y}`); const boxStatus = get(props, `${DASHBOARD_BOX_STATUS_KEY}TemperatureInRoom.${props.x}_${props.y}`); const temperature = get(boxData, 'room.temperature.temperature'); const unit = get(boxData, 'room.temperature.unit'); const roomName = get(boxData, 'room.name'); return ( <RoomTemperatureBox {...props} temperature={temperature} unit={unit} boxStatus={boxStatus} roomName={roomName} /> ); }
// Texture fixing helper. Spheres have some odd behaviours. function correctUV( uv, vector, azimuth ) { if ( ( azimuth < 0 ) && ( uv.x === 1 ) ) uv = new THREE.Vector2( uv.x - 1, uv.y ); if ( ( vector.x === 0 ) && ( vector.z === 0 ) ) uv = new THREE.Vector2( azimuth / 2 / Math.PI + 0.5, uv.y ); return uv.clone(); }
function createKernel(gpu, output) { return gpu.createKernel(function (a) { return a[this.thread.x]; }).setOutput(output); }
function update(changes, weights, incomingWeights, inputDeltas) { const lastChange = changes[this.thread.y][this.thread.x]; const inputDelta = inputDeltas[this.thread.y][0]; const weight = weights[this.thread.y][this.thread.x]; const incoming = incomingWeights[this.thread.x][0]; const change = this.constants.learningRate * inputDelta * incoming + this.constants.momentum * lastChange; updateChange(change); return weight + change; }
render(props, {}) { const boxData = get(props, `${DASHBOARD_BOX_DATA_KEY}Camera.${props.x}_${props.y}`); const boxStatus = get(props, `${DASHBOARD_BOX_STATUS_KEY}Camera.${props.x}_${props.y}`); const image = get(boxData, 'image'); const error = boxStatus === RequestStatus.Error; return <CameraBox {...props} image={image} boxStatus={boxStatus} error={error} />; }
function predict3D(exponentials, exponentialsSum) { return ( exponentials[this.thread.z][this.thread.y][this.thread.x] / exponentialsSum[0] ); }