(self, h, x)
| 53 | |
| 54 | |
| 55 | def forward(self, h, x): |
| 56 | # horizontal |
| 57 | hx = torch.cat([h, x], dim=1) |
| 58 | z = torch.sigmoid(self.convz1(hx)) |
| 59 | r = torch.sigmoid(self.convr1(hx)) |
| 60 | q = torch.tanh(self.convq1(torch.cat([r*h, x], dim=1))) |
| 61 | h = (1-z) * h + z * q |
| 62 | |
| 63 | # vertical |
| 64 | hx = torch.cat([h, x], dim=1) |
| 65 | z = torch.sigmoid(self.convz2(hx)) |
| 66 | r = torch.sigmoid(self.convr2(hx)) |
| 67 | q = torch.tanh(self.convq2(torch.cat([r*h, x], dim=1))) |
| 68 | h = (1-z) * h + z * q |
| 69 | |
| 70 | return h |
| 71 | |
| 72 | class SmallMotionEncoder(nn.Module): |
| 73 | def __init__(self, args): |
nothing calls this directly
no outgoing calls
no test coverage detected