一系列常用模型的Keras实现
Multilayer Perceptron (MLP) for multi-class softmax classification
from keras.models import Sequential
# most of the code is by Rainer Engelken | |
# updated to Julia 1.0 syntax, tested on 1.4 | |
using Luxor, StaticArrays | |
# poincare section of chaotic network of three neurons | |
function spikingnet(n, couplingstrength=1.0) | |
# number of spikes in calculation |
#include <stdio.h> | |
#include <iostream> | |
extern "C"{ | |
#include <libavformat/avformat.h> | |
#include <libavformat/avio.h> | |
#include <libavcodec/avcodec.h> | |
#include <libavformat/avformat.h> | |
#include <libavutil/imgutils.h> //for av_image_alloc only | |
#include <libavutil/opt.h> |
import time | |
import numpy as np | |
from numpy.fft import fft2, ifft2 | |
from matplotlib import pyplot, animation | |
def fft_convolve2d(board, kernal): | |
board_ft = fft2(board) | |
kernal_ft = fft2(kernal) | |
height, width = board_ft.shape |
// Reformatted version from here: | |
// https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4422&lngWId=3 | |
#include <windows.h> | |
#include <mmsystem.h> | |
#include <stdio.h> | |
/* | |
* some good values for block size and count | |
*/ | |
#define BLOCK_SIZE 8192 |
// Created by inigo quilez - iq/2013 | |
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. | |
// https://www.shadertoy.com/view/4dfGzn | |
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
vec2 q = fragCoord.xy / iResolution.xy; | |
vec2 uv = vec2(q.x,q.y); | |
// zooming |
A predictive parser is a recursive descent parser without backtracking. It relies on the concept of a lookahead symbol to determine which production rule to use. It does not support left recursion, and requires any left-recursive grammars to be converted to right recursive grammars. A predictive parser is called LL(k) where k denotes the number of lookahead symbols used. This is LL(1) because we're only using one 1 look ahead symbol equivalent to 1 character terminal in the input string. There is no lexer required, thus in this case the tokens and terminals are the exact same thing.
Strings to be parsed:
// Win32 : Minimal VST 2.x Synth host in C++11. | |
// | |
// This is a simplified version of the following project by hotwatermorning : | |
// A sample VST Host Application for C++ Advent Calendar 2013 5th day. | |
// https://github.com/hotwatermorning/VstHostDemo | |
// | |
// Usage : | |
// 1. Compile & Run this program. | |
// 2. Select your VST Synth DLL. | |
// 3. Press QWERTY, ZXCV, etc. |
Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative
float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);