Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
正统之独孤求败
mindspore
提交
e9e40b68
M
mindspore
项目概览
正统之独孤求败
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
0
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e9e40b68
编写于
5月 19, 2020
作者:
T
Tinazhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bug fix
上级
6cbde2b3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
3 deletion
+25
-3
mindspore/ccsrc/dataset/kernels/image/uniform_aug_op.cc
mindspore/ccsrc/dataset/kernels/image/uniform_aug_op.cc
+3
-3
tests/ut/python/dataset/test_uniform_augment.py
tests/ut/python/dataset/test_uniform_augment.py
+22
-0
未找到文件。
mindspore/ccsrc/dataset/kernels/image/uniform_aug_op.cc
浏览文件 @
e9e40b68
...
@@ -55,11 +55,11 @@ Status UniformAugOp::Compute(const std::vector<std::shared_ptr<Tensor>> &input,
...
@@ -55,11 +55,11 @@ Status UniformAugOp::Compute(const std::vector<std::shared_ptr<Tensor>> &input,
// apply C++ ops (note: python OPs are not accepted)
// apply C++ ops (note: python OPs are not accepted)
if
(
count
==
1
)
{
if
(
count
==
1
)
{
(
**
tensor_op
).
Compute
(
input
,
output
);
RETURN_IF_NOT_OK
((
**
tensor_op
).
Compute
(
input
,
output
)
);
}
else
if
(
count
%
2
==
0
)
{
}
else
if
(
count
%
2
==
0
)
{
(
**
tensor_op
).
Compute
(
*
output
,
even_out_ptr
);
RETURN_IF_NOT_OK
((
**
tensor_op
).
Compute
(
*
output
,
even_out_ptr
)
);
}
else
{
}
else
{
(
**
tensor_op
).
Compute
(
even_out
,
output
);
RETURN_IF_NOT_OK
((
**
tensor_op
).
Compute
(
even_out
,
output
)
);
}
}
count
++
;
count
++
;
}
}
...
...
tests/ut/python/dataset/test_uniform_augment.py
浏览文件 @
e9e40b68
...
@@ -226,6 +226,27 @@ def test_cpp_uniform_augment_exception_nonpositive_numops(num_ops=0):
...
@@ -226,6 +226,27 @@ def test_cpp_uniform_augment_exception_nonpositive_numops(num_ops=0):
logger
.
info
(
"Got an exception in DE: {}"
.
format
(
str
(
e
)))
logger
.
info
(
"Got an exception in DE: {}"
.
format
(
str
(
e
)))
assert
"num_ops"
in
str
(
e
)
assert
"num_ops"
in
str
(
e
)
def
test_cpp_uniform_augment_random_crop_ut
():
batch_size
=
2
cifar10_dir
=
"../data/dataset/testCifar10Data"
ds1
=
de
.
Cifar10Dataset
(
cifar10_dir
,
shuffle
=
False
)
# shape = [32,32,3]
transforms_ua
=
[
C
.
RandomCrop
(
size
=
[
224
,
224
]),
C
.
RandomHorizontalFlip
()
]
uni_aug
=
C
.
UniformAugment
(
operations
=
transforms_ua
,
num_ops
=
1
)
ds1
=
ds1
.
map
(
input_columns
=
"image"
,
operations
=
uni_aug
)
# apply DatasetOps
ds1
=
ds1
.
batch
(
batch_size
,
drop_remainder
=
True
,
num_parallel_workers
=
1
)
num_batches
=
0
try
:
for
data
in
ds1
.
create_dict_iterator
():
num_batches
+=
1
except
BaseException
as
e
:
assert
"Crop size"
in
str
(
e
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
test_uniform_augment
(
num_ops
=
1
)
test_uniform_augment
(
num_ops
=
1
)
...
@@ -233,3 +254,4 @@ if __name__ == "__main__":
...
@@ -233,3 +254,4 @@ if __name__ == "__main__":
test_cpp_uniform_augment_exception_pyops
(
num_ops
=
1
)
test_cpp_uniform_augment_exception_pyops
(
num_ops
=
1
)
test_cpp_uniform_augment_exception_large_numops
(
num_ops
=
6
)
test_cpp_uniform_augment_exception_large_numops
(
num_ops
=
6
)
test_cpp_uniform_augment_exception_nonpositive_numops
(
num_ops
=
0
)
test_cpp_uniform_augment_exception_nonpositive_numops
(
num_ops
=
0
)
test_cpp_uniform_augment_random_crop_ut
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录