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/zsh | |
magick convert -size 3840x2160 <(scrot -o /dev/stdout)'[384x216]' -blur 0x5 -resize 1000% RGB:- | i3lock --raw 3840x2160:rgb --image /dev/stdin |
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.nn | |
import geoopt | |
# package.nn.modules.py | |
def create_ball(ball=None, c=None): | |
if ball is None: | |
assert c is not None, "curvature of the ball should be explicitly specified" | |
ball = geoopt.PoincareBall(c) | |
elif not isinstance(ball, geoopt.PoincareBall): | |
raise ValueError("ball should be an instance of PoncareMall") | |
return ball |
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 sacred.observers | |
import tensorboardX | |
import os | |
class TensorboardObserver(sacred.observers.FileStorageObserver, tensorboardX.SummaryWriter): | |
VERSION = "TensorboardObserver-0.0.1" | |
def __init__(self, basedir, resource_dir=None, source_dir=None, | |
template=None, priority=sacred.observers.file_storage.DEFAULT_FILE_STORAGE_PRIORITY, |
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.nn | |
import collections | |
class Builder(object): | |
def __init__(self, *namespaces): | |
self._namespace = collections.ChainMap(*namespaces) | |
def __call__(self, name, *args, **kwargs): | |
try: | |
return self._namespace[name](*args, **kwargs) |
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 | |
def map_nested(fn, structure, cond=lambda obj: isinstance(obj, torch.Tensor)): | |
r""" | |
Applies fn to an object in a possibly nested data structure and returns same | |
structure with every element changed if condition satisfied. | |
""" | |
def inner_map(obj): | |
if cond(obj): | |
return fn(obj) |
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 itertools | |
import torch | |
def svd(x): | |
# https://discuss.pytorch.org/t/multidimensional-svd/4366/2 | |
batches = x.shape[:-2] | |
if batches: | |
n, m = x.shape[-2:] | |
k = min(n, m) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder