Skip to content

Commit f64bfed

Browse files
committed
Rename is_strided with _is_cn.
1 parent 482d3bd commit f64bfed

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

torchvision/models/detection/backbone_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def mobilenet_backbone(
138138

139139
# Gather the indeces of blocks which are strided. These are the locations of C1, ..., Cn-1 blocks.
140140
# The first and last blocks are always included because they are the C0 (conv1) and Cn.
141-
stage_indices = [0] + [i for i, b in enumerate(backbone) if getattr(b, "is_strided", False)] + [len(backbone) - 1]
141+
stage_indices = [0] + [i for i, b in enumerate(backbone) if getattr(b, "_is_cn", False)] + [len(backbone) - 1]
142142
num_stages = len(stage_indices)
143143

144144
# find the index of the layer from which we wont freeze

torchvision/models/mobilenetv2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def __init__(
8888
])
8989
self.conv = nn.Sequential(*layers)
9090
self.out_channels = oup
91-
self.is_strided = stride > 1
91+
self._is_cn = stride > 1
9292

9393
def forward(self, x: Tensor) -> Tensor:
9494
if self.use_res_connect:

torchvision/models/mobilenetv3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def __init__(self, cnf: InvertedResidualConfig, norm_layer: Callable[..., nn.Mod
8282

8383
self.block = nn.Sequential(*layers)
8484
self.out_channels = cnf.out_channels
85-
self.is_strided = cnf.stride > 1
85+
self._is_cn = cnf.stride > 1
8686

8787
def forward(self, input: Tensor) -> Tensor:
8888
result = self.block(input)

torchvision/models/segmentation/segmentation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ def _segm_model(name, backbone_name, num_classes, aux, pretrained_backbone=True)
3434

3535
# Gather the indeces of blocks which are strided. These are the locations of C1, ..., Cn-1 blocks.
3636
# The first and last blocks are always included because they are the C0 (conv1) and Cn.
37-
stage_indices = [0] + [i for i, b in enumerate(backbone) if getattr(b, "is_strided", False)] + [
38-
len(backbone) - 1]
37+
stage_indices = [0] + [i for i, b in enumerate(backbone) if getattr(b, "_is_cn", False)] + [len(backbone) - 1]
3938
out_pos = stage_indices[-1]
4039
out_layer = str(out_pos)
4140
out_inplanes = backbone[out_pos].out_channels

0 commit comments

Comments
 (0)