torchpack.models.vision package

Submodules

torchpack.models.vision.mobilenetv1 module

class torchpack.models.vision.mobilenetv1.MobileNetV1(*, in_channels: int = 3, num_classes: int = 1000, width_multiplier: float = 1)[source]

Bases: torch.nn.modules.module.Module

forward(x: torch.Tensor) → torch.Tensor[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

layers = [(32, 1, 2), (64, 1, 1), (128, 2, 2), (256, 2, 2), (512, 6, 2), (1024, 2, 2)]
reset_parameters() → None[source]
class torchpack.models.vision.mobilenetv1.MobileBlockV1(in_channels: int, out_channels: int, kernel_size: Union[int, Tuple[int, int]], *, stride: int = 1)[source]

Bases: torch.nn.modules.container.Sequential

torchpack.models.vision.mobilenetv2 module

class torchpack.models.vision.mobilenetv2.MobileNetV2(*, in_channels: int = 3, num_classes: int = 1000, width_multiplier: float = 1)[source]

Bases: torch.nn.modules.module.Module

forward(x: torch.Tensor) → torch.Tensor[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

layers = [32, (1, 16, 1, 1), (6, 24, 2, 2), (6, 32, 3, 2), (6, 64, 4, 2), (6, 96, 3, 1), (6, 160, 3, 2), (6, 320, 1, 1), 1280]
reset_parameters() → None[source]
class torchpack.models.vision.mobilenetv2.MobileBlockV2(in_channels: int, out_channels: int, kernel_size: Union[int, Tuple[int, int]], *, stride: int = 1, expansion: int = 1)[source]

Bases: torch.nn.modules.module.Module

forward(x: torch.Tensor) → torch.Tensor[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

torchpack.models.vision.shufflenetv2 module

class torchpack.models.vision.shufflenetv2.ShuffleNetV2(*, in_channels: int = 3, num_classes: int = 1000, width_multiplier: float = 1)[source]

Bases: torch.nn.modules.module.Module

forward(x: torch.Tensor) → torch.Tensor[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

layers = {0.5: [24, (48, 4, 2), (96, 8, 2), (192, 4, 2), 1024], 1.0: [24, (116, 4, 2), (232, 8, 2), (464, 4, 2), 1024], 1.5: [24, (176, 4, 2), (352, 8, 2), (704, 4, 2), 1024], 2.0: [24, (244, 4, 2), (488, 8, 2), (976, 4, 2), 2048]}
reset_parameters() → None[source]
class torchpack.models.vision.shufflenetv2.ShuffleBlockV2(in_channels: int, out_channels: int, kernel_size: Union[int, Tuple[int, int]], *, stride: int = 1)[source]

Bases: torch.nn.modules.module.Module

forward(x: torch.Tensor) → torch.Tensor[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Module contents