This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
embeddings_mu = nn.Embedding(n_words, n_dim) | |
embeddings_lv = nn.Embedding(n_words, n_dim) | |
... | |
vector_mu = embeddings_mu(c_index) | |
vector_lv = embeddings_lv(c_index) | |
def normal(mu, lv): | |
random = torch.FloatTensor(std.size()).normal_() | |
return mu + random * torch.exp(0.5 * lv) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from torch_trainer.trainer import Trainer | |
from torch_trainer.callbacks import rms_callback | |
from torch import nn | |
from torch.optim import Adam | |
import torch.nn.functional as F | |
import numpy as np | |
import pandas as pd | |