What is "bridge" in forward method in U-Net?

hello everyone. I am new to Pytorch, sorry if my question is too simple. I found this code on Github for implementing U-Net architecture. I don’t understand what is “bridge” for in the forward method. could anybody explain it to me please?

def center_crop(self, layer, target_size):
_, _, layer_height, layer_width = layer.size()
diff_y = (layer_height - target_size[0]) // 2
diff_x = (layer_width - target_size[1]) // 2
return layer[
:, :, diff_y : (diff_y + target_size[0]), diff_x : (diff_x + target_size[1])
]

def forward(self, x, bridge):
    up = self.up(x)
    crop1 = self.center_crop(bridge, up.shape[2:])
    out = torch.cat([up, crop1], 1)
    out = self.conv_block(out)

    return out

The bridge tensor is most likely an activation tensor from the “left” part from the model (the down path), which is then passed to the “right” side of the model (the up path).
The paper shows the architecture in a figure and you would see the connections between the down/up paths.

1 Like