Skip to content

Instantly share code, notes, and snippets.

View gerritgr's full-sized avatar

Gerrit gerritgr

  • Saarland University
View GitHub Profile
@Flunzmas
Flunzmas / calc_2_wasserstein_dist.py
Last active November 6, 2023 03:06
Differentiable 2-Wasserstein Distance in PyTorch
import math
import torch
import torch.linalg as linalg
def calculate_2_wasserstein_dist(X, Y):
'''
Calulates the two components of the 2-Wasserstein metric:
The general formula is given by: d(P_X, P_Y) = min_{X, Y} E[|X-Y|^2]
For multivariate gaussian distributed inputs z_X ~ MN(mu_X, cov_X) and z_Y ~ MN(mu_Y, cov_Y),
@wohlert
wohlert / Sinkhorn-solver.ipynb
Created April 3, 2019 11:43
Sinkhorn solver in PyTorch
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kiwidamien
kiwidamien / pre-commit
Last active February 5, 2023 10:59
Github pre-commit hook to prevent commits of large files
#!/bin/sh
# This is a pre-commit hook that ensures attempts to commit files that
# are larger than 100 MB to your _local_ repo fail, with a helpful error
# message.
#
# This prevents the local repo from getting out of sync with the Github
# repo. To install
# 1) Change this file to executable:
# $ chmod a+x pre-commit
@nlap
nlap / graph-tool-ubuntu.md
Last active January 3, 2022 21:07
graph-tool on Ubuntu 14.04

graph-tool on Ubuntu 14.04

Recommended: Graph-tool one-line install commands:

anaconda conda create --name gt -c conda-forge graph-tool

homebrew brew install graph-tool