Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
ca1d74ad
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
404
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看板
提交
ca1d74ad
编写于
1月 19, 2021
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mge/utils): fix types import error
GitOrigin-RevId: d2d4bd272563bf710000d2f6892b7cbd1985009d
上级
87ff58f7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
3 addition
and
44 deletion
+3
-44
imperative/python/megengine/functional/nn.py
imperative/python/megengine/functional/nn.py
+1
-1
imperative/python/megengine/functional/quantized.py
imperative/python/megengine/functional/quantized.py
+1
-1
imperative/python/megengine/functional/types.py
imperative/python/megengine/functional/types.py
+0
-41
imperative/python/megengine/module/conv.py
imperative/python/megengine/module/conv.py
+1
-1
imperative/python/megengine/utils/tuple_function.py
imperative/python/megengine/utils/tuple_function.py
+0
-0
未找到文件。
imperative/python/megengine/functional/nn.py
浏览文件 @
ca1d74ad
...
...
@@ -21,6 +21,7 @@ from ..distributed import WORLD, is_distributed
from
..jit.tracing
import
is_tracing
from
..random
import
uniform
from
..tensor
import
Tensor
from
..utils.tuple_function
import
_pair
,
_pair_nonzero
from
.debug_param
import
get_conv_execution_strategy
from
.distributed
import
all_reduce_sum
from
.elemwise
import
exp
,
floor
,
log
,
log1p
,
maximum
,
minimum
,
relu
...
...
@@ -35,7 +36,6 @@ from .tensor import (
squeeze
,
zeros
,
)
from
.types
import
_pair
,
_pair_nonzero
__all__
=
[
"adaptive_avg_pool2d"
,
...
...
imperative/python/megengine/functional/quantized.py
浏览文件 @
ca1d74ad
...
...
@@ -11,8 +11,8 @@ from typing import Tuple, Union
from
..core._imperative_rt.core2
import
apply
from
..core.ops
import
builtin
from
..tensor
import
Tensor
from
..utils.tuple_function
import
_pair
,
_pair_nonzero
from
.debug_param
import
get_conv_execution_strategy
from
.types
import
_pair
,
_pair_nonzero
def
conv_bias_activation
(
...
...
imperative/python/megengine/functional/types.py
已删除
100644 → 0
浏览文件 @
87ff58f7
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import
collections
import
functools
def
get_ndtuple
(
value
,
*
,
n
,
allow_zero
:
bool
=
True
):
r
"""
Converts possibly 1D tuple to n-dim tuple.
:param value: value will be filled in generated tuple.
:param n: how many elements will the tuple have.
:param allow_zero: whether to allow zero tuple value.
:return: a tuple.
"""
if
not
isinstance
(
value
,
collections
.
Iterable
):
value
=
int
(
value
)
value
=
tuple
([
value
for
i
in
range
(
n
)])
else
:
assert
len
(
value
)
==
n
,
"tuple len is not equal to n: {}"
.
format
(
value
)
spatial_axis
=
map
(
int
,
value
)
value
=
tuple
(
spatial_axis
)
if
allow_zero
:
minv
=
0
else
:
minv
=
1
assert
min
(
value
)
>=
minv
,
"invalid value: {}"
.
format
(
value
)
return
value
_single
=
functools
.
partial
(
get_ndtuple
,
n
=
1
,
allow_zero
=
True
)
_pair
=
functools
.
partial
(
get_ndtuple
,
n
=
2
,
allow_zero
=
True
)
_pair_nonzero
=
functools
.
partial
(
get_ndtuple
,
n
=
2
,
allow_zero
=
False
)
_triple
=
functools
.
partial
(
get_ndtuple
,
n
=
3
,
allow_zero
=
True
)
_quadruple
=
functools
.
partial
(
get_ndtuple
,
n
=
4
,
allow_zero
=
True
)
imperative/python/megengine/module/conv.py
浏览文件 @
ca1d74ad
...
...
@@ -11,8 +11,8 @@ from typing import Tuple, Union
import
numpy
as
np
from
..functional
import
conv1d
,
conv2d
,
conv_transpose2d
,
local_conv2d
,
relu
from
..functional.types
import
_pair
,
_pair_nonzero
from
..tensor
import
Parameter
from
..utils.tuple_function
import
_pair
,
_pair_nonzero
from
.
import
init
from
.module
import
Module
...
...
imperative/python/megengine/utils/t
ypes
.py
→
imperative/python/megengine/utils/t
uple_function
.py
浏览文件 @
ca1d74ad
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录