Skip to content
Snippets Groups Projects
Commit 4d9a5f47 authored by Jon Crall's avatar Jon Crall Committed by Kai Chen
Browse files

Add two doctest examples for resnet and resnext (#1474)

* Add doctest example for resnet and resnext

* Explicit import in doctests

* Fix missing torch import in doctest
parent 6ce7cce1
No related branches found
No related tags found
No related merge requests found
...@@ -352,6 +352,20 @@ class ResNet(nn.Module): ...@@ -352,6 +352,20 @@ class ResNet(nn.Module):
memory while slowing down the training speed. memory while slowing down the training speed.
zero_init_residual (bool): whether to use zero init for last norm layer zero_init_residual (bool): whether to use zero init for last norm layer
in resblocks to let them behave as identity. in resblocks to let them behave as identity.
Example:
>>> from mmdet.models import ResNet
>>> import torch
>>> self = ResNet(depth=18)
>>> self.eval()
>>> inputs = torch.rand(1, 3, 32, 32)
>>> level_outputs = self.forward(inputs)
>>> for level_out in level_outputs:
... print(tuple(level_out.shape))
(1, 64, 8, 8)
(1, 128, 4, 4)
(1, 256, 2, 2)
(1, 512, 1, 1)
""" """
arch_settings = { arch_settings = {
......
...@@ -179,6 +179,20 @@ class ResNeXt(ResNet): ...@@ -179,6 +179,20 @@ class ResNeXt(ResNet):
memory while slowing down the training speed. memory while slowing down the training speed.
zero_init_residual (bool): whether to use zero init for last norm layer zero_init_residual (bool): whether to use zero init for last norm layer
in resblocks to let them behave as identity. in resblocks to let them behave as identity.
Example:
>>> from mmdet.models import ResNeXt
>>> import torch
>>> self = ResNeXt(depth=50)
>>> self.eval()
>>> inputs = torch.rand(1, 3, 32, 32)
>>> level_outputs = self.forward(inputs)
>>> for level_out in level_outputs:
... print(tuple(level_out.shape))
(1, 256, 8, 8)
(1, 512, 4, 4)
(1, 1024, 2, 2)
(1, 2048, 1, 1)
""" """
arch_settings = { arch_settings = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment