def get_flop(self, kernel_size, stride, in_channel, out_channel, affine, in_h, in_w): cal_flop = flops.count_ConvBNReLU_flop(in_h, in_w, in_channel, self.hidden_dim, kernel_size=[1, 1], is_bias=False, is_affine=affine) cal_flop += flops.count_Conv_flop(in_h, in_w, self.hidden_dim, self.hidden_dim, kernel_size, False, stride, groups=self.hidden_dim, is_affine=affine) in_h, in_w = in_h // stride, in_w // stride # pw-linear without ReLU! cal_flop += flops.count_Conv_flop(in_h, in_w, self.hidden_dim, out_channel, kernel_size=[1, 1], is_bias=False) cal_flop += flops.count_BN_flop(in_h, in_w, out_channel, affine) return cal_flop
def get_flop(self, kernel_size, stride, in_channel, out_channel, affine, in_h, in_w): cal_flop = flops.count_Conv_flop(in_h, in_w, in_channel, in_channel, kernel_size, False, stride, groups=in_channel) in_h, in_w = in_h // stride, in_w // stride cal_flop += flops.count_ConvBNReLU_flop(in_h, in_w, in_channel, in_channel, kernel_size=[1, 1], is_bias=False, is_affine=affine) # stack 2 separate depthwise-conv. cal_flop += flops.count_Conv_flop(in_h, in_w, in_channel, in_channel, kernel_size, False, stride=1, groups=in_channel) cal_flop += flops.count_Conv_flop(in_h, in_w, in_channel, out_channel, kernel_size=[1, 1], is_bias=False) cal_flop += flops.count_BN_flop(in_h, in_w, out_channel, affine) return cal_flop
def get_flop(self, kernel_size, stride, in_channel, out_channel, affine, in_h, in_w): cal_flop = flops.count_Conv_flop(in_h, in_w, in_channel, out_channel, kernel_size, False, stride) in_h, in_w = in_h // stride, in_w // stride cal_flop += flops.count_BN_flop(in_h, in_w, out_channel, affine) return cal_flop
def get_flop(self, kernel_size, stride, in_channel, out_channel, affine, in_h, in_w): cal_flop = flops.count_Conv_flop(in_h, in_w, in_channel, out_channel, kernel_size=kernel_size, is_bias=False) cal_flop += flops.count_BN_flop(in_h, in_w, out_channel, affine) return cal_flop
def get_flop(self, kernel_size, stride, in_channel, out_channel, affine, in_h, in_w): cal_flop = flops.count_Conv_flop(in_h, in_w, in_channel, in_channel, kernel_size, False, stride, groups=in_channel) in_h, in_w = in_h // stride, in_w // stride cal_flop += flops.count_Conv_flop(in_h, in_w, in_channel, out_channel, kernel_size=[1, 1], is_bias=False) cal_flop += flops.count_BN_flop(in_h, in_w, out_channel, affine) return cal_flop