Skip to content

Instantly share code, notes, and snippets.

View jainraj's full-sized avatar
🎯
Focusing

Raj V Jain jainraj

🎯
Focusing
View GitHub Profile
@jainraj
jainraj / variational_lstm.py
Last active November 6, 2023 13:06
Variational LSTM implemented based on Gal & Ghahramani's paper - https://arxiv.org/abs/1512.05287
from pytorch_lightning.utilities.seed import seed_everything
from torch import device as Device, dtype as DType, Tensor
from torch.nn import Parameter, LSTM, init
from typing import List, Tuple, Optional
import torch.nn as nn
import torch
def reverse(lst: List[Tensor]) -> List[Tensor]:
return lst[::-1]