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

docs(functional): replace utils testcode with doctest format

GitOrigin-RevId: 8618918ff361d0d65b6e3a58c0dcd954e447625e
上级 aa632305
......@@ -35,21 +35,11 @@ def _assert_equal(
Examples:
.. testcode::
>>> x = Tensor([1, 2, 3], dtype="float32")
>>> y = Tensor([1, 2, 3], dtype="float32")
>>> F.utils._assert_equal(x, y, maxerr=0)
Tensor([1. 2. 3.], device=xpux:0)
import numpy as np
from megengine import tensor
import megengine.functional as F
x = tensor([1, 2, 3], np.float32)
y = tensor([1, 2, 3], np.float32)
print(F.utils._assert_equal(x, y, maxerr=0).numpy())
Outputs:
.. testoutput::
[1. 2. 3.]
"""
err = (
abs(expect - actual)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册