Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
8d1dae46
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看板
提交
8d1dae46
编写于
6月 17, 2020
作者:
M
ms_yan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Throw error when load config failed
上级
19e66f06
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
4 addition
and
15 deletion
+4
-15
mindspore/ccsrc/dataset/api/python_bindings.cc
mindspore/ccsrc/dataset/api/python_bindings.cc
+1
-1
mindspore/ccsrc/dataset/core/config_manager.cc
mindspore/ccsrc/dataset/core/config_manager.cc
+3
-6
tests/ut/data/dataset/declient_filter.cfg
tests/ut/data/dataset/declient_filter.cfg
+0
-3
tests/ut/python/dataset/test_filterop.py
tests/ut/python/dataset/test_filterop.py
+0
-5
未找到文件。
mindspore/ccsrc/dataset/api/python_bindings.cc
浏览文件 @
8d1dae46
...
...
@@ -276,7 +276,7 @@ void bindTensor(py::module *m) {
.
def
(
"get_op_connector_size"
,
&
ConfigManager
::
op_connector_size
)
.
def
(
"get_seed"
,
&
ConfigManager
::
seed
)
.
def
(
"get_monitor_sampling_interval"
,
&
ConfigManager
::
monitor_sampling_interval
)
.
def
(
"load"
,
[](
ConfigManager
&
c
,
std
::
string
s
)
{
(
void
)
c
.
LoadFile
(
s
);
});
.
def
(
"load"
,
[](
ConfigManager
&
c
,
std
::
string
s
)
{
THROW_IF_ERROR
(
c
.
LoadFile
(
s
)
);
});
(
void
)
py
::
class_
<
Tensor
,
std
::
shared_ptr
<
Tensor
>>
(
*
m
,
"Tensor"
,
py
::
buffer_protocol
())
.
def
(
py
::
init
([](
py
::
array
arr
)
{
...
...
mindspore/ccsrc/dataset/core/config_manager.cc
浏览文件 @
8d1dae46
...
...
@@ -48,7 +48,7 @@ Status ConfigManager::FromJson(const nlohmann::json &j) {
Status
ConfigManager
::
LoadFile
(
const
std
::
string
&
settingsFile
)
{
Status
rc
;
if
(
!
Path
(
settingsFile
).
Exists
())
{
RETURN_STATUS_UNEXPECTED
(
"File is not found"
);
RETURN_STATUS_UNEXPECTED
(
"File is not found
.
"
);
}
// Some settings are mandatory, others are not (with default). If a setting
// is optional it will set a default value if the config is missing from the file.
...
...
@@ -59,14 +59,11 @@ Status ConfigManager::LoadFile(const std::string &settingsFile) {
rc
=
FromJson
(
js
);
}
catch
(
const
nlohmann
::
json
::
type_error
&
e
)
{
std
::
ostringstream
ss
;
ss
<<
"Client
settings
failed to load:
\n
"
<<
e
.
what
();
ss
<<
"Client
file
failed to load:
\n
"
<<
e
.
what
();
std
::
string
err_msg
=
ss
.
str
();
RETURN_STATUS_UNEXPECTED
(
err_msg
);
}
catch
(
const
std
::
exception
&
err
)
{
std
::
ostringstream
ss
;
ss
<<
"Client settings failed to load:
\n
"
<<
err
.
what
();
std
::
string
err_msg
=
ss
.
str
();
RETURN_STATUS_UNEXPECTED
(
err_msg
);
RETURN_STATUS_UNEXPECTED
(
"Client file failed to load."
);
}
return
rc
;
}
...
...
tests/ut/data/dataset/declient_filter.cfg
已删除
100644 → 0
浏览文件 @
19e66f06
{
"rowsPerBuffer": 10,
}
tests/ut/python/dataset/test_filterop.py
浏览文件 @
8d1dae46
...
...
@@ -390,7 +390,6 @@ def filter_func_Partial_0(col1, col2, col3, col4):
# test with row_data_buffer > 1
def
test_filter_by_generator_Partial0
():
ds
.
config
.
load
(
'../data/dataset/declient_filter.cfg'
)
dataset1
=
ds
.
GeneratorDataset
(
source
=
generator_mc_p0
(),
column_names
=
[
"col1"
,
"col2"
])
dataset2
=
ds
.
GeneratorDataset
(
source
=
generator_mc_p1
(),
column_names
=
[
"col3"
,
"col4"
])
dataset_zip
=
ds
.
zip
((
dataset1
,
dataset2
))
...
...
@@ -404,7 +403,6 @@ def test_filter_by_generator_Partial0():
# test with row_data_buffer > 1
def
test_filter_by_generator_Partial1
():
ds
.
config
.
load
(
'../data/dataset/declient_filter.cfg'
)
dataset1
=
ds
.
GeneratorDataset
(
source
=
generator_mc_p0
(),
column_names
=
[
"col1"
,
"col2"
])
dataset2
=
ds
.
GeneratorDataset
(
source
=
generator_mc_p1
(),
column_names
=
[
"col3"
,
"col4"
])
dataset_zip
=
ds
.
zip
((
dataset1
,
dataset2
))
...
...
@@ -419,7 +417,6 @@ def test_filter_by_generator_Partial1():
# test with row_data_buffer > 1
def
test_filter_by_generator_Partial2
():
ds
.
config
.
load
(
'../data/dataset/declient_filter.cfg'
)
dataset1
=
ds
.
GeneratorDataset
(
source
=
generator_mc_p0
(),
column_names
=
[
"col1"
,
"col2"
])
dataset2
=
ds
.
GeneratorDataset
(
source
=
generator_mc_p1
(),
column_names
=
[
"col3"
,
"col4"
])
...
...
@@ -454,7 +451,6 @@ def generator_big(maxid=20):
# test with row_data_buffer > 1
def
test_filter_by_generator_Partial
():
ds
.
config
.
load
(
'../data/dataset/declient_filter.cfg'
)
dataset
=
ds
.
GeneratorDataset
(
source
=
generator_mc
(
99
),
column_names
=
[
"col1"
,
"col2"
])
dataset_s
=
dataset
.
shuffle
(
4
)
dataset_f1
=
dataset_s
.
filter
(
input_columns
=
[
"col1"
,
"col2"
],
predicate
=
filter_func_Partial
,
num_parallel_workers
=
1
)
...
...
@@ -473,7 +469,6 @@ def filter_func_cifar(col1, col2):
# test with cifar10
def
test_filte_case_dataset_cifar10
():
DATA_DIR_10
=
"../data/dataset/testCifar10Data"
ds
.
config
.
load
(
'../data/dataset/declient_filter.cfg'
)
dataset_c
=
ds
.
Cifar10Dataset
(
dataset_dir
=
DATA_DIR_10
,
num_samples
=
100000
,
shuffle
=
False
)
dataset_f1
=
dataset_c
.
filter
(
input_columns
=
[
"image"
,
"label"
],
predicate
=
filter_func_cifar
,
num_parallel_workers
=
1
)
for
item
in
dataset_f1
.
create_dict_iterator
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录