Skip to content

Instantly share code, notes, and snippets.

# Map Cooperative Networks
import shutil
import csv
from map_code.coop_elm import *
import argparse
from acd.models import _netE, _netG, _netI
parser = argparse.ArgumentParser()
t_pl = tf.placeholder(shape=[], dtype=tf.float32, name='t_pl')
# B(t) = (1-t)^3 P0 + 3(1-t)^2 t P1 + 3(1-t) t^2 P2 + t^3 P3
wt = [((1-t_pl) ** 3)*np.array(P0[i]) + (3*(1-t_pl)**2)*t_pl*P1[i] + (3*(t_pl-1)*(t_pl**2))*P2[i] + (t_pl**3)*P3[i] for i in range(len(P0))]
model_t = Cifar10ModelSimple(wt, resnet_size=32)
logits_t = model_t(x, is_training)
cross_entropy_t = tf.losses.softmax_cross_entropy(logits=logits_t, onehot_labels=y_)
correct_prediction_t = tf.equal(tf.argmax(logits_t, axis=1), tf.argmax(y_, axis=1))
accuracy_t = tf.reduce_mean(tf.cast(correct_prediction_t, tf.float32))
distance_t = distance_to(wt, P0)
\begin{table}[h]
\begin{tabular}{|>{\raggedright}m{0.125\textwidth}|>{\raggedright}m{0.56\textwidth}|>{\centering}m{0.08\textwidth}|>{\centering}m{0.07\textwidth}|>{\centering}m{0.07\textwidth}|}
\hline
Project & Experiment & CPU SU's & GPU SU's & Storage (GB)\tabularnewline
\hline
\hline
\multirow{3}{0.15\textwidth}{(1) Learning Generative Models}
& (a) Single-Grid Minimal Contrastive Divergence & $2,000$ & $10,000$ & $100$\tabularnewline
\cline{2-5}
& (b) Latent Variable Convolutional Energy-based Models & $2,000$ & $12,500$ & $200$\tabularnewline
sudo singularity build --sandbox ubuntu/ docker://ubuntu:16.04
singularity shell ubuntu
apt update
apt install wget cron
wget https://d2t3ff60b2tol4.cloudfront.net/builds/insync-headless_1.5.2.37346-wheezy_amd64.deb
dpkg -i insync-headless_1.5.2.37346-wheezy_amd64.deb
singularity build ubuntu.img ubuntu
case 'log' % Laplacian of Gaussian
% first calculate Gaussian
siz = (p2-1)/2;
std2 = p3^2;
[x,y] = meshgrid(-siz(2):siz(2),-siz(1):siz(1));
arg = -(x.*x + y.*y)/(2*std2);
h = exp(arg);
h(h<eps*max(h(:))) = 0;
-0.1068 -0.1761 -0.1068
0.2136 0.3522 0.2136
-0.1068 -0.1761 -0.1068
#!/bin/bash
#SBATCH -N 1
#SBATCH -p GPU-shared
#SBATCH --ntasks-per-node 4
#SBATCH --gres=gpu:p100:1
#SBATCH -t 47:00:00
module load python2/2.7.11_gcc
module load cuda/8.0
cd
20900 en_gen_0= -2.006107 en_gen_1= -2.008458 en_gen_d= -0.002351
20900 en_pos=[ -4.6743] en_neg=[ -1.9059]
20900 en_pos_test=[ -4.3532] en_neg_test=[ -2.4173]
20900 en_pos=[ -4.6743 -4.6741 0.0001] en_neg=[ -1.9059 -1.9036 0.0023]
20900 loss= -2.0061
20900 neg_range=[ 0.0000 0.9999] neg_abs_sum= 239.6976
x_pos_0 = 3 - 3 + 2 + 2
x_pos_0 = 3 - 3 + 2 + 2
x_neg_0 = ( 1 * ( 3 3 3
x_neg_1 = ( ( z ( + 3 3 )
import torch.utils
import torch.nn.utils
from torch.utils import data
from torchvision import transforms
from PIL import Image, ImageDraw
import numpy as np
@enijkamp
enijkamp / plot.py
Created December 28, 2018 18:59
minimal dataset
import torch.utils
import torch.nn.utils
from torch.utils import data
from torchvision import transforms
from PIL import Image, ImageDraw
import numpy as np