Shortcuts

mmagic.models.editors.swinir.swinir_utils

Module Contents

Functions

_ntuple(n)

A to_tuple function generator. It returns a function, this function

drop_path(x[, drop_prob, training, scale_by_keep])

Drop paths (Stochastic Depth) per sample (when applied in main path of

window_partition(x, window_size)

param x

(B, H, W, C)

window_reverse(windows, window_size, H, W)

param windows

(num_windows*B, window_size, window_size, C)

Attributes

to_2tuple

mmagic.models.editors.swinir.swinir_utils._ntuple(n)[source]

A to_tuple function generator. It returns a function, this function will repeat the input to a tuple of length n if the input is not an Iterable object, otherwise, return the input directly.

Parameters

n (int) – The number of the target length.

mmagic.models.editors.swinir.swinir_utils.to_2tuple[source]
mmagic.models.editors.swinir.swinir_utils.drop_path(x, drop_prob: float = 0.0, training: bool = False, scale_by_keep: bool = True)[source]

Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).

This is the same as the DropConnect impl I created for EfficientNet, etc networks, however, the original name is misleading as ‘Drop Connect’ is a different form of dropout in a separate paper… See discussion: https://github.com/tensorflow/tpu/issues/494#issuecomment-532968956 I’ve opted for changing the layer and argument names to ‘drop path’ rather than mix DropConnect as a layer name and use ‘survival rate’ as the argument.

mmagic.models.editors.swinir.swinir_utils.window_partition(x, window_size)[source]
Parameters
  • x – (B, H, W, C)

  • window_size (int) – window size

Returns

(num_windows*B, window_size, window_size, C)

Return type

windows

mmagic.models.editors.swinir.swinir_utils.window_reverse(windows, window_size, H, W)[source]
Parameters
  • windows – (num_windows*B, window_size, window_size, C)

  • window_size (int) – Window size

  • H (int) – Height of image

  • W (int) – Width of image

Returns

(B, H, W, C)

Return type

x

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.