from torch import nnimport torchdef _make_divisible(ch, divisor=8, min_ch=None): """ 将输入的通道数(ch)调解到divisor的整数倍,方便硬件加速 This function is taken from the original tf repo. It ensures that all layers have a channel number that is divisible by 8 It can be seen here: https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet/mobilenet.py """ if min_ch is None: min_ch = divisor new_ch = max(min_ch, int(ch + divisor / 2) // divisor * divisor) # Make sure that round down does not go down by more than 10%. if new_ch < 0.9 * ch: new_ch += divisor return new_ch# 定义普通卷积、BN结构