mmclassification/tests/test_models/test_utils/test_position_encoding.py
Ezra-Yu 94eb3ff83e
[Feature] Add Twins backbone and convert checkpoints. (#642)
* add twins backbone

* add position_encoding

* refactor twins

* Supplemental unit tests

* update docstring and readme

* update docstring and readme

* update docstring and readme

* update docstring

* update docstring

* update docstring

* update docstring

* remove note

* update doc and docstring

* update docstring

* update docstring

* use abstract pdf link and rename yamlfile

* Update model link

Co-authored-by: mzr1996 <mzr1996@163.com>
2022-01-27 10:25:05 +08:00

11 lines
352 B
Python

# Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcls.models.utils import ConditionalPositionEncoding
def test_conditional_position_encoding_module():
CPE = ConditionalPositionEncoding(in_channels=32, embed_dims=32, stride=2)
outs = CPE(torch.randn(1, 3136, 32), (56, 56))
assert outs.shape == torch.Size([1, 784, 32])