Shortcuts

mmedit.models.editors.cyclegan.cyclegan_generator

Module Contents

Classes

ResnetGenerator

Construct a Resnet-based generator that consists of residual blocks

class mmedit.models.editors.cyclegan.cyclegan_generator.ResnetGenerator(in_channels, out_channels, base_channels=64, norm_cfg=dict(type='IN'), use_dropout=False, num_blocks=9, padding_mode='reflect', init_cfg=dict(type='normal', gain=0.02))[source]

Bases: torch.nn.Module

Construct a Resnet-based generator that consists of residual blocks between a few downsampling/upsampling operations.

Parameters
  • in_channels (int) – Number of channels in input images.

  • out_channels (int) – Number of channels in output images.

  • base_channels (int) – Number of filters at the last conv layer. Default: 64.

  • norm_cfg (dict) – Config dict to build norm layer. Default: dict(type=’IN’).

  • use_dropout (bool) – Whether to use dropout layers. Default: False.

  • num_blocks (int) – Number of residual blocks. Default: 9.

  • padding_mode (str) – The name of padding layer in conv layers: ‘reflect’ | ‘replicate’ | ‘zeros’. Default: ‘reflect’.

  • init_cfg (dict) – Config dict for initialization. type: The name of our initialization method. Default: ‘normal’. gain: Scaling factor for normal, xavier and orthogonal. Default: 0.02.

forward(x)[source]

Forward function.

Parameters

x (Tensor) – Input tensor with shape (n, c, h, w).

Returns

Forward results.

Return type

Tensor

init_weights(pretrained=None, strict=True)[source]

Initialize weights for the model.

Parameters
  • pretrained (str, optional) – Path for pretrained weights. If given None, pretrained weights will not be loaded. Default: None.

  • strict (bool, optional) – Whether to allow different params for the model and checkpoint. Default: True.

Read the Docs v: latest
Versions
master
latest
stable
zyh-re-docs
zyh-doc-notfound-extend
zyh-api-rendering
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.