Shortcuts

mmedit.models.base_archs.patch_disc

Module Contents

Classes

PatchDiscriminator

A PatchGAN discriminator.

class mmedit.models.base_archs.patch_disc.PatchDiscriminator(in_channels: int, base_channels: int = 64, num_conv: int = 3, norm_cfg: dict = dict(type='BN'), init_cfg: Optional[dict] = dict(type='normal', gain=0.02))[source]

Bases: torch.nn.Module

A PatchGAN discriminator.

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

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

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

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

  • 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: 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(pretrained: Optional[str] = None) None[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.

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.