Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
9bf718b7
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看板
提交
9bf718b7
编写于
11月 22, 2022
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(imperative): fix ConvBwdData layout issue
GitOrigin-RevId: e3657f8829adf2288e9822d7dfd7e281961bb081
上级
e2ea207a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
8 deletion
+25
-8
imperative/python/test/unit/functional/test_functional.py
imperative/python/test/unit/functional/test_functional.py
+12
-0
imperative/src/impl/ops/convolution.cpp
imperative/src/impl/ops/convolution.cpp
+13
-8
未找到文件。
imperative/python/test/unit/functional/test_functional.py
浏览文件 @
9bf718b7
...
@@ -7,12 +7,14 @@ import numpy as np
...
@@ -7,12 +7,14 @@ import numpy as np
import
pytest
import
pytest
from
utils
import
opr_test
from
utils
import
opr_test
import
megengine
as
mge
import
megengine.amp
as
amp
import
megengine.amp
as
amp
import
megengine.config
as
config
import
megengine.config
as
config
import
megengine.core.ops.builtin
as
builtin
import
megengine.core.ops.builtin
as
builtin
import
megengine.core.tensor.dtype
as
dtype
import
megengine.core.tensor.dtype
as
dtype
import
megengine.functional
as
F
import
megengine.functional
as
F
import
megengine.jit
as
jit
import
megengine.jit
as
jit
import
megengine.module
as
M
from
megengine
import
Parameter
,
Tensor
,
is_cuda_available
,
tensor
from
megengine
import
Parameter
,
Tensor
,
is_cuda_available
,
tensor
from
megengine.autodiff
import
GradManager
from
megengine.autodiff
import
GradManager
from
megengine.core._trace_option
import
use_symbolic_shape
from
megengine.core._trace_option
import
use_symbolic_shape
...
@@ -1637,6 +1639,16 @@ def test_conv_transpose2d():
...
@@ -1637,6 +1639,16 @@ def test_conv_transpose2d():
output_shape
.
numpy
(),
np
.
array
([
20
,
33
,
94
,
300
],
dtype
=
np
.
int32
)
output_shape
.
numpy
(),
np
.
array
([
20
,
33
,
94
,
300
],
dtype
=
np
.
int32
)
)
)
@
mge
.
jit
.
trace
()
def
func
():
deconv
=
M
.
ConvTranspose2d
(
16
,
33
,
(
3
,
5
),
(
2
,
3
),
(
3
,
4
))
x
=
Tensor
(
np
.
random
.
rand
(
20
,
16
,
50
,
100
))
for
i
in
range
(
20
):
y
=
deconv
(
x
.
_broadcast
(
F
.
concat
([
x
.
shape
,
x
.
shape
])[:
4
]))
mge
.
_sync
()
func
()
def
test_conv_transpose3d
():
def
test_conv_transpose3d
():
m
=
ConvTranspose3d
(
m
=
ConvTranspose3d
(
...
...
imperative/src/impl/ops/convolution.cpp
浏览文件 @
9bf718b7
...
@@ -174,13 +174,15 @@ std::tuple<SmallVector<LogicalTensorDesc>, bool> infer_output_attrs_fallible(
...
@@ -174,13 +174,15 @@ std::tuple<SmallVector<LogicalTensorDesc>, bool> infer_output_attrs_fallible(
if
(
filter
.
ndim
&&
diff
.
ndim
)
{
if
(
filter
.
ndim
&&
diff
.
ndim
)
{
// deduce_layout won't override existing dtype
// deduce_layout won't override existing dtype
dnn_opr
.
opr
().
deduce_layout
(
filter
,
diff
,
output_layout
);
dnn_opr
.
opr
().
deduce_layout
(
filter
,
diff
,
output_layout
);
if
(
inputs
.
size
()
==
3
)
{
}
else
{
if
(
!
inputs
[
2
].
value
.
empty
())
{
dnn_opr
.
opr
().
deduce_dtype
(
filter
.
dtype
,
diff
.
dtype
,
output_layout
.
dtype
);
cg
::
copy_tensor_value_to_shape
(
output_layout
,
inputs
[
2
].
value
);
}
output_layout
.
init_contiguous_stride
();
if
(
inputs
.
size
()
==
3
)
{
}
else
{
if
(
!
inputs
[
2
].
value
.
empty
())
{
output_layout
.
ndim
=
0
;
cg
::
copy_tensor_value_to_shape
(
output_layout
,
inputs
[
2
].
value
);
}
output_layout
.
init_contiguous_stride
();
}
else
{
output_layout
.
ndim
=
0
;
}
}
}
}
return
{{{
output_layout
,
inputs
[
0
].
comp_node
}},
output_layout
.
ndim
!=
0
};
return
{{{
output_layout
,
inputs
[
0
].
comp_node
}},
output_layout
.
ndim
!=
0
};
...
@@ -202,8 +204,11 @@ SmallVector<TensorPtr> apply_on_physical_tensor(
...
@@ -202,8 +204,11 @@ SmallVector<TensorPtr> apply_on_physical_tensor(
if
(
inputs
.
size
()
==
3
)
{
if
(
inputs
.
size
()
==
3
)
{
cg
::
copy_tensor_value_to_shape
(
cg
::
copy_tensor_value_to_shape
(
out_layout
,
inputs
[
2
]
->
get_value
().
proxy_to_default_cpu
());
out_layout
,
inputs
[
2
]
->
get_value
().
proxy_to_default_cpu
());
out_layout
.
init_contiguous_stride
();
}
else
{
dnn_opr
.
op
()
->
deduce_layout
(
inputs
[
0
]
->
layout
(),
inputs
[
1
]
->
layout
(),
out_layout
);
}
}
out_layout
.
init_contiguous_stride
();
return
out_layout
;
return
out_layout
;
}
}
}();
}();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录