e8b43356aa8cb8c659cae25aea32a49fd0881cd9,gluon/gluoncv2/models/densenet_cifar.py,CIFARDenseNet,__init__,#CIFARDenseNet#Any#Any#Any#Any#Any#Any#Any#,38
Before Change
self.in_size = in_size
self.classes = classes
with self.name_scope():
self.features = nn.HybridSequential(prefix="")
self.features.add(conv3x3(
in_channels=in_channels,
out_channels=init_block_channels))
in_channels = init_block_channels
for i, channels_per_stage in enumerate(channels):
stage = nn.HybridSequential(prefix="stage{}_".format(i + 1))
with stage.name_scope():
if i != 0:
stage.add(TransitionBlock(
in_channels=in_channels,
out_channels=(in_channels // 2),
bn_use_global_stats=bn_use_global_stats))
in_channels = in_channels // 2
for j, out_channels in enumerate(channels_per_stage):
stage.add(DenseUnit(
in_channels=in_channels,
out_channels=out_channels,
bn_use_global_stats=bn_use_global_stats,
dropout_rate=dropout_rate))
in_channels = out_channels
self.features.add(stage)
self.features.add(PreResActivation(
in_channels=in_channels,
bn_use_global_stats=bn_use_global_stats))
self.features.add(nn.AvgPool2D(
pool_size=8,
strides=1))
self.output = nn.HybridSequential(prefix="")
self.output.add(nn.Flatten())
self.output.add(nn.Dense(
units=classes,
in_units=in_channels))
def hybrid_forward(self, F, x):
x = self.features(x)
x = self.output(x)
return x
After Change
in_size : tuple of two ints, default (32, 32)
Spatial size of the expected input image.
classes : int, default 10
Number of classification classes.
def __init__(self,
channels,
init_block_channels,
bottleneck,
bn_use_global_stats=False,
dropout_rate=0.0,
in_channels=3,
in_size=(32, 32),
classes=10,
**kwargs):
super(CIFARDenseNet, self).__init__(**kwargs)
self.in_size = in_size
self.classes = classes
unit_class = DenseUnit if bottleneck else DenseSimpleUnit
with self.name_scope():
self.features = nn.HybridSequential(prefix="")
self.features.add(conv3x3(
in_channels=in_channels,
out_channels=init_block_channels))
in_channels = init_block_channels
for i, channels_per_stage in enumerate(channels):
stage = nn.HybridSequential(prefix="stage{}_".format(i + 1))
with stage.name_scope():
if i != 0:
stage.add(TransitionBlock(
in_channels=in_channels,
out_channels=(in_channels // 2),
bn_use_global_stats=bn_use_global_stats))
in_channels = in_channels // 2
for j, out_channels in enumerate(channels_per_stage):
stage.add(unit_class(
in_channels=in_channels,
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 20
Instances
Project Name: osmr/imgclsmob
Commit Name: e8b43356aa8cb8c659cae25aea32a49fd0881cd9
Time: 2019-01-27
Author: osemery@gmail.com
File Name: gluon/gluoncv2/models/densenet_cifar.py
Class Name: CIFARDenseNet
Method Name: __init__
Project Name: osmr/imgclsmob
Commit Name: 340094b32576bf6dce50dbfdf82df14a5f6c043e
Time: 2019-06-10
Author: osemery@gmail.com
File Name: gluon/gluoncv2/models/efficientnet.py
Class Name: EfficientNet
Method Name: __init__
Project Name: osmr/imgclsmob
Commit Name: e8b43356aa8cb8c659cae25aea32a49fd0881cd9
Time: 2019-01-27
Author: osemery@gmail.com
File Name: gluon/gluoncv2/models/densenet_cifar.py
Class Name: CIFARDenseNet
Method Name: __init__
Project Name: osmr/imgclsmob
Commit Name: f68e69b3377dbb7e04cc5ab9d63109699843a435
Time: 2018-12-07
Author: osemery@gmail.com
File Name: pytorch/pytorchcv/models/channelnet.py
Class Name: ChannelNet
Method Name: __init__