MCPcopy Create free account
hub / github.com/drinkingcoder/FlowFormer-Official / BasicUpdateBlock

Class BasicUpdateBlock

core/update.py:114–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112 return net, None, delta_flow
113
114class BasicUpdateBlock(nn.Module):
115 def __init__(self, args, hidden_dim=128, input_dim=128):
116 super(BasicUpdateBlock, self).__init__()
117 self.args = args
118 self.encoder = BasicMotionEncoder(args)
119 self.gru = SepConvGRU(hidden_dim=hidden_dim, input_dim=128+hidden_dim)
120 self.flow_head = FlowHead(hidden_dim, hidden_dim=256)
121
122 self.mask = nn.Sequential(
123 nn.Conv2d(128, 256, 3, padding=1),
124 nn.ReLU(inplace=True),
125 nn.Conv2d(256, 64*9, 1, padding=0))
126
127 def forward(self, net, inp, corr, flow, upsample=True):
128 motion_features = self.encoder(flow, corr)
129 inp = torch.cat([inp, motion_features], dim=1)
130
131 net = self.gru(net, inp)
132 delta_flow = self.flow_head(net)
133
134 # scale mask to balence gradients
135 mask = .25 * self.mask(net)
136 return net, mask, delta_flow
137
138
139

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected