BinaryNet.pytorch icon indicating copy to clipboard operation
BinaryNet.pytorch copied to clipboard

resnet_binary.py Bottleneck Class Issue

Open EmrahErden opened this issue 4 years ago • 0 comments

First of all, please note that: I'm not really good at coding, especially with python. Hence I'm probably making some mistakes.

I have some issues with the Bottleneck class. Could you please check these out? According to the class initializer (in resnet_binary.py file):

    def __init__(self, inplanes, planes, stride=1, downsample=None):
        super(Bottleneck, self).__init__()
        self.conv1 = BinarizeConv2d(inplanes, planes, kernel_size=1, bias=False)
        self.bn1 = nn.BatchNorm2d(planes)
        self.conv2 = BinarizeConv2d(planes, planes, kernel_size=3, stride=stride,
                               padding=1, bias=False)
        self.bn2 = nn.BatchNorm2d(planes)
        self.conv3 = BinarizeConv2d(planes, planes * 4, kernel_size=1, bias=False)
        self.bn3 = nn.BatchNorm2d(planes * 4)
        self.tanh = nn.Hardtanh(inplace=True)
        self.downsample = downsample
        self.stride = stride

I can't see any defined variables, self.do_bntan (line 103) & self.tanh2 (line 105). Both of these were defined in BasicBlock class, but Bottleneck is not the super class of it. And I can't find any connection between these 2 classes. Hence can't figure out how these variables used, starting from line 103

Thank you for your help and attention

EmrahErden avatar Jan 15 '21 15:01 EmrahErden