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
from functools import reduce | |
from copy import deepcopy | |
from itertools import product | |
def get_key_paths(d, key_paths=[], param_lists=[], acc=[]): | |
for k, v in d.items(): | |
if isinstance(v, dict): | |
get_key_paths(v, key_paths, param_lists, acc=acc + [k]) | |
elif isinstance(v, list): |
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 | |
# make_cmap function is from: http://schubert.atmos.colostate.edu/~cslocum/custom_cmap.html | |
def make_cmap(colors, position=None, bit=False): | |
''' | |
make_cmap takes a list of tuples which contain RGB values. The RGB | |
values may either be in 8-bit [0 to 255] (in which bit must be set to | |
True when called) or arithmetic [0 to 1] (default). make_cmap returns |
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 | |
# Base class | |
class Base: | |
# 'Constructor' class methods to make instances with common values for data attribute | |
@classmethod | |
def create_common_instance_1(cls): | |
value = np.eye(3) | |
return cls(value) |
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
\documentclass{article} | |
\usepackage[utf8]{inputenc} | |
\usepackage{tikz} | |
\usepackage{pgfplots} | |
\begin{document} | |
\begin{figure}[ht] | |
\centering |
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 | |
from scipy.special import gamma | |
trials = 200 | |
steps = 1000 | |
xs = np.arange(steps) | |
ds = [1, 10, 100] | |
fig, axes = plt.subplots(1, 3, sharey=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
import numpy as np | |
from PIL import Image | |
from tqdm import tqdm | |
# Image resolution will be this divided by 2 | |
# due to downsampling | |
resolution = 4000 | |
# Points in the complex plane |
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 PIL import Image | |
from matplotlib.colors import hsv_to_rgb | |
# Parameters | |
lim = 50 | |
sub_pixel_resolution = 1 | |
xs_min, xs_max = (-lim, lim) | |
ys_min, ys_max = (-lim * 0.5625, lim * 0.5625) |
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 | |
class MirroredConv1d(nn.Module): | |
def __init__(self, **kwargs): | |
super(MirroredConv1d, self).__init__() | |
if kwargs['out_channels'] % 2 == 1: | |
raise ValueError('Number of output channels must be even') |
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 | |
from pathlib import Path | |
import platform | |
from datetime import datetime | |
import git | |
from pip._internal.operations import freeze | |
def save_checkpoint(checkpoint_path, model, optimizer, config_dict): | |
run_info = { |
OlderNewer