This file contains 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
%2013/1/1 | |
%Tzu-Wei Huang | |
%demo of 'derivative of Gaussian', Difference of Gaussians and | |
%'Laplacian of Gaussian' in matlab. | |
close all; | |
[x,y] = meshgrid(-5:0.1:5,-5:0.1:5); | |
%gaussian with sigma = 1 | |
z = (1/sqrt(2*pi))./exp((x.^2+y.^2)/2); |
This file contains 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
prices = { | |
"banana": 10, | |
"apple": 20, | |
"orange": 15, | |
"mango": 30 | |
} | |
shopping_list1 = ["banana", "orange", "apple", "apple", "apple"] | |
shopping_list2 = ["banana", "orange", "apple", "banana", "apple"] | |
def sumThemAll(shoplist): |
This file contains 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
f = open('drinkquiz.txt', 'w') | |
char_remove = ['。\n。\n', '.\n.\n', '…\n…\n', '.\n.\n', '°\n°\n', '·\n·\n', '•\n•\n', '+\n+\n'] | |
for i in range(2500): | |
for feed in feeds['data']: | |
if 'message' in feed: | |
msg = feed['message'] | |
#print (msg) | |
for rm in char_remove: | |
msg = msg.replace(rm,'') | |
#print(msg) |
This file contains 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
#!/usr/bin/env bash | |
set -e | |
###################################################################### | |
# This script installs required dependencies for Torch7 | |
###################################################################### | |
{ | |
install_openblas() { | |
# Get and build OpenBlas (Torch is much better with a decent Blas) |
This file contains 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
class AlexNet(nn.Module): | |
def __init__(self, num_classes=1000): | |
super(AlexNet, self).__init__() | |
self.features = nn.Sequential( | |
nn.Conv2d(3, 64, kernel_size=11, stride=4, padding=2), | |
nn.ReLU(inplace=True), | |
nn.MaxPool2d(kernel_size=3, stride=2), | |
nn.Conv2d(64, 192, kernel_size=5, padding=2), | |
nn.ReLU(inplace=True), |
This file contains 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
graph(%0 : Float(1, 3, 224, 224) | |
%1 : Float(64, 3, 11, 11) | |
%2 : Float(64) | |
%3 : Float(192, 64, 5, 5) | |
%4 : Float(192) | |
%5 : Float(384, 192, 3, 3) | |
%6 : Float(384) | |
%7 : Float(256, 384, 3, 3) | |
%8 : Float(256) | |
%9 : Float(256, 256, 3, 3) |
This file contains 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
graph(%0 : Float(1, 3, 224, 224) | |
%1 : Float(64, 3, 11, 11) | |
%2 : Float(64) | |
%3 : Float(192, 64, 5, 5) | |
%4 : Float(192) | |
%5 : Float(384, 192, 3, 3) | |
%6 : Float(384) | |
%7 : Float(256, 384, 3, 3) | |
%8 : Float(256) | |
%9 : Float(256, 256, 3, 3) |
This file contains 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
with open ('data.csv') as f: | |
lines = f.readlines() | |
valid = [] | |
for line in lines: | |
a, b = line.strip('\n').split(',') | |
if a=='1' or a=='2' or a=='3': | |
print(a, b) | |
valid.append((int(a), int(b))) |
This file contains 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 print_function | |
import argparse | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import torch.optim as optim | |
from torchvision import datasets, transforms | |
from torch.autograd import Variable | |
from tensorboardX import SummaryWriter | |
# Training settings |
This file contains 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
class Net1(nn.Module): | |
def __init__(self): | |
super(Net1, self).__init__() | |
self.conv1 = nn.Conv2d(1, 10, kernel_size=5) | |
self.conv2 = nn.Conv2d(10, 20, kernel_size=5) | |
self.conv2_drop = nn.Dropout2d() | |
self.fc1 = nn.Linear(320, 50) | |
self.fc2 = nn.Linear(50, 10) | |
self.bn = nn.BatchNorm2d(20) |
OlderNewer