Skip to content

Commit d716c42

Browse files
authored
revamp log api usage method (#5072)
* revamp log api usage method
1 parent e0c5cc4 commit d716c42

35 files changed

+47
-53
lines changed

torchvision/datasets/vision.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(
3535
transform: Optional[Callable] = None,
3636
target_transform: Optional[Callable] = None,
3737
) -> None:
38-
_log_api_usage_once(self)
38+
_log_api_usage_once("datasets", self.__class__.__name__)
3939
if isinstance(root, torch._six.string_classes):
4040
root = os.path.expanduser(root)
4141
self.root = root

torchvision/models/alexnet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class AlexNet(nn.Module):
1919
def __init__(self, num_classes: int = 1000, dropout: float = 0.5) -> None:
2020
super().__init__()
21-
_log_api_usage_once(self)
21+
_log_api_usage_once("models", self.__class__.__name__)
2222
self.features = nn.Sequential(
2323
nn.Conv2d(3, 64, kernel_size=11, stride=4, padding=2),
2424
nn.ReLU(inplace=True),

torchvision/models/densenet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def __init__(
163163
) -> None:
164164

165165
super().__init__()
166-
_log_api_usage_once(self)
166+
_log_api_usage_once("models", self.__class__.__name__)
167167

168168
# First convolution
169169
self.features = nn.Sequential(

torchvision/models/detection/generalized_rcnn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class GeneralizedRCNN(nn.Module):
2727

2828
def __init__(self, backbone: nn.Module, rpn: nn.Module, roi_heads: nn.Module, transform: nn.Module) -> None:
2929
super().__init__()
30-
_log_api_usage_once(self)
30+
_log_api_usage_once("models", self.__class__.__name__)
3131
self.transform = transform
3232
self.backbone = backbone
3333
self.rpn = rpn

torchvision/models/detection/retinanet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def __init__(
337337
topk_candidates=1000,
338338
):
339339
super().__init__()
340-
_log_api_usage_once(self)
340+
_log_api_usage_once("models", self.__class__.__name__)
341341

342342
if not hasattr(backbone, "out_channels"):
343343
raise ValueError(

torchvision/models/detection/ssd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def __init__(
182182
positive_fraction: float = 0.25,
183183
):
184184
super().__init__()
185-
_log_api_usage_once(self)
185+
_log_api_usage_once("models", self.__class__.__name__)
186186

187187
self.backbone = backbone
188188

torchvision/models/detection/ssdlite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def __init__(
120120
min_depth: int = 16,
121121
):
122122
super().__init__()
123-
_log_api_usage_once(self)
123+
_log_api_usage_once("models", self.__class__.__name__)
124124

125125
assert not backbone[c4_pos].use_res_connect
126126
self.features = nn.Sequential(

torchvision/models/efficientnet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def __init__(
170170
norm_layer (Optional[Callable[..., nn.Module]]): Module specifying the normalization layer to use
171171
"""
172172
super().__init__()
173-
_log_api_usage_once(self)
173+
_log_api_usage_once("models", self.__class__.__name__)
174174

175175
if not inverted_residual_setting:
176176
raise ValueError("The inverted_residual_setting should not be empty")

torchvision/models/googlenet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(
3939
dropout_aux: float = 0.7,
4040
) -> None:
4141
super().__init__()
42-
_log_api_usage_once(self)
42+
_log_api_usage_once("models", self.__class__.__name__)
4343
if blocks is None:
4444
blocks = [BasicConv2d, Inception, InceptionAux]
4545
if init_weights is None:

torchvision/models/inception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(
3737
dropout: float = 0.5,
3838
) -> None:
3939
super().__init__()
40-
_log_api_usage_once(self)
40+
_log_api_usage_once("models", self.__class__.__name__)
4141
if inception_blocks is None:
4242
inception_blocks = [BasicConv2d, InceptionA, InceptionB, InceptionC, InceptionD, InceptionE, InceptionAux]
4343
if init_weights is None:

0 commit comments

Comments
 (0)