pytorch-cifar
pytorch-cifar copied to clipboard
A bug in dla.py
This is something wrong in the Tree class.
class Tree(nn.Module): def init(self, block, in_channels, out_channels, level=1, stride=1): super(Tree, self).init() self.level = level if level == 1: self.root = Root(2*out_channels, out_channels) self.left_node = block(in_channels, out_channels, stride=stride) self.right_node = block(out_channels, out_channels, stride=1) else: self.root = Root((level+2)*out_channels, out_channels) for i in reversed(range(1, level)): subtree = Tree(block, in_channels, out_channels, level=i, stride=stride) self.setattr('level_%d' % i, subtree) self.prev_root = block(in_channels, out_channels, stride=stride) self.left_node = block(out_channels, out_channels, stride=1) self.right_node = block(out_channels, out_channels, stride=1)
If a Tree is with level 3, then the output channels of the former subtree will not match the latter's in channels. What's more, the stride of the latter subtree will also be 2.