Hi, I’m currently working on a VAE for my master thesis and I have some questions I couldn’t find answers to.
I have a GRU in my guide and I’d like to register its initial state (h_0_guide) as a learnable parameter.
- Is there a standard way of initializing GRUs or RNNs in general in a guide? The only example I found initialized them with zeros.
- From what I understand the PyroParam is a wrapper around nn.Parameter allowing for adding constraints, is the way I’m using nn.Parameter correct if I don’t need any constraints for h_0 or should I use PyroParam instead? Are there any args or kwargs I should be taking into account?
Any input is more than welcome!
My pseudocode:
class VAE(nn.Module):
def init():
self.h_o_guide = nn.Parameter(torch.randn(gru_hidden_dim_Guide), requires_grad=True)
def guide(…):
h_0_gru = self.h_0_guide.expand(self.gruGUIDE.num_layers*2, sequences.size(0), self.gruGUIDE.hidden_size).contiguous()
…
def model():
…