Skip to content

Instantly share code, notes, and snippets.

@byzhang
byzhang / dl-frameworks.rst
Created March 5, 2016 07:00 — forked from bartvm/dl-frameworks.rst
A comparison of deep learning frameworks

A comparison of Theano with other deep learning frameworks, highlighting a series of low-level design choices in no particular order.

Overview

Symbolic: Theano, CGT; Automatic: Torch, MXNet

Symbolic and automatic differentiation are often confused or used interchangeably, although their implementations are significantly different.

@byzhang
byzhang / puias.rst
Last active February 22, 2016 18:59 — forked from nico4/puias.rst
Install boost1.53 on Centos 6 using PUIAS repository

Install Boost1.53 on Centos with PUIAS

Create puias-computational.repo file:

$ vim /etc/yum.repos.d/puias-computational.repo

Paste the following code into the above file:

@byzhang
byzhang / gist:7e9d33ba1d8581642ef8
Last active August 29, 2015 14:05
first node server
var async = require('async');
var express = require('express'),
app = express();
var google = require('googleapis'),
OAuth2Client = google.auth.OAuth2;
var oauth2Client = new OAuth2Client(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL);
@byzhang
byzhang / knn distance
Last active August 29, 2015 14:02
knn distance
VEX_FUNCTION(float, l2_distance, (size_t, idx)(uint32_t, num_dim)(float*, query)(float*, candidates),
float d = 0;
for (uint i = 0; i < num_dim; ++i) {
d += pow(query[i] - candidates[idx * num_dim + i], 2);
}
return d;
);
Knn::ValueVec Knn::search_h(const ValueVec& query, size_t query_offset) const {
prof_.tic_cl("distance");
@byzhang
byzhang / gist:11020228
Created April 18, 2014 01:25
efficient way?
vex::vector<double> h(ctx, n1 * n2);
vex::vector<uint32_t> N(ctx, n1 * n3);
vex::vector<double> V(ctx, n4 * n2);
vex::vector<double> L(ctx, n1 * n3);
for (int i = 0; i < h.rows(); ++i) {
for (int j = 0; j < N.cols(); ++j) {
row(V, N(i,j)) -= L(i, j) * row(h, i);
}
}
muduo::AtomicInt32 g_running_clients;
EventLoop* g_loop = nullptr;
class Client: boost::noncopyable {
private:
const char* server_;
ifstream input_;
muduo::AtomicInt32 running_reqs_;
curl::Curl curl_;
curl::RequestPtr req_user_, req_target_;
import urllib2
from lxml import html
from collections import defaultdict
url = "http://www.youtube.com/watch?v=IyLZ6RXJ8Eg"
doc = html.parse(urllib2.urlopen(url))
data = defaultdict(dict)
props = doc.xpath('//meta[re:test(@name|@property, "^twitter|og:.*$", "i")]',
namespaces={"re": "http://exslt.org/regular-expressions"})