Skip to content

Instantly share code, notes, and snippets.

View downloader.py
# coding=utf-8
# Copyright 2020 The Google AI Perception Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@gngdb
gngdb / Pooling.ipynb
Created Jun 23, 2021
Pooling notebook for checking einops channel pooling correctness
View Pooling.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gngdb
gngdb / MLP_Mixer_without_Linear.ipynb
Created May 11, 2021
Technically an implementation of MLP-Mixer without nn.Linear
View MLP_Mixer_without_Linear.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View relational.py
import torch
from einops import rearrange, repeat, reduce
def relation(input, g, embedding=None, max_pairwise=None):
r"""Applies an all-to-all pairwise relation function to a set of objects.
See :class:`~torch.nn.Relation` for details.
"""
# Batch size, number of objects, feature size
b, o, c = input.size()
# Create pairwise matrix
@gngdb
gngdb / Grayscale Quantised Painting Avatar.ipynb
Last active Mar 31, 2021
Generating a new profile picture in the most convoluted way possible.
View Grayscale Quantised Painting Avatar.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Unpacked minGPT.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gngdb
gngdb / Basin Hopping.ipynb
Last active Feb 18, 2021
An example using scipy.optimize's basin hopping with torch calculating gradients
View Basin Hopping.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View README.md

This gist shows how to use rebase to change the Git history of a repo. Imagine you realise that the first commit to your repo should be different (maybe it's incomplete, includes something it shouldn't or simply could be cleaner). However, since then you and others have made many changes to the repo that you want to preserve. Here we show how to split the first commit into multiple and re-attach the remaining version history to these new commits.

Let's make a dummy git repo rebase-root and add two files to it. We commit them with the commit #1.

@gngdb
gngdb / Soap Bubble Effect.ipynb
Created Jun 4, 2020
Soap bubble effect simulation
View Soap Bubble Effect.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gngdb
gngdb / sample_output
Last active Jun 3, 2020
Testing random seed setting in different threads
View sample_output
Tuples sampled in parallel or sequentially are equal:
0.496, 0.549, 0.844 == 0.496, 0.549, 0.844
0.758, 0.417, 0.134 == 0.758, 0.417, 0.134
0.615, 0.436, 0.956 == 0.615, 0.436, 0.956
0.004, 0.551, 0.238 == 0.004, 0.551, 0.238
0.560, 0.967, 0.236 == 0.560, 0.967, 0.236
0.830, 0.222, 0.623 == 0.830, 0.222, 0.623
0.572, 0.893, 0.793 == 0.572, 0.893, 0.793
0.535, 0.076, 0.324 == 0.535, 0.076, 0.324
0.598, 0.873, 0.227 == 0.598, 0.873, 0.227