Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuse layer problem #64

Open
wangbotao opened this issue Oct 28, 2021 · 1 comment
Open

Fuse layer problem #64

wangbotao opened this issue Oct 28, 2021 · 1 comment

Comments

@wangbotao
Copy link

Here is the current code of the fuse layer:

if self.with_fuse:
    out_fuse = []
    for i in range(len(self.fuse_layers)):
        y = out[0] if i == 0 else self.fuse_layers[i][0](out[0])
        for j in range(self.num_branches):
            if i == j:
                y += out[j]
            else:
                y += self.fuse_layers[i][j](out[j])
        out_fuse.append(self.relu(y))
    out = out_fuse

Problem is that the first scale is added twice.
First time: y = out[0] if i == 0 else self.fuse_layers[i][0](out[0])
Second time:

    if i == j:
        y += out[j]
    else:
        y += self.fuse_layers[i][j](out[j])

when j = 0.

To fix it, j should start from 1: for j in range(1, self.num_branches)

@lingfengqiu
Copy link

right, i find the same problem as you.
here is the source code of hrnt about the fuse layer.

    for i in range(len(self.fuse_layers)):
        y = x[0] if i == 0 else self.fuse_layers[i][0](x[0])
        for j in range(1, self.num_branches):
            if i == j:
                y = y + x[j]
            else:
                y = y + self.fuse_layers[i][j](x[j])
        x_fuse.append(self.relu(y))

        for i in range(len(self.fuse_layers)):
            y = out[0] if i == 0 else self.fuse_layers[i][0](out[0])
            for j in range(self.num_branches):
                if i == j:
                    y += out[j]
                else:
                    y += self.fuse_layers[i][j](out[j])
            out_fuse.append(self.relu(y))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants