Shortcuts

ConditionalPositionEncoding

class mmcls.models.utils.ConditionalPositionEncoding(in_channels, embed_dims=768, stride=1, init_cfg=None)[source]

The Conditional Position Encoding (CPE) module.

The CPE is the implementation of ‘Conditional Positional Encodings for Vision Transformers <https://arxiv.org/abs/2102.10882>’_.

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

  • embed_dims (int) – The feature dimension. Default: 768.

  • stride (int) – Stride of conv layer. Default: 1.

forward(x, hw_shape)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Read the Docs v: latest
Versions
master
latest
1.x
dev-1.x
Downloads
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.