# The below is the same as max(widen_factor / (split_factor ** 0.5) + 0.4, 1.0) if arch == 'wide_resnet50_2'and split_factor == 2: self.inplanes = 64 width_per_group = 64 print('INFO:PyTorch: Dividing wide_resnet50_2, change base_width from {} ' 'to {}.'.format(64 * 2, 64)) if arch == 'wide_resnet50_3'and split_factor == 2: self.inplanes = 64 width_per_group = 64 * 2 print('INFO:PyTorch: Dividing wide_resnet50_3, change base_width from {} ' 'to {}.'.format(64 * 3, 64 * 2))
2)切分ResNeXt
对于ResNeXt网络,当固定时,即,其中为常数,则式上一个等式需要变化为:
这意味着只需要通过channel数量除以便可以得到d组小的Block。
self.dropout = None if'cifar'in dataset: if arch in ['resnext29_16x64d', 'resnext29_8x64d', 'wide_resnet16_8', 'wide_resnet40_10']: if dropout_p isnotNone: dropout_p = dropout_p / split_factor # You can also use the below code. # dropout_p = dropout_p / (split_factor ** 0.5) print('INFO:PyTorch: Using dropout with ratio {}'.format(dropout_p)) self.dropout = nn.Dropout(dropout_p)
elif'imagenet'in dataset: if dropout_p isnotNone: dropout_p = dropout_p / split_factor # You can also use the below code. # dropout_p = dropout_p / (split_factor ** 0.5) print('INFO:PyTorch: Using dropout with ratio {}'.format(dropout_p)) self.dropout = nn.Dropout(dropout_p)
def_co_training_loss(self, outputs, loss_choose, epoch=0): """calculate the co-training loss between outputs of different small networks """ weight_now = self.cot_weight if self.is_cot_weight_warm_up and epoch < self.cot_weight_warm_up_epochs: weight_now = max(self.cot_weight * epoch / self.cot_weight_warm_up_epochs, 0.005)
Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。