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 | |
import torch.nn as nn | |
import torch.optim as optim | |
import torch.nn.functional as F | |
import torchvision | |
import torchvision.transforms as transforms | |
from torchvision.utils import save_image | |
from torchvision.datasets import MNIST, FashionMNIST, CIFAR10, STL10 | |
import os | |
import pickle |
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
#!/bin/bash | |
### steps #### | |
# Verify the system has a cuda-capable gpu | |
# Download and install the nvidia cuda toolkit and cudnn | |
# Setup environmental variables | |
# Verify the installation | |
### | |
### to verify your gpu is cuda enable check |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 | |
from keras.models import Sequential | |
from keras.layers.core import Dense, Activation, Dropout, TimeDistributedDense | |
from keras.layers.recurrent import LSTM | |
text = open('/home/russellp/w/data/citation-graph/abstracts.txt', 'r').read() | |
char_to_idx = { ch: i for (i, ch) in enumerate(sorted(list(set(text)))) } | |
idx_to_char = { i: ch for (ch, i) in char_to_idx.items() } | |
vocab_size = len(char_to_idx) |
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
def cumsum(softmax): | |
values = tf.split(1, softmax.get_shape()[1], softmax) | |
out = [] | |
prev = tf.zeros_like(values[0]) | |
for val in values: | |
s = prev + val | |
out.append(s) | |
prev = s | |
cumsum = tf.concat(1, out) | |
return cumsum |