Shortcuts

mmselfsup.models.necks.avgpool2d_neck 源代码

# Copyright (c) OpenMMLab. All rights reserved.
from typing import List

import torch
import torch.nn as nn
from mmengine.model import BaseModule

from mmselfsup.registry import MODELS


[文档]@MODELS.register_module() class AvgPool2dNeck(BaseModule): """The average pooling 2d neck.""" def __init__(self, output_size: int = 1) -> None: super().__init__() self.avgpool = nn.AdaptiveAvgPool2d(output_size)
[文档] def forward(self, x: List[torch.Tensor]) -> List[torch.Tensor]: """Forward function.""" assert len(x) == 1 return [self.avgpool(x[0])]
Read the Docs v: latest
Versions
latest
stable
1.x
0.x
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.