| 1 | #include "UNetDecoder.h" |
| 2 | |
| 3 | SCSEModuleImpl::SCSEModuleImpl(int in_channels, int reduction, bool _use_attention){ |
| 4 | use_attention = _use_attention; |
| 5 | cSE = torch::nn::Sequential( |
| 6 | torch::nn::AdaptiveAvgPool2d(torch::nn::AdaptiveAvgPool2dOptions(1)), |
| 7 | torch::nn::Conv2d(conv_options(in_channels, in_channels / reduction, 1)), |
| 8 | torch::nn::ReLU(torch::nn::ReLUOptions(true)), |
| 9 | torch::nn::Conv2d(conv_options(in_channels / reduction, in_channels, 1)), |
| 10 | torch::nn::Sigmoid()); |
| 11 | sSE = torch::nn::Sequential(torch::nn::Conv2d(conv_options(in_channels, 1, 1)), torch::nn::Sigmoid()); |
| 12 | register_module("cSE",cSE); |
| 13 | register_module("sSE",sSE); |
| 14 | } |
| 15 | |
| 16 | torch::Tensor SCSEModuleImpl::forward(torch::Tensor x){ |
| 17 | if(!use_attention) return x; |
nothing calls this directly
no test coverage detected