MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / hswish

Function hswish

imperative/python/megengine/functional/nn.py:838–848  ·  view source on GitHub ↗

r"""Element-wise `x * relu6(x + 3) / 6`. Example: >>> import numpy as np >>> x = Tensor(np.arange(5).astype(np.float32)) >>> out = F.hswish(x) >>> out.numpy().round(decimals=4) array([0. , 0.6667, 1.6667, 3. , 4. ], dtype=float32)

(x)

Source from the content-addressed store, hash-verified

836
837
838def hswish(x):
839 r"""Element-wise `x * relu6(x + 3) / 6`.
840
841 Example:
842 >>> import numpy as np
843 >>> x = Tensor(np.arange(5).astype(np.float32))
844 >>> out = F.hswish(x)
845 >>> out.numpy().round(decimals=4)
846 array([0. , 0.6667, 1.6667, 3. , 4. ], dtype=float32)
847 """
848 return _elwise(x, mode=Elemwise.Mode.H_SWISH)
849
850
851def sigmoid(x):

Callers 1

TEST_PASSFunction · 0.50

Calls 1

_elwiseFunction · 0.50

Tested by 1

TEST_PASSFunction · 0.40