bitorch.models.resnet.Resnet

class bitorch.models.resnet.Resnet(resnet_version: int, resnet_num_layers: int, input_shape: List[int], num_classes: int = 0)[source]

Methods

__init__

Initializes internal Module state, shared by both nn.Module and ScriptModule.

add_argparse_arguments

allows additions to the argument parser if required, e.g.

create_resnet

Creates a resnet complying to given version and layer number.

Attributes

name

resnet_block_versions

resnet_net_versions

resnet_spec

__init__(resnet_version: int, resnet_num_layers: int, input_shape: List[int], num_classes: int = 0) None[source]

Initializes internal Module state, shared by both nn.Module and ScriptModule.

static add_argparse_arguments(parser: ArgumentParser) None[source]

allows additions to the argument parser if required, e.g. to add layer count, etc.

! please note that the inferred variable names of additional cli arguments are passed as keyword arguments to the constructor of this class !

Parameters:

parser (ArgumentParser) – the argument parser

create_resnet(version: int, num_layers: int) Module[source]

Creates a resnet complying to given version and layer number.

Parameters:
  • version (int) – version of resnet to be used. availavle versions are 1 or 2

  • num_layers (int) – number of layers to be build.

Raises:
  • ValueError – raised if no resnet specification for given num_layers is listed in the resnet_spec dict above

  • ValueError – raised if invalid resnet version was passed

Returns:

resnet model

Return type:

Module