Shortcuts

mmagic.models.editors.cyclegan.cyclegan_generator

Module Contents

Classes

ResnetGenerator

Construct a Resnet-based generator that consists of residual blocks

class mmagic.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: mmengine.model.BaseModule

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()[source]

Initialize weights for the model.

Read the Docs v: latest
Versions
latest
stable
0.x
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.