class ResNet ( block, depth, num_classes=1000, with_pool=True ) [source]

ResNet model from “Deep Residual Learning for Image Recognition”

  • Block (BasicBlock|BottleneckBlock) – block module of model.

  • depth (int) – layers of resnet, default: 50.

  • num_classes (int) – output dim of last fc layer. If num_classes <=0, last fc layer will not be defined. Default: 1000.

  • with_pool (bool) – use pool before the last fc layer or not. Default: True.


from import ResNet
from import BottleneckBlock, BasicBlock

resnet50 = ResNet(BottleneckBlock, 50)

resnet18 = ResNet(BasicBlock, 18)
forward ( x )

Defines the computation performed at every call. Should be overridden by all subclasses.

  • *inputs (tuple) – unpacked tuple arguments

  • **kwargs (dict) – unpacked dict arguments