(self, h, x)
| 43 | |
| 44 | |
| 45 | def forward(self, h, x): |
| 46 | # horizontal |
| 47 | hx = torch.cat([h, x], dim=1) |
| 48 | z = torch.sigmoid(self.convz1(hx)) |
| 49 | r = torch.sigmoid(self.convr1(hx)) |
| 50 | q = torch.tanh(self.convq1(torch.cat([r*h, x], dim=1))) |
| 51 | h = (1-z) * h + z * q |
| 52 | |
| 53 | # vertical |
| 54 | hx = torch.cat([h, x], dim=1) |
| 55 | z = torch.sigmoid(self.convz2(hx)) |
| 56 | r = torch.sigmoid(self.convr2(hx)) |
| 57 | q = torch.tanh(self.convq2(torch.cat([r*h, x], dim=1))) |
| 58 | h = (1-z) * h + z * q |
| 59 | |
| 60 | return h |
| 61 | |
| 62 | class SmallMotionEncoder(nn.Module): |
| 63 | def __init__(self, args): |
nothing calls this directly
no outgoing calls
no test coverage detected