Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
e5217db9
MegEngine
项目概览
MegEngine 天元
/
MegEngine
大约 1 年 前同步成功
通知
399
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看板
提交
e5217db9
编写于
8月 27, 2021
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(traced_module): move traced_module out of the experimental folder
GitOrigin-RevId: 36c76b5277c64b15ef4a9aacdf7fa4e1eb936c10
上级
6d1a4f20
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
62 addition
and
65 deletion
+62
-65
imperative/python/megengine/__init__.py
imperative/python/megengine/__init__.py
+0
-1
imperative/python/megengine/experimental/__init__.py
imperative/python/megengine/experimental/__init__.py
+0
-1
imperative/python/megengine/traced_module/__init__.py
imperative/python/megengine/traced_module/__init__.py
+1
-1
imperative/python/megengine/traced_module/expr.py
imperative/python/megengine/traced_module/expr.py
+7
-8
imperative/python/megengine/traced_module/fake_quant.py
imperative/python/megengine/traced_module/fake_quant.py
+11
-3
imperative/python/megengine/traced_module/module_tracer.py
imperative/python/megengine/traced_module/module_tracer.py
+5
-6
imperative/python/megengine/traced_module/node.py
imperative/python/megengine/traced_module/node.py
+3
-4
imperative/python/megengine/traced_module/pytree.py
imperative/python/megengine/traced_module/pytree.py
+7
-8
imperative/python/megengine/traced_module/serialization.py
imperative/python/megengine/traced_module/serialization.py
+3
-3
imperative/python/megengine/traced_module/traced_module.py
imperative/python/megengine/traced_module/traced_module.py
+12
-13
imperative/python/megengine/traced_module/utils.py
imperative/python/megengine/traced_module/utils.py
+1
-2
imperative/python/test/integration/test_converge.py
imperative/python/test/integration/test_converge.py
+1
-1
imperative/python/test/integration/test_converge_with_gradient_clip.py
...thon/test/integration/test_converge_with_gradient_clip.py
+1
-1
imperative/python/test/integration/test_trace_dump.py
imperative/python/test/integration/test_trace_dump.py
+1
-1
imperative/python/test/unit/core/test_serialization.py
imperative/python/test/unit/core/test_serialization.py
+1
-4
imperative/python/test/unit/module/test_module.py
imperative/python/test/unit/module/test_module.py
+1
-1
imperative/python/test/unit/traced_module/test_haoruitao.py
imperative/python/test/unit/traced_module/test_haoruitao.py
+1
-1
imperative/python/test/unit/traced_module/test_jit_trace.py
imperative/python/test/unit/traced_module/test_jit_trace.py
+1
-1
imperative/python/test/unit/traced_module/test_modification.py
...ative/python/test/unit/traced_module/test_modification.py
+2
-2
imperative/python/test/unit/traced_module/test_serialization.py
...tive/python/test/unit/traced_module/test_serialization.py
+1
-1
imperative/python/test/unit/traced_module/test_trace_module.py
...ative/python/test/unit/traced_module/test_trace_module.py
+1
-1
imperative/python/test/unit/traced_module/test_wujianan.py
imperative/python/test/unit/traced_module/test_wujianan.py
+1
-1
未找到文件。
imperative/python/megengine/__init__.py
浏览文件 @
e5217db9
...
...
@@ -130,4 +130,3 @@ import megengine.optimizer
import
megengine.quantization
import
megengine.random
import
megengine.utils
import
megengine.experimental
imperative/python/megengine/experimental/__init__.py
浏览文件 @
e5217db9
...
...
@@ -6,5 +6,4 @@
# 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.
from
.
import
traced_module
from
.weight_scaler
import
get_scaled_model
imperative/python/megengine/
experimental/
traced_module/__init__.py
→
imperative/python/megengine/traced_module/__init__.py
浏览文件 @
e5217db9
...
...
@@ -6,7 +6,7 @@
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
from
..
.
core._imperative_rt.core2
import
set_cpp_apply_module_trace
from
..core._imperative_rt.core2
import
set_cpp_apply_module_trace
from
.traced_module
import
(
TracedModule
,
_register_all_builtin_module
,
...
...
imperative/python/megengine/
experimental/
traced_module/expr.py
→
imperative/python/megengine/traced_module/expr.py
浏览文件 @
e5217db9
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
...
...
@@ -14,13 +13,13 @@ import inspect
import
re
from
typing
import
Callable
,
Dict
,
List
from
..
.
core._imperative_rt
import
OpDef
from
..
.
core._imperative_rt.core2
import
Tensor
as
RawTensor
from
..
.
core._imperative_rt.core2
import
apply
,
set_module_tracing
,
unset_module_tracing
from
..
.
core.ops.builtin
import
FakeQuant
from
..
.
core.ops.special
import
Const
from
..
.
module
import
Module
from
..
.
tensor
import
Parameter
,
Tensor
from
..core._imperative_rt
import
OpDef
from
..core._imperative_rt.core2
import
Tensor
as
RawTensor
from
..core._imperative_rt.core2
import
apply
,
set_module_tracing
,
unset_module_tracing
from
..core.ops.builtin
import
FakeQuant
from
..core.ops.special
import
Const
from
..module
import
Module
from
..tensor
import
Parameter
,
Tensor
from
.module_tracer
import
active_module_tracer
,
module_tracer
from
.node
import
ModuleNode
,
Node
,
NodeMixin
,
TensorNode
from
.pytree
import
ArgsIndex
,
TreeDef
,
_is_const_leaf
,
_is_leaf
,
tree_flatten
...
...
imperative/python/megengine/
experimental/
traced_module/fake_quant.py
→
imperative/python/megengine/traced_module/fake_quant.py
浏览文件 @
e5217db9
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 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.
from
copy
import
deepcopy
from
typing
import
Union
from
..
.
core.tensor.dtype
import
QuantDtypeMeta
from
..
.
quantization.fake_quant
import
QParamsModuleMixin
,
_FakeQuantize
from
..
.
quantization.utils
import
QParams
,
QuantMode
,
fake_quant_tensor
from
..core.tensor.dtype
import
QuantDtypeMeta
from
..quantization.fake_quant
import
QParamsModuleMixin
,
_FakeQuantize
from
..quantization.utils
import
QParams
,
QuantMode
,
fake_quant_tensor
class
FakeQuantize
(
_FakeQuantize
,
QParamsModuleMixin
):
...
...
imperative/python/megengine/
experimental/
traced_module/module_tracer.py
→
imperative/python/megengine/traced_module/module_tracer.py
浏览文件 @
e5217db9
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
...
...
@@ -8,11 +7,11 @@
# "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import
collections
from
..
.
import
Tensor
from
..
.
import
functional
as
F
from
..
.
core.tensor.array_method
import
ArrayMethodMixin
from
..
.
module
import
Module
from
..
.
module.qat
import
QATModule
from
..
import
Tensor
from
..
import
functional
as
F
from
..core.tensor.array_method
import
ArrayMethodMixin
from
..module
import
Module
from
..module.qat
import
QATModule
_active_module_tracer
=
None
...
...
imperative/python/megengine/
experimental/
traced_module/node.py
→
imperative/python/megengine/traced_module/node.py
浏览文件 @
e5217db9
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
...
...
@@ -12,9 +11,9 @@ from typing import Any, Dict, List, Tuple, Type
import
numpy
from
..
.
core._imperative_rt.core2
import
Tensor
as
RawTensor
from
..
.
module
import
Module
from
..
.
tensor
import
Tensor
from
..core._imperative_rt.core2
import
Tensor
as
RawTensor
from
..module
import
Module
from
..tensor
import
Tensor
class
Node
:
...
...
imperative/python/megengine/
experimental/
traced_module/pytree.py
→
imperative/python/megengine/traced_module/pytree.py
浏览文件 @
e5217db9
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
...
...
@@ -13,13 +12,13 @@ from typing import Callable, NamedTuple
import
numpy
as
np
from
..
.
core._imperative_rt.common
import
CompNode
from
..
.
core._imperative_rt.core2
import
Tensor
as
RawTensor
from
..
.
core._wrap
import
Device
from
..
.
core.tensor.dtype
import
QuantDtypeMeta
from
..
.
module
import
Module
from
..
.
quantization.utils
import
LSQParams
,
QParams
,
QuantMode
from
..
.
tensor
import
Parameter
,
Tensor
from
..core._imperative_rt.common
import
CompNode
from
..core._imperative_rt.core2
import
Tensor
as
RawTensor
from
..core._wrap
import
Device
from
..core.tensor.dtype
import
QuantDtypeMeta
from
..module
import
Module
from
..quantization.utils
import
LSQParams
,
QParams
,
QuantMode
from
..tensor
import
Parameter
,
Tensor
from
.node
import
ModuleNode
,
Node
,
NodeMixin
,
TensorNode
...
...
imperative/python/megengine/
experimental/
traced_module/serialization.py
→
imperative/python/megengine/traced_module/serialization.py
浏览文件 @
e5217db9
...
...
@@ -7,9 +7,9 @@
# "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
from
typing
import
Dict
from
..
.
core._imperative_rt
import
OpDef
from
..
.
core.ops
import
builtin
from
..
.
version
import
__version__
from
..core._imperative_rt
import
OpDef
from
..core.ops
import
builtin
from
..version
import
__version__
OPDEF_PARAM_LOADER
=
{}
...
...
imperative/python/megengine/
experimental/
traced_module/traced_module.py
→
imperative/python/megengine/traced_module/traced_module.py
浏览文件 @
e5217db9
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
...
...
@@ -22,21 +21,21 @@ from typing import Callable, Dict, Iterable, List, Optional, Sequence, Type, Uni
from
megengine
import
tensor
from
..
.
import
functional
as
F
from
..
.
import
get_logger
from
..
.
import
module
as
M
from
..
.
core._imperative_rt.core2
import
Tensor
as
RawTensor
from
..
.
core._imperative_rt.core2
import
(
from
..
import
functional
as
F
from
..
import
get_logger
from
..
import
module
as
M
from
..core._imperative_rt.core2
import
Tensor
as
RawTensor
from
..core._imperative_rt.core2
import
(
is_tracing_module
,
set_module_tracing
,
unset_module_tracing
,
)
from
..
.
core._trace_option
import
set_symbolic_shape
from
..
.
core.tensor.array_method
import
ArrayMethodMixin
from
..
.
module
import
Module
from
..
.
module.qat
import
QATModule
from
..
.
quantization.fake_quant
import
LSQ
,
TQT
,
FakeQuantize
,
_FakeQuantize
from
..
.
quantization.observer
import
(
from
..core._trace_option
import
set_symbolic_shape
from
..core.tensor.array_method
import
ArrayMethodMixin
from
..module
import
Module
from
..module.qat
import
QATModule
from
..quantization.fake_quant
import
LSQ
,
TQT
,
FakeQuantize
,
_FakeQuantize
from
..quantization.observer
import
(
ExponentialMovingAverageObserver
,
HistogramObserver
,
MinMaxObserver
,
...
...
@@ -45,7 +44,7 @@ from ...quantization.observer import (
SyncExponentialMovingAverageObserver
,
SyncMinMaxObserver
,
)
from
..
.
tensor
import
Tensor
from
..tensor
import
Tensor
from
.expr
import
Apply
,
CallFunction
,
CallMethod
,
Constant
,
Expr
,
GetAttr
,
Input
from
.fake_quant
import
FakeQuantize
as
TM_FakeQuant
from
.module_tracer
import
(
...
...
imperative/python/megengine/
experimental/
traced_module/utils.py
→
imperative/python/megengine/traced_module/utils.py
浏览文件 @
e5217db9
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
...
...
@@ -10,7 +9,7 @@ import copy
from
collections.abc
import
MutableMapping
,
MutableSequence
from
typing
import
Dict
,
Iterable
,
List
,
Optional
,
Sequence
from
..
.
module
import
Module
from
..module
import
Module
def
replace_container_with_module_container
(
container
):
...
...
imperative/python/test/integration/test_converge.py
浏览文件 @
e5217db9
...
...
@@ -15,9 +15,9 @@ import megengine as mge
import
megengine.autodiff
as
ad
import
megengine.functional
as
F
from
megengine
import
Tensor
from
megengine.experimental.traced_module
import
trace_module
from
megengine.module
import
Linear
,
Module
from
megengine.optimizer
import
SGD
from
megengine.traced_module
import
trace_module
batch_size
=
64
data_shape
=
(
batch_size
,
2
)
...
...
imperative/python/test/integration/test_converge_with_gradient_clip.py
浏览文件 @
e5217db9
...
...
@@ -16,10 +16,10 @@ import megengine.autodiff as ad
import
megengine.functional
as
F
import
megengine.optimizer
as
optim
from
megengine
import
Tensor
from
megengine.experimental.traced_module
import
trace_module
from
megengine.jit
import
trace
from
megengine.module
import
Linear
,
Module
from
megengine.optimizer
import
SGD
from
megengine.traced_module
import
trace_module
batch_size
=
64
data_shape
=
(
batch_size
,
2
)
...
...
imperative/python/test/integration/test_trace_dump.py
浏览文件 @
e5217db9
...
...
@@ -19,8 +19,8 @@ import megengine.module as M
import
megengine.optimizer
as
optim
from
megengine
import
tensor
from
megengine.autodiff
import
GradManager
from
megengine.experimental.traced_module
import
trace_module
from
megengine.jit
import
trace
from
megengine.traced_module
import
trace_module
@
contextlib
.
contextmanager
...
...
imperative/python/test/unit/core/test_serialization.py
浏览文件 @
e5217db9
...
...
@@ -15,10 +15,7 @@ import numpy as np
import
megengine
as
mge
from
megengine
import
Parameter
,
Tensor
from
megengine.core.ops
import
builtin
from
megengine.experimental.traced_module.serialization
import
(
get_opdef_state
,
load_opdef_from_state
,
)
from
megengine.traced_module.serialization
import
get_opdef_state
,
load_opdef_from_state
def
test_tensor_serialization
():
...
...
imperative/python/test/unit/module/test_module.py
浏览文件 @
e5217db9
...
...
@@ -15,7 +15,6 @@ import pytest
import
megengine
as
mge
import
megengine.functional
as
F
from
megengine
import
Parameter
,
Tensor
,
tensor
from
megengine.experimental.traced_module
import
TracedModule
,
trace_module
from
megengine.module
import
(
BatchNorm1d
,
BatchNorm2d
,
...
...
@@ -30,6 +29,7 @@ from megengine.module import (
)
from
megengine.module.module
import
_access_structure
from
megengine.quantization.quantize
import
quantize
,
quantize_qat
from
megengine.traced_module
import
TracedModule
,
trace_module
from
megengine.utils.module_utils
import
get_expand_structure
,
set_expand_structure
...
...
imperative/python/test/unit/traced_module/test_haoruitao.py
浏览文件 @
e5217db9
...
...
@@ -7,8 +7,8 @@ import megengine.functional as F
import
megengine.module
as
M
import
megengine.utils.comp_graph_tools
as
cgtools
from
megengine.core._trace_option
import
set_symbolic_shape
from
megengine.experimental.traced_module
import
trace_module
from
megengine.jit
import
trace
from
megengine.traced_module
import
trace_module
set_symbolic_shape
(
True
)
...
...
imperative/python/test/unit/traced_module/test_jit_trace.py
浏览文件 @
e5217db9
...
...
@@ -12,9 +12,9 @@ import numpy as np
import
megengine.functional
as
F
import
megengine.module
as
M
import
megengine.utils.comp_graph_tools
as
cgtools
from
megengine.experimental.traced_module
import
trace_module
from
megengine.jit
import
trace
from
megengine.module
import
Module
from
megengine.traced_module
import
trace_module
class
MyBlock
(
Module
):
...
...
imperative/python/test/unit/traced_module/test_modification.py
浏览文件 @
e5217db9
...
...
@@ -9,8 +9,8 @@ import numpy as np
import
megengine.functional
as
F
import
megengine.module
as
M
from
megengine.
experimental.
traced_module
import
trace_module
from
megengine.
experimental.
traced_module.expr
import
CallFunction
,
GetAttr
from
megengine.traced_module
import
trace_module
from
megengine.traced_module.expr
import
CallFunction
,
GetAttr
class
MyBlock
(
M
.
Module
):
...
...
imperative/python/test/unit/traced_module/test_serialization.py
浏览文件 @
e5217db9
...
...
@@ -12,8 +12,8 @@ import numpy as np
import
megengine.functional
as
F
import
megengine.module
as
M
from
megengine
import
Tensor
from
megengine.experimental.traced_module
import
trace_module
from
megengine.module
import
Module
from
megengine.traced_module
import
trace_module
class
MyBlock
(
Module
):
...
...
imperative/python/test/unit/traced_module/test_trace_module.py
浏览文件 @
e5217db9
...
...
@@ -2,7 +2,7 @@ import numpy as np
import
megengine.module
as
M
from
megengine
import
Tensor
from
megengine.
experimental.
traced_module
import
TracedModule
,
trace_module
from
megengine.traced_module
import
TracedModule
,
trace_module
class
MyModule1
(
M
.
Module
):
...
...
imperative/python/test/unit/traced_module/test_wujianan.py
浏览文件 @
e5217db9
...
...
@@ -8,8 +8,8 @@ import megengine.functional as F
import
megengine.module
as
M
import
megengine.utils.comp_graph_tools
as
cgtools
from
megengine.core._trace_option
import
set_symbolic_shape
from
megengine.experimental.traced_module
import
trace_module
from
megengine.jit
import
trace
from
megengine.traced_module
import
trace_module
set_symbolic_shape
(
True
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录