提交 3f11b421 编写于 作者: M Megvii Engine Team

docs(functional): replace megengine function testcode with doctest format

GitOrigin-RevId: f91d5f5afdd653c48179ec420b87d9d05101406b
上级 60163c5d
...@@ -1850,8 +1850,6 @@ def local_response_norm( ...@@ -1850,8 +1850,6 @@ def local_response_norm(
... [19.420258, 20.331186, 21.233786, 22.127764, 23.012836 ]]]]) ... [19.420258, 20.331186, 21.233786, 22.127764, 23.012836 ]]]])
>>> out = F.local_response_norm(inp, kernel_size=3, k=1.0, alpha=1e-4, beta=0.75) >>> out = F.local_response_norm(inp, kernel_size=3, k=1.0, alpha=1e-4, beta=0.75)
>>> np.testing.assert_allclose(GT, out.numpy(), rtol=1e-6, atol=1e-6) >>> np.testing.assert_allclose(GT, out.numpy(), rtol=1e-6, atol=1e-6)
>>> print('pass')
pass
""" """
op = builtin.LRN(n=kernel_size, k=k, alpha=alpha, beta=beta,) op = builtin.LRN(n=kernel_size, k=k, alpha=alpha, beta=beta,)
(output,) = apply(op, inp) (output,) = apply(op, inp)
......
...@@ -33,8 +33,6 @@ class LocalResponseNorm(Module): ...@@ -33,8 +33,6 @@ class LocalResponseNorm(Module):
>>> op = M.LocalResponseNorm(kernel_size=3, k=1.0, alpha=1e-4, beta=0.75) >>> op = M.LocalResponseNorm(kernel_size=3, k=1.0, alpha=1e-4, beta=0.75)
>>> out = op(inp) >>> out = op(inp)
>>> np.testing.assert_allclose(GT, out.numpy(), rtol=1e-6, atol=1e-6) >>> np.testing.assert_allclose(GT, out.numpy(), rtol=1e-6, atol=1e-6)
>>> print('pass')
pass
""" """
def __init__( def __init__(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册