This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| This is a batched LSTM forward and backward pass | |
| """ | |
| import numpy as np | |
| import code | |
| class LSTM: | |
| @staticmethod | |
| def init(input_size, hidden_size, fancy_forget_bias_init = 3): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * compute quantile of input matrix for given value range from 0.0 to 1.0 | |
| */ | |
| float cvQuantile(CvMat * src, float p) | |
| { | |
| p=MIN(1,MAX(0,p)); // eliminate overflow | |
| int nr = src->rows, nc = src->cols; | |
| CvMat * converted = cvCreateMat(nr,nc,CV_32F); | |
| CvMat * reshaped = cvCreateMat(1,nr*nc,CV_32F); | |
| CvMat * sorted = cvCreateMat(1,nr*nc,CV_32F); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstring> | |
| #include <numeric> | |
| #include <functional> | |
| /** | |
| * Hackers Delight: http://www.hackersdelight.org/HDcode/nlz.c.txt | |
| */ | |
| int pop(unsigned x) { | |
| x = x - ((x >> 1) & 0x55555555); | |
| x = (x & 0x33333333) + ((x >> 2) & 0x33333333); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @file QSound2.h | |
| * @author Liangfu Chen <[email protected]> | |
| * @date Tue Jul 10 14:39:25 2012 | |
| * | |
| * @brief QSound interface with SDL_mixer implementation | |
| * | |
| * Phonon is not the default option while compile Qt4. | |
| * This class is designed to enable brief sound playback in | |
| * the Linux environment. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from math import sqrt | |
| import random | |
| def bubble_sort(a): | |
| """ | |
| basic sorting method -- bubble sort | |
| """ | |
| s = len(a) |
NewerOlder