Shortcuts

ConditionalPositionEncoding

class mmpretrain.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.