Skip to content

Instantly share code, notes, and snippets.

View kawine's full-sized avatar

Kawin kawine

View GitHub Profile
@CarlosDomingues
CarlosDomingues / python-poetry-cheatsheet.md
Last active July 12, 2024 17:05
Python Poetry Cheatsheet

Create a new project

poetry new <project-name>

Add a new lib

poetry add <library>

Remove a lib

@yzh119
yzh119 / st-gumbel.py
Created January 12, 2018 12:25
ST-Gumbel-Softmax-Pytorch
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
def sample_gumbel(shape, eps=1e-20):
U = torch.rand(shape).cuda()
return -Variable(torch.log(-torch.log(U + eps) + eps))