Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
78d21894
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
403
Star
4705
Fork
582
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
78d21894
编写于
10月 09, 2020
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(mge): rename comparison operators to their full name
GitOrigin-RevId: e503b038a1c1d57d5202d35f7d16f8f09f504a22
上级
e034874a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
17 deletion
+17
-17
imperative/python/megengine/functional/elemwise.py
imperative/python/megengine/functional/elemwise.py
+14
-14
imperative/python/megengine/functional/loss.py
imperative/python/megengine/functional/loss.py
+1
-1
imperative/python/megengine/module/elemwise.py
imperative/python/megengine/module/elemwise.py
+2
-2
未找到文件。
imperative/python/megengine/functional/elemwise.py
浏览文件 @
78d21894
...
...
@@ -30,19 +30,19 @@ __all__ = [
"cos"
,
"cosh"
,
"div"
,
"eq"
,
"eq
ual
"
,
"exp"
,
"expm1"
,
"fast_tanh"
,
"floor"
,
"floor_div"
,
"g
t
"
,
"g
e
"
,
"g
reater
"
,
"g
reater_equal
"
,
"hswish"
,
"hsigmoid"
,
"left_shift"
,
"l
t
"
,
"le"
,
"l
ess
"
,
"le
ss_equal
"
,
"log"
,
"log1p"
,
"logical_and"
,
...
...
@@ -54,7 +54,7 @@ __all__ = [
"mod"
,
"mul"
,
"neg"
,
"n
e
"
,
"n
ot_equal
"
,
"pow"
,
"relu"
,
"relu6"
,
...
...
@@ -102,7 +102,7 @@ def add(x, y):
"""Element-wise `addition`.
At least one operand should be tensor.
Same for sub/mul/div/floor_div/pow/mod/atan2/eq
/ne/lt/le/gt/ge
/maximum/minmium.
Same for sub/mul/div/floor_div/pow/mod/atan2/eq
ual/not_equal/less/less_equal/greater/greater_equal
/maximum/minmium.
:param x: input tensor.
:return: computed tensor.
...
...
@@ -442,7 +442,7 @@ def logical_xor(x, y):
# comparison functions
def
eq
(
x
,
y
):
def
eq
ual
(
x
,
y
):
"""Element-wise `(x == y)`.
:param x: input tensor 1.
...
...
@@ -459,7 +459,7 @@ def eq(x, y):
x = tensor(np.arange(0, 6, dtype=np.float32).reshape(2, 3))
y = tensor(np.arange(0, 6, dtype=np.float32).reshape(2, 3))
out = F.eq(x, y)
out = F.eq
ual
(x, y)
print(out.numpy())
Outputs:
...
...
@@ -473,27 +473,27 @@ def eq(x, y):
return
_elwise
(
x
,
y
,
mode
=
"eq"
)
def
n
e
(
x
,
y
):
def
n
ot_equal
(
x
,
y
):
"""Element-wise `(x != y)`."""
return
x
!=
y
def
l
t
(
x
,
y
):
def
l
ess
(
x
,
y
):
"""Element-wise `(x < y)`."""
return
_elwise
(
x
,
y
,
mode
=
"lt"
)
def
le
(
x
,
y
):
def
le
ss_equal
(
x
,
y
):
"""Element-wise `(x <= y)`."""
return
_elwise
(
x
,
y
,
mode
=
"leq"
)
def
g
t
(
x
,
y
):
def
g
reater
(
x
,
y
):
"""Element-wise `(x > y)`."""
return
_elwise
(
y
,
x
,
mode
=
"lt"
)
def
g
e
(
x
,
y
):
def
g
reater_equal
(
x
,
y
):
"""Element-wise `(x >= y)`."""
return
_elwise
(
y
,
x
,
mode
=
"leq"
)
...
...
imperative/python/megengine/functional/loss.py
浏览文件 @
78d21894
...
...
@@ -10,7 +10,7 @@ import numpy as np
from
..core.tensor.utils
import
make_shape_tuple
from
..tensor
import
Tensor
from
.elemwise
import
abs
,
eq
,
exp
,
log
,
maximum
,
pow
,
relu
from
.elemwise
import
abs
,
eq
ual
,
exp
,
log
,
maximum
,
pow
,
relu
from
.nn
import
indexing_one_hot
from
.tensor
import
where
...
...
imperative/python/megengine/module/elemwise.py
浏览文件 @
78d21894
...
...
@@ -56,9 +56,9 @@ class Elemwise(Module):
* "SIGMOID_GRAD": sigmoid_grad
* "SWITCH_GT0": switch_gt0
* "TANH_GRAD": tanh_grad
* "LT": l
t
* "LT": l
ess
* "LEQ": leq
* "EQ": eq
* "EQ": eq
ual
* "POW": pow
* "LOG_SUM_EXP": log_sum_exp
* "FAST_TANH_GRAD": fast_tanh_grad
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录