Example #1
0
    def forward(self, x: Tensor) -> Tensor:
        if self.stride == 1:
            x1, x2 = x.chunk(2, dim=1)
            out = self.cat.cat([x1, self.branch2(x2)], dim=1)
        else:
            out = self.cat.cat([self.branch1(x), self.branch2(x)], dim=1)

        out = shufflenetv2.channel_shuffle(out, 2)

        return out
Example #2
0
    def forward(self, x):
        if self.stride == 1:
            x1, x2 = x.chunk(2, dim=1)
            out = self.cat.cat((x1, self.branch2(x2)), dim=1)
        else:
            out = self.cat.cat((self.branch1(x), self.branch2(x)), dim=1)

        out = shufflenetv2.channel_shuffle(out, 2)

        return out
Example #3
0
    def forward(self, x):
        skip = x
        x = self.conv(x)

        x = channel_shuffle(x, self.num_groups)

        result = []
        for s2_block in self.s2_blocks:
            result.append(s2_block(x))

        x = torch.cat(result, 1)

        if self.skip:
            x = x + skip

        x = self.bn(x)
        x = self.prelu(x)

        return x