Skip to content

Instantly share code, notes, and snippets.

@redwrasse
redwrasse / heteroscedastic.py
Last active January 8, 2021 21:23
heteroscedastic model: parameterized variance in discriminative gaussian
# -*- coding: utf-8 -*-
"""
standard discriminative gaussian
y ~ N(f(x), sigma^2)
as well as heteroscedastic model
y ~ N(f(x), sigma^2(x))
training on a dataset requiring the heteroscedastic model:
x in R, y in R^2
@redwrasse
redwrasse / toy_stwalk.py
Last active May 20, 2021 23:59
toy implementation of 'space-time as a contrastive random walk'
# pseudocode impl
# Algorithm 1 Pseudocode in a PyTorch-like style.
# for x in loader: # x: batch with B sequences
# # Split image into patches
# # B x C x T x H x W -> B x C x T x N x h x w
# x = unfold(x, (patch_size, patch_size))
# x = spatial_jitter(x)
# # Embed patches (B x C x T x N)
# v = l2_norm(resnet(x))