Shortcuts

mmagic.models.archs.smpatch_disc

Module Contents

Classes

SoftMaskPatchDiscriminator

A Soft Mask-Guided PatchGAN discriminator.

class mmagic.models.archs.smpatch_disc.SoftMaskPatchDiscriminator(in_channels: int, base_channels: Optional[int] = 64, num_conv: Optional[int] = 3, norm_cfg: Optional[dict] = None, init_cfg: Optional[dict] = dict(type='normal', gain=0.02), with_spectral_norm: Optional[bool] = False)[source]

Bases: mmengine.model.BaseModule

A Soft Mask-Guided PatchGAN discriminator.

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

  • base_channels (int, optional) – Number of channels at the first conv layer. Default: 64.

  • num_conv (int, optional) – Number of stacked intermediate convs (excluding input and output conv). Default: 3.

  • norm_cfg (dict, optional) – Config dict to build norm layer. Default: None.

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

  • with_spectral_norm (bool, optional) – Whether use spectral norm after the conv layers. Default: False.

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

Forward function.

Parameters

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

Returns

Forward results.

Return type

Tensor

init_weights() None[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.