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
to_bool = {'T': True, 'F': False} | |
def matches(what, whom): | |
return (whom == '?') or (what == to_bool[whom]) | |
def simplify(answers): | |
if len(answers) > 1: | |
return '?' | |
return ['F', 'T'][answers.pop()] |
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
#define TILE_WIDTH 16 | |
// NOTE: Since TILE_WIDTH is a constant, I cannot use the more readable idiom | |
// ceil(whatever/16.0) for calculating the number of tiles. Instead I use | |
// (whatever + TILE_WIDTH - 1) / TILE_WIDTH, which is equivalent. Trust me. | |
// Compute C = A * B | |
__global__ void matrixMultiplyShared(float *A, float *B, float *C, int numARows, | |
int numAColumns, int numBRows, | |
int numBColumns, int numCRows, |
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 cv2, numpy as np | |
import theano | |
from pylearn2.utils import serial | |
def load_pl2_recognizer(model_path): | |
model = serial.load(model_path) | |
X = model.get_input_space().make_theano_batch() | |
Y = model.fprop(X) |
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
sudo apt-get -y update | |
sudo apt-get -y upgrade | |
sudo apt-get -y dist-upgrade | |
sudo apt-get -y install git make python-dev python-setuptools libblas-dev gfortran g++ python-pip python-numpy python-scipy liblapack-dev | |
sudo pip install ipython nose | |
sudo apt-get install screen | |
sudo pip install --upgrade git+git://github.com/Theano/Theano.git | |
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_6.5-14_amd64.deb | |
sudo dpkg -i cuda-repo-ubuntu1404_6.5-14_amd64.deb | |
sudo apt-get update |
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
--2015-02-09 16:39:38-- http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_6.5-14_amd64.deb | |
Resolving developer.download.nvidia.com (developer.download.nvidia.com)... 92.123.72.158, 92.123.72.176 | |
Connecting to developer.download.nvidia.com (developer.download.nvidia.com)|92.123.72.158|:80... connected. | |
HTTP request sent, awaiting response... 200 OK | |
Length: 2138 (2.1K) [application/x-deb] | |
Saving to: ‘cuda-repo-ubuntu1404_6.5-14_amd64.deb’ | |
100%[==================================================================================================>] 2,138 --.-K/s in 0s | |
2015-02-09 16:39:39 (406 MB/s) - ‘cuda-repo-ubuntu1404_6.5-14_amd64.deb’ saved [2138/2138] |
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
ubuntu@ip-172-31-44-36:~/pylearn2/pylearn2/scripts/papers/maxout$ THEANO_FLAGS="device=gpu,floatX=float32" ~/pylearn2/pylearn2/scripts/train.py mnist.yaml | |
Using gpu device 0: GRID K520 | |
(train.py:4883): Gdk-CRITICAL **: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed | |
Traceback (most recent call last): | |
File "/home/ubuntu/pylearn2/pylearn2/scripts/train.py", line 252, in <module> | |
args.verbose_logging, args.debug) | |
File "/home/ubuntu/pylearn2/pylearn2/scripts/train.py", line 197, in train | |
train_obj = serial.load_train_file(config) | |
File "/home/ubuntu/pylearn2/pylearn2/utils/serial.py", line 524, in load_train_file |
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
Using gpu device 0: GRID K520 | |
error: XDG_RUNTIME_DIR not set in the environment. | |
error: XDG_RUNTIME_DIR not set in the environment. | |
(train.py:2434): Gdk-CRITICAL **: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed | |
/home/ubuntu/pylearn2/pylearn2/utils/image.py:16: UserWarning: Unable to import matplotlib. Some features unavailable. Original exception: constructor returned NULL | |
"Original exception: " + str(matplotlib_exception)) | |
(train.py:2434): Gdk-CRITICAL **: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed | |
/home/ubuntu/pylearn2/pylearn2/sandbox/cuda_convnet/__init__.py:66: UserWarning: You are using probably a too old Theano version. That will cause compilation crash. If so, update Theano. |
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
<!doctype html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title>Sandbox</title> | |
</head> | |
<body> | |
<script src="sandbox.js"></script> | |
</body> |
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
def get_expansions(num, nterms): | |
result = [] | |
def run(cur_sum, cur_vals, remain): | |
if remain == 0: | |
if cur_sum == num: | |
result.append(tuple(cur_vals)) | |
return | |
elif remain == 1: | |
cur_vals.append(num - cur_sum) |
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
from __future__ import division, print_function | |
from pprint import pprint | |
import glob | |
import caffe | |
MODEL_FILE = '../models/lenet.prototxt' | |
PRETRAINED_FILE = '../models/lenet_pretrained.caffemodel' | |
IMAGE_DIR = 'test' |
OlderNewer