| 144 | |
| 145 | |
| 146 | class SELayer(nn.Module): |
| 147 | def __init__(self, channels, act_layer=nn.ReLU, gate_layer=nn.Sigmoid): |
| 148 | super().__init__() |
| 149 | self.conv_reduce = nn.Conv2d(channels, channels, 1, bias=True) |
| 150 | self.act1 = act_layer() |
| 151 | self.conv_expand = nn.Conv2d(channels, channels, 1, bias=True) |
| 152 | self.gate = gate_layer() |
| 153 | |
| 154 | def forward(self, x, x_se): |
| 155 | x_se = self.conv_reduce(x_se) |
| 156 | x_se = self.act1(x_se) |
| 157 | x_se = self.conv_expand(x_se) |
| 158 | return x * self.gate(x_se) |
| 159 | |
| 160 | |
| 161 | class DepthNet(nn.Module): |