This file contains hidden or 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 torch | |
from urllib import request | |
import gzip | |
import pickle | |
import os | |
def load_mnist(final=False, flatten=True, verbose=False, normalize=True): | |
""" | |
Load the MNIST data. |
This file contains hidden or 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 torch.utils.data import IterableDataset, DataLoader | |
# The dataset has no length | |
class TestDataset(IterableDataset): | |
def __iter__(self): # __iter__() can be a generator | |
while True: | |
yield 5 | |
# The loader is called as normal |
This file contains hidden or 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 wget, os, gzip, pickle, random, re, sys | |
IMDB_URL = 'http://dlvu.github.io/data/imdb.{}.pkl.gz' | |
IMDB_FILE = 'imdb.{}.pkl.gz' | |
PAD, START, END, UNK = '.pad', '.start', '.end', '.unk' | |
def load_imdb(final=False, val=5000, seed=0, voc=None, char=False): | |
cst = 'char' if char else 'word' |
This file contains hidden or 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
package org.submassive; | |
import java.io.BufferedInputStream; | |
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; |
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 hidden or 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
# -- assignment 1 -- | |
import numpy as np | |
from urllib import request | |
import gzip | |
import pickle | |
import os | |
def load_synth(num_train=60_000, num_val=10_000, seed=0): | |
""" | |
Load some very basic synthetic data that should be easy to classify. Two features, so that we can plot the |
This file contains hidden or 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 | |
from torch import nn | |
import torch.distributions as dist | |
## REINFORCE | |
adjacencies, num_edges, targets = load_data(...) | |
opt = ... |
This file contains hidden or 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, os, sys | |
from torch import nn | |
import torch.nn.functional as F | |
import torch.distributions as ds | |
from math import sqrt, ceil | |
import layers, util |
This file contains hidden or 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.nn.functional as F | |
import torchvision | |
from torch.autograd import Variable | |
from torchvision.transforms import CenterCrop, ToTensor, Compose, Lambda, Resize, Grayscale | |
from torchvision.datasets import coco |
This file contains hidden or 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 roslib #; roslib.load_manifest('sr_example') | |
import rospy | |
from geometry_msgs.msg import Twist | |
from std_msgs.msg import Float64, String | |
rospy.init_node('turtlebot_controller', anonymous=True) | |
def move(dist, angle): | |
pub = rospy.Publisher('/turtle1/cmd_vel', Twist, queue_size=10) |
NewerOlder