Skip to content

Instantly share code, notes, and snippets.

View Banus's full-sized avatar
🌏
Building procedural worlds

Emanuele Plebani Banus

🌏
Building procedural worlds
View GitHub Profile
@Banus
Banus / kronecker_decompose.py
Created September 22, 2023 02:44 — forked from norabelrose/kronecker_decompose.py
Fast, optimal Kronecker decomposition
from einops import rearrange
from torch import Tensor
import torch
def kronecker_decompose(
A: Tensor, m: int, n: int, *, k: int = 1, niter: int = 10
) -> tuple[Tensor, Tensor]:
"""Frobenius-optimal decomposition of `A` into a sum of `k` Kronecker products.
# Mathieu Blondel, 2022
# BSD license
import numpy as np
from scipy.ndimage import convolve1d
from sklearn.metrics.pairwise import euclidean_distances
def smoothed_conjugate_conv(f, x, eps=1.0):
"""
@Banus
Banus / pytorch_seed.py
Last active December 22, 2021 22:18 — forked from righthandabacus/seed_everything.py
Random seeding
# Source: @kastnerkyle
# https://twitter.com/kastnerkyle/status/1473361479143460872
import os
import random
import numpy as np
import torch
default_seed=4142
print("Setting all possible default seeds based on {}".format(default_seed))
@Banus
Banus / gist:491826818b4e92dde58864047cc4e55b
Last active February 22, 2018 15:42
submodule hases for facebookresearch/TensorComprehensions issue
f234e94aedffdbd9a47092ac36ea1784da8bc50a third-party/ATen (remotes/origin/sync_test-25-gf234e94)
5651c4ce0279c895cbb1d1eeecc6594cc8791103 third-party/caffe2 (v0.8.1-1126-g5651c4c)
af4eeb5c50b02a76a0f89471da00032c26973d41 third-party/caffe2/third_party/FP16 (heads/master)
a9feb41dc9d05e59604c114c6b6a893d842b9d7b third-party/caffe2/third_party/FXdiv (heads/master)
db3a4439d233276e25681fb4735b7f8e674dda65 third-party/caffe2/third_party/NNPACK (heads/master)
c80d6f7a924b53942b569b45278517565ea43d82 third-party/caffe2/third_party/aten (remotes/origin/sync_test-11-gc80d6f7)
491360b833aaab96818dce256a8409f6296dd995 third-party/caffe2/third_party/benchmark (v1.2.0-28-g491360b)
e135eff731cff8b1a3b1dec904e9c79e989051ec third-party/caffe2/third_party/cpuinfo (e135eff)
285aeebaa34b0e8a7670867a2e66c1a52d998d6a third-party/caffe2/third_party/cub (v1.7.3-1-g285aeeb)
4e79cb69b9425f5f8c3a84be4350d4ab75b5fd9d third-party/caffe2/third_party/eigen (3.3.0-601-g4e79cb6)
@Banus
Banus / README.md
Last active December 29, 2015 05:09 — forked from JoelBesada/README.md

Mendeley command for Backtick.

How to add this command:

  1. Copy the ID of your Gist from the URL. (7619625)

  2. Paste the ID into the custom commands field in the Backtick settings. You can easily access the settings by clicking the Backtick icon on the command execution console.