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

docs(mge/functional): add docs for megengine.functional.sub

GitOrigin-RevId: 40208739bdb6a220ec644a69bc6adb1f65ffe8fd
上级 32ad9265
......@@ -104,7 +104,29 @@ def add(x, y):
def sub(x, y):
r"""Element-wise `subtraction`."""
r"""Element-wise `sub`.
Examples:
.. testcode::
import numpy as np
from megengine import tensor
import megengine.functional as F
x = tensor(np.arange(1, 7, dtype=np.float32).reshape(2, 3))
y = tensor(np.arange(0, 6, dtype=np.float32).reshape(2, 3))
out = F.sub(x, y)
print(out.numpy())
Outputs:
.. testoutput::
[[1. 1. 1.]
[1. 1. 1.]]
"""
return _elwise(x, y, mode=Elemwise.Mode.SUB)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册