Skip to content

Instantly share code, notes, and snippets.

View shawntan's full-sized avatar

Shawn Tan shawntan

View GitHub Profile
import numpy as np
import os
from pynput.mouse import Listener, Button
bounding_box = []
def on_click(x, y, btn, down):
if btn == Button.left and down:
print(x, y)
bounding_box.append((x, y))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import torch
import torch.nn as nn
from torch.nn import Module
from torch.nn.parameter import Parameter
from torch.nn import functional as F
import numpy as np
class LinearLowerTriangular(nn.Linear):
def __init__(self, in_features, upscale=1, strict=True):
import nltk
import json
from nltk import word_tokenize
from collections import Counter
from itertools import izip
from pprint import pprint
labels = ['entailment', 'contradiction', 'neutral']
def get_dataset(filename):
<html>
<body>
<a href='javascript:var w = window.open("","bib","width=300,height=300,scrollbars=1,resizable=1");w.document.open();w.document.write("@article{krueger2017bayesian,
title={Bayesian hypernetworks},
author={Krueger, David and Huang, Chin-Wei and Islam, Riashat and Turner, Ryan and Lacoste, Alexandre and Courville, Aaron},
journal={arXiv preprint arXiv:1710.04759},
year={2017}
}");w.document.close();'> Open a window that says test</a>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
HostFromGpu(gpuarray) [id A] ''
|GpuElemwise{Composite{(i0 + (i1 * i2))}}[]<gpuarray> [id B] ''
|GpuDnnReduction{red_op='add', axis=None, acc_dtype='float32', dtype='float32', return_indices=False} [id C] ''
| |GpuContiguous [id D] ''
| |GpuElemwise{switch,no_inplace} [id E] ''
| |GpuElemwise{neq,no_inplace} [id F] ''
| | |GpuReshape{1} [id G] ''
| | | |GpuSubtensor{int64:int64:int8, :int64:} [id H] ''
| | | | |InplaceGpuDimShuffle{1,0} [id I] ''
| | | | | |GpuFromHost<None> [id J] ''
import theano.tensor as T
import theano
import numpy as np
from theano_toolkit import hinton
def log_cascaded_stick_breaking(lin_input, reps=5):
idx = T.arange(lin_input.shape[1])
top_right = idx[None, :] > idx[:, None]
log_g = -T.nnet.softplus(-lin_input)
acc_log_neg = 0
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
scriptencoding utf-8
set encoding=utf-8
filetype plugin on
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.