Logo
Explore Help
Register Sign In
mirrors/mmcv
1
0
Fork 0
You've already forked mmcv
mirror of https://github.com/open-mmlab/mmcv.git synced 2025-06-03 21:54:52 +08:00
Code Issues Projects Releases Wiki Activity
mmcv/tests/test_cnn/test_hswish.py

22 lines
542 B
Python
Raw Normal View History

Add copyright pre-commit-hook (#1742) * first commit * Add copyright pre-commit-hook
2022-02-24 09:24:25 +08:00
# Copyright (c) OpenMMLab. All rights reserved.
add ext ops, support parrots (#310) * add ext ops, support parrots * fix lint * fix lint * update op from mmdetection * support non-pytorch env * fix import bug * test not import mmcv.op * rename mmcv.op to mmcv.ops * fix compile warning * 1. fix syncbn warning in pytorch 1.5 2. support only cpu compile 3. add point_sample from mmdet * fix text bug * update docstrings * fix line endings * minor updates * remove non_local from ops * bug fix for nonlocal2d * rename ops_ext to _ext and _ext to _flow_warp_ext * update the doc * try clang-format github action * fix github action * add ops to api.rst * fix cpp format * fix clang format issues * remove .clang-format Co-authored-by: Kai Chen <chenkaidev@gmail.com>
2020-06-28 23:15:47 +08:00
import torch
from torch.nn.functional import relu6
from mmcv.cnn.bricks import HSwish
def test_hswish():
# test inplace
act = HSwish(inplace=True)
assert act.act.inplace
act = HSwish()
assert not act.act.inplace
input = torch.randn(1, 3, 64, 64)
expected_output = input * relu6(input + 3) / 6
output = act(input)
# test output shape
assert output.shape == expected_output.shape
# test output value
assert torch.equal(output, expected_output)
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 1342ms Template: 20ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API