MCPcopy Create free account
hub / github.com/AllentDan/LibtorchSegmentation / FPABlockImpl

Method FPABlockImpl

src/architectures/PANDecoder.cpp:26–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26FPABlockImpl::FPABlockImpl(int in_channels, int out_channels, std::string _upscale_mode) {
27 align_corners = _upscale_mode == "bilinear";
28 branch1 = torch::nn::Sequential(torch::nn::AdaptiveAvgPool2d(torch::nn::AdaptiveAvgPool2dOptions(1)),
29 ConvBnRelu(in_channels, out_channels, 1, 1, 0));
30 mid = torch::nn::Sequential(ConvBnRelu(in_channels, out_channels, 1, 1, 0));
31 down1 = torch::nn::Sequential(torch::nn::MaxPool2d(torch::nn::MaxPool2dOptions(2).stride(2)),
32 ConvBnRelu(in_channels, 1, 7, 1, 3));
33 down2 = torch::nn::Sequential(torch::nn::MaxPool2d(torch::nn::MaxPool2dOptions(2).stride(2)),
34 ConvBnRelu(1, 1, 5, 1, 2));
35 down3 = torch::nn::Sequential(torch::nn::MaxPool2d(torch::nn::MaxPool2dOptions(2).stride(2)),
36 ConvBnRelu(1, 1, 3, 1, 1),
37 ConvBnRelu(1, 1, 3, 1, 1));
38 conv2 = ConvBnRelu(1, 1, 5, 1, 2);
39 conv1 = ConvBnRelu(1, 1, 7, 1, 3);
40
41 register_module("branch1", branch1);
42 register_module("mid", mid);
43 register_module("down1", down1);
44 register_module("down2", down2);
45 register_module("down3", down3);
46 register_module("conv2", conv2);
47 register_module("conv1", conv1);
48}
49
50torch::Tensor FPABlockImpl::forward(torch::Tensor x) {
51 auto h = x.sizes()[2];

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected