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
import torch.autograd.Variable | |
max, max_idx = Variable.max(x, 1) | |
max = Variable.expand_as(max, x) | |
x = Variable.exp(x - max) | |
p = Variable(torch.zeros(x.size())) | |
for i in range(64): | |
sum = Variable.sum(x[i, :]).data[0] | |
p[i, :] = x[i, :] / sum |
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
########## main.py | |
import argparse | |
import time | |
parser = argparse.ArgumentParser(add_help=False) | |
parser.add_argument('--niter', type=int, default=100, help='number of iteration') | |
args, unparsed = parser.parse_known_args() | |
# make output file name containing the key parameters |
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
/* | |
JKImage library for communicating with python | |
Rules | |
- The input image usually follows the order of [Channel x ny x nx] | |
- | |
*/ | |
#include <math.h> | |
#include <stdio.h> |
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
import re | |
import requests | |
import titlecase | |
# I doubt if we need to go above ten | |
words_to_numerals =\ | |
{ | |
'first': '1', | |
'second': '2', | |
'third': '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
## STEP1: install tmux-plugin | |
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm | |
echo "# List of plugins | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'tmux-plugins/tmux-sensible' | |
# Other examples: | |
# set -g @plugin 'github_username/plugin_name' | |
# set -g @plugin 'git@github.com/user/plugin' |
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
echo "LABEL=cloudimg-rootfs / ext4 defaults 0 0 | |
/dev/xvdb /home01 ext4 defaults 0 2" >> /etc/fstab |
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
sudo echo "su ubuntu -c 'bash /home/ubuntu/start_script.sh'" >> /etc/rc.local | |
# make ~/start_script.sh |
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
apt-get upgrade | |
apt-get install python-setuptools git vim | |
easy_install pip |
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
import numpy as np | |
import matplotlib.pyplot as plt | |
import astra | |
if 0: | |
data_corr = np.load('tomo_corr.npy') | |
vecs = np.load('vectors.npy') | |
else: | |
import scipy.io | |
data_mat = scipy.io.loadmat('../data/Fewer_Plastics_tomo_corr_low_high_vectors') |
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
using Plots | |
using SpecialFunctions | |
function GoS(x) | |
-(1 .- erf.(x)) | |
end | |
function G(x, sigma) | |
exp.(-x.^2 ./ (2*sigma^2)) | |
end |