Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
fc9161a4
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看板
提交
fc9161a4
编写于
8月 27, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 27, 2020
浏览文件
操作
浏览文件
下载
差异文件
!5205 Move GetValue of CLUE Dataset out of try-catch
Merge pull request !5205 from jiangzhiwen/bug/clue_get_value
上级
e83899ad
767f97cd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
30 deletion
+12
-30
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/clue_op.cc
...csrc/minddata/dataset/engine/datasetops/source/clue_op.cc
+12
-23
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/clue_op.h
...ccsrc/minddata/dataset/engine/datasetops/source/clue_op.h
+0
-7
未找到文件。
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/clue_op.cc
浏览文件 @
fc9161a4
...
...
@@ -122,16 +122,6 @@ Status ClueOp::Reset() {
return
Status
::
OK
();
}
Status
ClueOp
::
LoadTensor
(
const
std
::
string
&
line
,
std
::
unique_ptr
<
TensorQTable
>
*
tensor_table
,
int64_t
row
)
{
TensorRow
tRow
(
1
,
nullptr
);
(
*
tensor_table
)
->
push_back
(
std
::
move
(
tRow
));
std
::
shared_ptr
<
Tensor
>
tensor
;
RETURN_IF_NOT_OK
(
Tensor
::
CreateScalar
(
line
,
&
tensor
));
(
**
tensor_table
)[
row
][
0
]
=
std
::
move
(
tensor
);
return
Status
::
OK
();
}
Status
ClueOp
::
GetValue
(
const
nlohmann
::
json
&
js
,
std
::
vector
<
std
::
string
>
key_chain
,
std
::
shared_ptr
<
Tensor
>
*
t
)
{
nlohmann
::
json
cursor
=
js
;
for
(
int
i
=
0
;
i
<
key_chain
.
size
();
i
++
)
{
...
...
@@ -191,25 +181,24 @@ Status ClueOp::LoadFile(const std::string &file, const int64_t start_offset, con
continue
;
}
nlohmann
::
json
js
;
try
{
nlohmann
::
json
js
=
nlohmann
::
json
::
parse
(
line
);
int
cols_count
=
cols_to_keyword_
.
size
();
TensorRow
tRow
(
cols_count
,
nullptr
);
tensor_table
->
push_back
(
std
::
move
(
tRow
));
int
cout
=
0
;
for
(
auto
&
p
:
cols_to_keyword_
)
{
std
::
shared_ptr
<
Tensor
>
tensor
;
RETURN_IF_NOT_OK
(
GetValue
(
js
,
p
.
second
,
&
tensor
));
(
*
tensor_table
)[
rows_each_buffer
][
cout
]
=
std
::
move
(
tensor
);
cout
++
;
}
js
=
nlohmann
::
json
::
parse
(
line
);
}
catch
(
const
std
::
exception
&
err
)
{
// Catch any exception and convert to Status return code
RETURN_STATUS_UNEXPECTED
(
"Failed to load json file"
);
}
int
cols_count
=
cols_to_keyword_
.
size
();
TensorRow
tRow
(
cols_count
,
nullptr
);
tensor_table
->
push_back
(
std
::
move
(
tRow
));
int
cout
=
0
;
for
(
auto
&
p
:
cols_to_keyword_
)
{
std
::
shared_ptr
<
Tensor
>
tensor
;
RETURN_IF_NOT_OK
(
GetValue
(
js
,
p
.
second
,
&
tensor
));
(
*
tensor_table
)[
rows_each_buffer
][
cout
]
=
std
::
move
(
tensor
);
cout
++
;
}
// RETURN_IF_NOT_OK(LoadTensor(line, &tensor_table, rows_each_buffer));
rows_each_buffer
++
;
rows_total
++
;
if
(
rows_each_buffer
==
rows_per_buffer_
)
{
...
...
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/clue_op.h
浏览文件 @
fc9161a4
...
...
@@ -179,13 +179,6 @@ class ClueOp : public ParallelOp {
// @return Status - the error code returned.
Status
WorkerEntry
(
int32_t
worker_id
)
override
;
// Parses a single row and puts the data into a tensor table.
// @param line - the content of the row.
// @param tensor_table - the tensor table to put the parsed data in.
// @param row - the id of the row filled in the tensor table.
// @return Status - the error code returned.
Status
LoadTensor
(
const
std
::
string
&
line
,
std
::
unique_ptr
<
TensorQTable
>
*
tensor_table
,
int64_t
row
);
// Reads a clue file and loads the data into multiple buffers.
// @param file - the file to read.
// @param start_offset - the start offset of file.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录