poetry new <project-name>poetry add <library>| 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)) |