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
| import theano | |
| import theano.tensor as T | |
| import numpy as np | |
| def local_feature_extractor(x, W, b, shape_info=None): | |
| xr = x.dimshuffle(0, 2, 'x', 1) # in: (num_examples, num_input_features, 1, num_timesteps) | |
| Wr = W.dimshuffle(0, 1, 'x', 2) # filters: (num_output_features, num_input_features, 1, width) | |
| # the output of the convolution should be equal in length to the input | |
| len_left = (Wr.shape[3] - 1) / 2 |
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
| s = set() | |
| with open("kaggle_visible_evaluation_triplets.txt", 'r') as f: | |
| for line in f: | |
| user, _, _ = line.strip().split('\t') | |
| s.add(user) | |
| print "%d users" % len(s) |
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
| [ 96%] Building NVCC (Device) object extra/cuda/lib/THC/CMakeFiles/THC.dir//./THC_generated_THC.cu.o | |
| /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ext/atomicity.h(48): error: identifier "__atomic_fetch_add" is undefined | |
| /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ext/atomicity.h(52): error: identifier "__atomic_fetch_add" is undefined | |
| /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/limits(1405): error: identifier "__int128" is undefined | |
| /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/limits(1409): error: identifier "__int128" is undefined | |
| /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/limits(1412): error: identifier "__int128" is undefined |
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
| import numpy as np | |
| def freq2mel(freq): | |
| return 1127.01048 * np.log(1 + freq / 700.0) | |
| def mel2freq(mel): | |
| return (np.exp(mel / 1127.01048) - 1) * 700 | |
| def mel_binning_matrix(specgram_window_size, sample_frequency, num_mel_bands): |
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
| import threading | |
| import Queue | |
| import time | |
| def buffered_gen(source_gen, buffer_size=2, sleep_time=1): | |
| """ | |
| Generator that runs a slow source generator in a separate thread. | |
| buffer_size: the maximal number of items to pre-generate (length of the buffer) | |
| """ | |
| buffer = Queue.Queue(maxsize=buffer_size) |
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
| import time | |
| import multiprocessing as mp | |
| def buffered_gen_mp(source_gen, buffer_size=2, sleep_time=1): | |
| """ | |
| Generator that runs a slow source generator in a separate process. | |
| buffer_size: the maximal number of items to pre-generate (length of the buffer) | |
| """ | |
| buffer = mp.Queue(maxsize=buffer_size) |
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
| import theano | |
| import theano.tensor as T | |
| from theano.tensor.opt import register_canonicalize | |
| class ConsiderConstant(theano.compile.ViewOp): | |
| def grad(self, args, g_outs): | |
| return [T.zeros_like(g_out) for g_out in g_outs] | |
| consider_constant = ConsiderConstant() | |
| register_canonicalize(theano.gof.OpRemove(consider_constant), name='remove_consider_constant') |
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
| import numpy as np | |
| import theano | |
| import theano.misc.pycuda_init | |
| import theano.sandbox.cuda as cuda | |
| from theano.misc.pycuda_utils import to_gpuarray, to_cudandarray | |
| from scikits.cuda import fft | |
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 tutorial introduces the LeNet5 neural network architecture | |
| using Theano. LeNet5 is a convolutional neural network, good for | |
| classifying images. This tutorial shows how to build the architecture, | |
| and comes with all the hyper-parameters you need to reproduce the | |
| paper's MNIST results. | |
| This implementation simplifies the model in the following ways: | |
| - LeNetConvPool doesn't implement location-specific gain and bias parameters |
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
| * GeForce GTX 780Ti "Superclocked" | |
| * drivers 340.24 | |
| * CUDA 6.0 | |
| sander@sander-precision:~/tmp/schluter/Theano$ for x in full valid subsample grads; do cuda-memcheck nosetests theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py:test_gemm_$x; done | |
| ========= CUDA-MEMCHECK | |
| Using gpu device 0: GeForce GTX 780 Ti | |
| ========= Invalid __global__ read of size 4 | |
| ========= at 0x000000e0 in sgemm_sm_heavy_nt_ldg |