Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
8d554d43
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8d554d43
编写于
3月 30, 2020
作者:
X
xiefangqi
提交者:
高东海
4月 08, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix and remove useless import of example, st, ut
上级
d4dead93
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
37 addition
and
42 deletion
+37
-42
example/Bert_NEZHA_cnwiki/train.py
example/Bert_NEZHA_cnwiki/train.py
+2
-2
tests/st/mem_reuse/resnet_cifar_memreuse.py
tests/st/mem_reuse/resnet_cifar_memreuse.py
+1
-2
tests/st/mem_reuse/resnet_cifar_normal.py
tests/st/mem_reuse/resnet_cifar_normal.py
+1
-2
tests/st/networks/models/bert/bert_tdt_no_lossscale.py
tests/st/networks/models/bert/bert_tdt_no_lossscale.py
+2
-2
tests/st/ops/davinci/test_tdt_data_ms.py
tests/st/ops/davinci/test_tdt_data_ms.py
+12
-14
tests/ut/python/dataset/test_minddataset.py
tests/ut/python/dataset/test_minddataset.py
+0
-1
tests/ut/python/dataset/test_project.py
tests/ut/python/dataset/test_project.py
+19
-19
未找到文件。
example/Bert_NEZHA_cnwiki/train.py
浏览文件 @
8d554d43
...
...
@@ -36,7 +36,7 @@ import os
import
numpy
as
np
from
config
import
bert_train_cfg
,
bert_net_cfg
import
mindspore.dataset.engine.datasets
as
de
import
mindspore.
_c_dataengine
as
deMap
import
mindspore.
dataset.transforms.c_transforms
as
C
from
mindspore
import
context
from
mindspore.common.tensor
import
Tensor
from
mindspore.train.model
import
Model
...
...
@@ -52,7 +52,7 @@ def create_train_dataset(batch_size):
ds
=
de
.
StorageDataset
([
bert_train_cfg
.
DATA_DIR
],
bert_train_cfg
.
SCHEMA_DIR
,
columns_list
=
[
"input_ids"
,
"input_mask"
,
"segment_ids"
,
"next_sentence_labels"
,
"masked_lm_positions"
,
"masked_lm_ids"
,
"masked_lm_weights"
])
type_cast_op
=
deMap
.
TypeCastOp
(
"int32"
)
type_cast_op
=
C
.
TypeCast
(
mstype
.
int32
)
ds
=
ds
.
map
(
input_columns
=
"masked_lm_ids"
,
operations
=
type_cast_op
)
ds
=
ds
.
map
(
input_columns
=
"masked_lm_positions"
,
operations
=
type_cast_op
)
ds
=
ds
.
map
(
input_columns
=
"next_sentence_labels"
,
operations
=
type_cast_op
)
...
...
tests/st/mem_reuse/resnet_cifar_memreuse.py
浏览文件 @
8d554d43
...
...
@@ -24,8 +24,7 @@ import numpy as np
import
mindspore.ops.functional
as
F
from
mindspore.train.callback
import
ModelCheckpoint
,
CheckpointConfig
,
LossMonitor
from
mindspore.train.serialization
import
load_checkpoint
,
load_param_into_net
import
mindspore.dataengine
as
de
import
mindspore._c_dataengine
as
deMap
import
mindspore.dataset
as
de
import
mindspore.dataset.transforms.c_transforms
as
C
import
mindspore.dataset.transforms.vision.c_transforms
as
vision
from
mindspore.communication.management
import
init
...
...
tests/st/mem_reuse/resnet_cifar_normal.py
浏览文件 @
8d554d43
...
...
@@ -24,8 +24,7 @@ import numpy as np
import
mindspore.ops.functional
as
F
from
mindspore.train.callback
import
ModelCheckpoint
,
CheckpointConfig
,
LossMonitor
from
mindspore.train.serialization
import
load_checkpoint
,
load_param_into_net
import
mindspore.dataengine
as
de
import
mindspore._c_dataengine
as
deMap
import
mindspore.dataset
as
de
import
mindspore.dataset.transforms.c_transforms
as
C
import
mindspore.dataset.transforms.vision.c_transforms
as
vision
from
mindspore.communication.management
import
init
...
...
tests/st/networks/models/bert/bert_tdt_no_lossscale.py
浏览文件 @
8d554d43
...
...
@@ -21,7 +21,7 @@ import numpy as np
from
numpy
import
allclose
import
mindspore.common.dtype
as
mstype
import
mindspore.dataset.engine.datasets
as
de
import
mindspore.
_c_dataengine
as
deMap
import
mindspore.
dataset.transforms.c_transforms
as
C
from
mindspore
import
context
from
mindspore.common.tensor
import
Tensor
from
mindspore.train.model
import
Model
...
...
@@ -106,7 +106,7 @@ def me_de_train_dataset():
ds
=
de
.
StorageDataset
(
DATA_DIR
,
SCHEMA_DIR
,
columns_list
=
[
"input_ids"
,
"input_mask"
,
"segment_ids"
,
"next_sentence_labels"
,
"masked_lm_positions"
,
"masked_lm_ids"
,
"masked_lm_weights"
])
type_cast_op
=
deMap
.
TypeCastOp
(
"int32"
)
type_cast_op
=
C
.
TypeCast
(
mstype
.
int32
)
ds
=
ds
.
map
(
input_columns
=
"masked_lm_ids"
,
operations
=
type_cast_op
)
ds
=
ds
.
map
(
input_columns
=
"masked_lm_positions"
,
operations
=
type_cast_op
)
ds
=
ds
.
map
(
input_columns
=
"next_sentence_labels"
,
operations
=
type_cast_op
)
...
...
tests/st/ops/davinci/test_tdt_data_ms.py
浏览文件 @
8d554d43
...
...
@@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
import
mindspore._c_dataengine
as
deMap
import
mindspore.dataset
as
ds
import
mindspore.dataset.transforms.vision.c_transforms
as
vision
from
mindspore.dataset.transforms.vision
import
Inter
import
numpy
as
np
import
sys
from
mindspore._c_dataengine
import
InterpolationMode
import
mindspore.context
as
context
import
mindspore.nn
as
nn
...
...
@@ -32,7 +32,7 @@ SCHEMA_DIR = "{0}/resnet_all_datasetSchema.json".format(data_path)
def
test_me_de_train_dataset
():
data_list
=
[
"{0}/train-00001-of-01024.data"
.
format
(
data_path
)]
data_set
=
ds
.
StorageDataset
(
data_list
,
schema
=
SCHEMA_DIR
,
columns_list
=
[
"image/encoded"
,
"image/class/label"
])
columns_list
=
[
"image/encoded"
,
"image/class/label"
])
resize_height
=
224
resize_width
=
224
...
...
@@ -41,19 +41,17 @@ def test_me_de_train_dataset():
# define map operations
decode_op
=
deMap
.
DecodeOp
()
resize_op
=
deMap
.
ResizeOp
(
resize_height
,
resize_width
,
InterpolationMode
.
DE_INTER_LINEAR
)
# Bilinear as default
rescale_op
=
deMap
.
RescaleOp
(
rescale
,
shift
)
changemode_op
=
deMap
.
ChangeModeOp
()
decode_op
=
vision
.
Decode
()
resize_op
=
vision
.
Resize
(
resize_height
,
resize_width
,
Inter
.
LINEAR
)
# Bilinear as default
rescale_op
=
vision
.
Rescale
(
rescale
,
shift
)
# apply map operations on images
data_set
=
data_set
.
map
(
input_column_names
=
"image/encoded"
,
operation
=
decode_op
)
data_set
=
data_set
.
map
(
input_column_names
=
"image/encoded"
,
operation
=
resize_op
)
data_set
=
data_set
.
map
(
input_column_names
=
"image/encoded"
,
operation
=
rescale_op
)
data_set
=
data_set
.
map
(
input_column_names
=
"image/encoded"
,
operation
=
changemode_op
)
changeswap_op
=
deMap
.
ChannelSwapOp
()
data_set
=
data_set
.
map
(
input_column_names
=
"image/encoded"
,
operation
=
changeswap_op
)
data_set
=
data_set
.
map
(
input_columns
=
"image/encoded"
,
operations
=
decode_op
)
data_set
=
data_set
.
map
(
input_columns
=
"image/encoded"
,
operations
=
resize_op
)
data_set
=
data_set
.
map
(
input_columns
=
"image/encoded"
,
operations
=
rescale_op
)
hwc2chw_op
=
vision
.
HWC2CHW
()
data_set
=
data_set
.
map
(
input_columns
=
"image/encoded"
,
operations
=
hwc2chw_op
)
data_set
=
data_set
.
repeat
(
1
)
# apply batch operations
batch_size
=
32
...
...
tests/ut/python/dataset/test_minddataset.py
浏览文件 @
8d554d43
...
...
@@ -24,7 +24,6 @@ import string
import
mindspore.dataset.transforms.vision.c_transforms
as
vision
import
numpy
as
np
import
pytest
from
mindspore._c_dataengine
import
InterpolationMode
from
mindspore.dataset.transforms.vision
import
Inter
from
mindspore
import
log
as
logger
...
...
tests/ut/python/dataset/test_project.py
浏览文件 @
8d554d43
...
...
@@ -13,7 +13,8 @@
# limitations under the License.
# ==============================================================================
import
mindspore.dataset.transforms.vision.c_transforms
as
vision
import
mindspore._c_dataengine
as
de_map
import
mindspore.dataset.transforms.c_transforms
as
C
from
mindspore.common
import
dtype
as
mstype
from
util
import
ordered_save_and_check
import
mindspore.dataset
as
ds
...
...
@@ -63,9 +64,8 @@ def test_case_project_map():
data1
=
ds
.
TFRecordDataset
(
DATA_DIR_TF
,
SCHEMA_DIR_TF
,
shuffle
=
False
)
data1
=
data1
.
project
(
columns
=
columns
)
no_op
=
de_map
.
NoOp
()
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
no_op
)
type_cast_op
=
C
.
TypeCast
(
mstype
.
int64
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
type_cast_op
)
filename
=
"project_map_after_result.npz"
ordered_save_and_check
(
data1
,
parameters
,
filename
,
generate_golden
=
GENERATE_GOLDEN
)
...
...
@@ -77,8 +77,8 @@ def test_case_map_project():
data1
=
ds
.
TFRecordDataset
(
DATA_DIR_TF
,
SCHEMA_DIR_TF
,
shuffle
=
False
)
no_op
=
de_map
.
NoOp
(
)
data1
=
data1
.
map
(
input_columns
=
[
"col_sint64"
],
operations
=
no
_op
)
type_cast_op
=
C
.
TypeCast
(
mstype
.
int64
)
data1
=
data1
.
map
(
input_columns
=
[
"col_sint64"
],
operations
=
type_cast
_op
)
data1
=
data1
.
project
(
columns
=
columns
)
...
...
@@ -92,19 +92,19 @@ def test_case_project_between_maps():
data1
=
ds
.
TFRecordDataset
(
DATA_DIR_TF
,
SCHEMA_DIR_TF
,
shuffle
=
False
)
no_op
=
de_map
.
NoOp
(
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
no
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
no
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
no
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
no
_op
)
type_cast_op
=
C
.
TypeCast
(
mstype
.
int64
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
type_cast
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
type_cast
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
type_cast
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
type_cast
_op
)
data1
=
data1
.
project
(
columns
=
columns
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
no
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
no
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
no
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
no
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
no
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
type_cast
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
type_cast
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
type_cast
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
type_cast
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_3d"
],
operations
=
type_cast
_op
)
filename
=
"project_between_maps_result.npz"
ordered_save_and_check
(
data1
,
parameters
,
filename
,
generate_golden
=
GENERATE_GOLDEN
)
...
...
@@ -145,12 +145,12 @@ def test_case_map_project_map_project():
data1
=
ds
.
TFRecordDataset
(
DATA_DIR_TF
,
SCHEMA_DIR_TF
,
shuffle
=
False
)
no_op
=
de_map
.
NoOp
(
)
data1
=
data1
.
map
(
input_columns
=
[
"col_sint64"
],
operations
=
no
_op
)
type_cast_op
=
C
.
TypeCast
(
mstype
.
int64
)
data1
=
data1
.
map
(
input_columns
=
[
"col_sint64"
],
operations
=
type_cast
_op
)
data1
=
data1
.
project
(
columns
=
columns
)
data1
=
data1
.
map
(
input_columns
=
[
"col_2d"
],
operations
=
no
_op
)
data1
=
data1
.
map
(
input_columns
=
[
"col_2d"
],
operations
=
type_cast
_op
)
data1
=
data1
.
project
(
columns
=
columns
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录