Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
43e5db3d
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看板
提交
43e5db3d
编写于
7月 22, 2020
作者:
L
liyong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix save op pydoc
上级
859fe6bc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
55 addition
and
2 deletion
+55
-2
mindspore/ccsrc/minddata/dataset/api/de_pipeline.cc
mindspore/ccsrc/minddata/dataset/api/de_pipeline.cc
+4
-0
mindspore/dataset/engine/datasets.py
mindspore/dataset/engine/datasets.py
+51
-2
未找到文件。
mindspore/ccsrc/minddata/dataset/api/de_pipeline.cc
浏览文件 @
43e5db3d
...
...
@@ -410,6 +410,7 @@ Status DEPipeline::SaveDataset(const std::vector<std::string> &file_names, const
std
::
vector
<
std
::
string
>
index_fields
;
s
=
FetchMetaFromTensorRow
(
column_name_id_map
,
row
,
&
mr_json
,
&
index_fields
);
RETURN_IF_NOT_OK
(
s
);
MS_LOG
(
DEBUG
)
<<
"Schema of saved mindrecord: "
<<
mr_json
.
dump
();
if
(
mindrecord
::
SUCCESS
!=
mindrecord
::
ShardHeader
::
initialize
(
&
mr_header
,
mr_json
,
index_fields
,
blob_fields
,
mr_schema_id
))
{
RETURN_STATUS_UNEXPECTED
(
"Error: failed to initialize ShardHeader."
);
...
...
@@ -569,6 +570,7 @@ Status DEPipeline::FetchMetaFromTensorRow(const std::unordered_map<std::string,
if
(
column_name_id_map
.
empty
())
{
RETURN_STATUS_UNEXPECTED
(
"Error: column not found."
);
}
json
dataset_schema
;
for
(
auto
&
col
:
column_name_id_map
)
{
auto
idx
=
col
.
second
;
auto
column_name
=
col
.
first
;
...
...
@@ -580,6 +582,7 @@ Status DEPipeline::FetchMetaFromTensorRow(const std::unordered_map<std::string,
auto
shapes
=
column_shape
.
AsVector
();
std
::
vector
<
int
>
mr_shape
(
shapes
.
begin
(),
shapes
.
end
());
std
::
string
el
=
column_type
.
ToString
();
dataset_schema
[
column_name
]
=
el
;
if
(
mindrecord
::
kTypesMap
.
find
(
el
)
==
mindrecord
::
kTypesMap
.
end
())
{
std
::
string
err_msg
(
"Error: can not support data type: "
+
el
);
RETURN_STATUS_UNEXPECTED
(
err_msg
);
...
...
@@ -605,6 +608,7 @@ Status DEPipeline::FetchMetaFromTensorRow(const std::unordered_map<std::string,
if
(
mr_type
==
"bytes"
||
!
mr_shape
.
empty
())
continue
;
index_fields
->
emplace_back
(
column_name
);
// candidate of index fields
}
MS_LOG
(
DEBUG
)
<<
"Schema of dataset: "
<<
dataset_schema
.
dump
();
return
Status
::
OK
();
}
Status
DEPipeline
::
BuildMindrecordSamplerChain
(
const
py
::
handle
&
handle
,
...
...
mindspore/dataset/engine/datasets.py
浏览文件 @
43e5db3d
...
...
@@ -1041,12 +1041,61 @@ class Dataset:
"""
Save the dynamic data processed by dataset pipeline as common dataset format, support: mindrecord.
Implicit type casting exists when saving data as mindrecord. Table below shows how to do type casting.
.. list-table:: Implicit Type Casting of Saving as mindrecord
:widths: 25 25 50
:header-rows: 1
* - type in 'dataset'
- type in 'mindrecord'
- detail
* - DE_BOOL
- None
- Not support
* - DE_INT8
- int32
-
* - DE_UINT8
- bytes(1D uint8)
- Drop dimension
* - DE_INT16
- int32
-
* - DE_UINT16
- int32
-
* - DE_INT32
- int32
-
* - DE_UINT32
- int64
-
* - DE_INT64
- int64
-
* - DE_UINT64
- None
- Not support
* - DE_FLOAT16
- float32
-
* - DE_FLOAT32
- float32
-
* - DE_FLOAT64
- float64
-
* - DE_STRING
- string
- Not support multi-dimensional DE_STRING
Note:
1. To save the samples in order, should set dataset's shuffle false and num_files 1.
2. Before call the function, do not use batch, repeat operator or data augmentation operators
with random attribute in map operator.
3. Mindre
ocrd do not support np.uint64, multi-dimensional np.uint
8(drop dimension) and
multi-dimensional
string
.
3. Mindre
cord does not support DE_UINT64, multi-dimensional DE_UINT
8(drop dimension) and
multi-dimensional
DE_STRING
.
Args:
file_name (str): Path to dataset file.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录