Skip to content

Instantly share code, notes, and snippets.

View gcr's full-sized avatar

Kimmy gcr

  • Google AI
  • 11:19 (UTC -04:00)
View GitHub Profile
json = require 'cjson'
function buildNcduLayer(name, module)
local result = nil
if torch.isTensor(module) then
if module:numel() ~= 0 then
local strt = {name..': [' .. torch.typename(module) .. ' of size '}
for i=1,module:nDimension() do
table.insert(strt, module:size(i))
if i ~= module:nDimension() then
json = require 'cjson'
function buildNcduLayer(name, module)
local result = nil
if torch.isTensor(module) then
if module:numel() ~= 0 then
local strt = {name..': [' .. torch.typename(module) .. ' of size '}
for i=1,module:nDimension() do
table.insert(strt, module:size(i))
if i ~= module:nDimension() then
th> x = torch.randn(3,3)
[0.0001s]
th> x
-0.9764 1.3443 0.4054
1.7598 1.9367 -0.6121
-0.1593 -0.0788 -0.2321
[torch.DoubleTensor of size 3x3]
[0.0002s]
th> x:mean(1)

Little Machines lyrics

Portal – Lights

(sweet guitar solo)
In the throes of the ruby red river that flows through the darkening
concrete devouring ghosts that float by, I'm with them.
Up in the current and taken in whole, I've been struggling,
strangling, others in tow. Have my eyes gone missing?

#!/usr/bin/env python
from IPython.parallel.client import client
import argparse
import sys
import numpy as np
import datetime
import time
REDBULLET = u"\x1b[1;31m\u25cf\x1b[0m".encode('utf-8')
@gcr
gcr / alexnet-BETTER.lua
Last active October 12, 2016 08:16
AlexNet in Torch.
------- AlexNet: Using my own weight initialization
model = nn.Sequential()
model:add(cudnn.SpatialConvolution(3,96,11,11,4,4,2,2))
model.modules[#model.modules].weight:normal(0, 0.01)
model.modules[#model.modules].bias:fill(0)
model:add(cudnn.ReLU())
model:add(inn.SpatialCrossResponseNormalization(5, 0.0001, 0.75, 1))
model:add(nn.SpatialMaxPooling(3,3,2,2))
model:add(cudnn.SpatialConvolution(96,256,5,5,1,1,2,2))
model.modules[#model.modules].weight:normal(0, 0.01)
@gcr
gcr / t-STE gradient.ipynb
Created November 18, 2014 19:03
t-STE gradient calculations
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import gzip
import re
def load_all_movies(filename):
"""
Load and parse 'plot.list.gz'. Yields each consecutive movie as a dictionary:
{"title": "The movie's title",
"year": The decade of the movie, like 1950 or 1980,
"identifier": Full key of IMDB's text string,
"summary": "The movie's plot summary"
}
# Based on scitools meshgrid
def meshgrid(*xi, **kwargs):
"""
Return coordinate matrices from coordinate vectors.
Make N-D coordinate arrays for vectorized evaluations of
N-D scalar/vector fields over N-D grids, given
one-dimensional coordinate arrays x1, x2,..., xn.
.. versionchanged:: 1.9
{
"metadata": {
"name": "",
"signature": "sha256:78d15dad8876f550bbf2e9f489381146f98b271e5ec4e609219ad11ddaa39658"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [