Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
982c865f
Mace
项目概览
Xiaomi
/
Mace
通知
106
Star
40
Fork
27
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
982c865f
编写于
3月 19, 2018
作者:
U
Unknown
提交者:
liutuo
3月 19, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
srand
delete srand(time(NULL)); add rand_r(time(NULL))
上级
546f8a23
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
23 addition
and
47 deletion
+23
-47
mace/ops/addn_test.cc
mace/ops/addn_test.cc
+1
-2
mace/ops/batch_norm_test.cc
mace/ops/batch_norm_test.cc
+4
-11
mace/ops/bias_add_test.cc
mace/ops/bias_add_test.cc
+2
-6
mace/ops/concat_test.cc
mace/ops/concat_test.cc
+1
-2
mace/ops/conv_2d_test.cc
mace/ops/conv_2d_test.cc
+2
-3
mace/ops/depthwise_conv2d_test.cc
mace/ops/depthwise_conv2d_test.cc
+1
-3
mace/ops/folded_batch_norm_test.cc
mace/ops/folded_batch_norm_test.cc
+4
-10
mace/ops/fused_conv_2d_test.cc
mace/ops/fused_conv_2d_test.cc
+4
-6
mace/ops/resize_bilinear_test.cc
mace/ops/resize_bilinear_test.cc
+2
-2
mace/ops/slice_test.cc
mace/ops/slice_test.cc
+2
-2
未找到文件。
mace/ops/addn_test.cc
浏览文件 @
982c865f
...
@@ -64,11 +64,10 @@ TEST_F(AddnOpTest, CPUSimpleAdd3) { SimpleAdd3<DeviceType::CPU>(); }
...
@@ -64,11 +64,10 @@ TEST_F(AddnOpTest, CPUSimpleAdd3) { SimpleAdd3<DeviceType::CPU>(); }
template
<
DeviceType
D
>
template
<
DeviceType
D
>
void
RandomTest
()
{
void
RandomTest
()
{
testing
::
internal
::
LogToStderr
();
testing
::
internal
::
LogToStderr
();
s
rand
(
time
(
NULL
)
);
s
tatic
unsigned
int
seed
=
time
(
NULL
);
for
(
int
round
=
0
;
round
<
10
;
++
round
)
{
for
(
int
round
=
0
;
round
<
10
;
++
round
)
{
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
index_t
n
=
1
+
(
rand_r
(
&
seed
)
%
5
);
index_t
n
=
1
+
(
rand_r
(
&
seed
)
%
5
);
index_t
h
=
1
+
(
rand_r
(
&
seed
)
%
100
);
index_t
h
=
1
+
(
rand_r
(
&
seed
)
%
100
);
index_t
w
=
1
+
(
rand_r
(
&
seed
)
%
100
);
index_t
w
=
1
+
(
rand_r
(
&
seed
)
%
100
);
...
...
mace/ops/batch_norm_test.cc
浏览文件 @
982c865f
...
@@ -77,10 +77,9 @@ TEST_F(BatchNormOpTest, SimpleCPU) { Simple<DeviceType::CPU>(); }
...
@@ -77,10 +77,9 @@ TEST_F(BatchNormOpTest, SimpleCPU) { Simple<DeviceType::CPU>(); }
TEST_F
(
BatchNormOpTest
,
SimpleOPENCL
)
{
Simple
<
DeviceType
::
OPENCL
>
();
}
TEST_F
(
BatchNormOpTest
,
SimpleOPENCL
)
{
Simple
<
DeviceType
::
OPENCL
>
();
}
TEST_F
(
BatchNormOpTest
,
SimpleRandomOPENCL
)
{
TEST_F
(
BatchNormOpTest
,
SimpleRandomOPENCL
)
{
// srand(time(NULL));
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
height
=
64
;
index_t
height
=
64
;
...
@@ -150,10 +149,8 @@ TEST_F(BatchNormOpTest, SimpleRandomOPENCL) {
...
@@ -150,10 +149,8 @@ TEST_F(BatchNormOpTest, SimpleRandomOPENCL) {
}
}
TEST_F
(
BatchNormOpTest
,
SimpleRandomHalfOPENCL
)
{
TEST_F
(
BatchNormOpTest
,
SimpleRandomHalfOPENCL
)
{
// srand(time(NULL));
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
height
=
64
;
index_t
height
=
64
;
...
@@ -224,10 +221,8 @@ TEST_F(BatchNormOpTest, SimpleRandomHalfOPENCL) {
...
@@ -224,10 +221,8 @@ TEST_F(BatchNormOpTest, SimpleRandomHalfOPENCL) {
}
}
TEST_F
(
BatchNormOpTest
,
ComplexRandomOPENCL
)
{
TEST_F
(
BatchNormOpTest
,
ComplexRandomOPENCL
)
{
// srand(time(NULL));
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
height
=
103
;
index_t
height
=
103
;
...
@@ -297,10 +292,8 @@ TEST_F(BatchNormOpTest, ComplexRandomOPENCL) {
...
@@ -297,10 +292,8 @@ TEST_F(BatchNormOpTest, ComplexRandomOPENCL) {
}
}
TEST_F
(
BatchNormOpTest
,
ComplexRandomHalfOPENCL
)
{
TEST_F
(
BatchNormOpTest
,
ComplexRandomHalfOPENCL
)
{
// srand(time(NULL));
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
height
=
103
;
index_t
height
=
103
;
...
...
mace/ops/bias_add_test.cc
浏览文件 @
982c865f
...
@@ -62,10 +62,8 @@ TEST_F(BiasAddOpTest, BiasAddSimpleOPENCL) {
...
@@ -62,10 +62,8 @@ TEST_F(BiasAddOpTest, BiasAddSimpleOPENCL) {
}
}
TEST_F
(
BiasAddOpTest
,
SimpleRandomOPENCL
)
{
TEST_F
(
BiasAddOpTest
,
SimpleRandomOPENCL
)
{
// srand(time(NULL));
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
height
=
64
+
rand_r
(
&
seed
)
%
50
;
index_t
height
=
64
+
rand_r
(
&
seed
)
%
50
;
...
@@ -113,10 +111,8 @@ TEST_F(BiasAddOpTest, SimpleRandomOPENCL) {
...
@@ -113,10 +111,8 @@ TEST_F(BiasAddOpTest, SimpleRandomOPENCL) {
}
}
TEST_F
(
BiasAddOpTest
,
ComplexRandomOPENCL
)
{
TEST_F
(
BiasAddOpTest
,
ComplexRandomOPENCL
)
{
// srand(time(NULL));
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
height
=
103
+
rand_r
(
&
seed
)
%
100
;
index_t
height
=
103
+
rand_r
(
&
seed
)
%
100
;
...
...
mace/ops/concat_test.cc
浏览文件 @
982c865f
...
@@ -92,8 +92,7 @@ TEST_F(ConcatOpTest, CPUSimpleVertical) {
...
@@ -92,8 +92,7 @@ TEST_F(ConcatOpTest, CPUSimpleVertical) {
}
}
TEST_F
(
ConcatOpTest
,
CPURandom
)
{
TEST_F
(
ConcatOpTest
,
CPURandom
)
{
// srand(time(nullptr));
static
unsigned
int
seed
=
time
(
nullptr
);
static
unsigned
int
seed
=
123
;
int
dim
=
5
;
int
dim
=
5
;
int
num_inputs
=
2
+
rand_r
(
&
seed
)
%
10
;
int
num_inputs
=
2
+
rand_r
(
&
seed
)
%
10
;
int
axis
=
rand_r
(
&
seed
)
%
dim
;
int
axis
=
rand_r
(
&
seed
)
%
dim
;
...
...
mace/ops/conv_2d_test.cc
浏览文件 @
982c865f
...
@@ -351,10 +351,9 @@ static void TestComplexConvNxNS12(const std::vector<index_t> &shape,
...
@@ -351,10 +351,9 @@ static void TestComplexConvNxNS12(const std::vector<index_t> &shape,
testing
::
internal
::
LogToStderr
();
testing
::
internal
::
LogToStderr
();
auto
func
=
[
&
](
int
kernel_h
,
int
kernel_w
,
int
stride_h
,
int
stride_w
,
auto
func
=
[
&
](
int
kernel_h
,
int
kernel_w
,
int
stride_h
,
int
stride_w
,
Padding
type
)
{
Padding
type
)
{
// srand(time(NULL));
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
index_t
batch
=
3
+
(
rand_r
(
&
seed
)
%
10
);
index_t
batch
=
3
+
(
rand_r
(
&
seed
)
%
10
);
index_t
height
=
shape
[
0
];
index_t
height
=
shape
[
0
];
index_t
width
=
shape
[
1
];
index_t
width
=
shape
[
1
];
...
...
mace/ops/depthwise_conv2d_test.cc
浏览文件 @
982c865f
...
@@ -207,10 +207,8 @@ void TestNxNS12(const index_t height, const index_t width) {
...
@@ -207,10 +207,8 @@ void TestNxNS12(const index_t height, const index_t width) {
testing
::
internal
::
LogToStderr
();
testing
::
internal
::
LogToStderr
();
auto
func
=
[
&
](
int
kernel_h
,
int
kernel_w
,
int
stride_h
,
int
stride_w
,
auto
func
=
[
&
](
int
kernel_h
,
int
kernel_w
,
int
stride_h
,
int
stride_w
,
Padding
type
)
{
Padding
type
)
{
// srand(time(NULL));
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
5
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
5
;
index_t
input_channels
=
3
+
rand_r
(
&
seed
)
%
16
;
index_t
input_channels
=
3
+
rand_r
(
&
seed
)
%
16
;
index_t
multiplier
=
1
;
index_t
multiplier
=
1
;
...
...
mace/ops/folded_batch_norm_test.cc
浏览文件 @
982c865f
...
@@ -174,10 +174,8 @@ width});
...
@@ -174,10 +174,8 @@ width});
*/
*/
TEST_F
(
FoldedBatchNormOpTest
,
SimpleRandomOPENCL
)
{
TEST_F
(
FoldedBatchNormOpTest
,
SimpleRandomOPENCL
)
{
// srand(time(NULL));
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
height
=
64
;
index_t
height
=
64
;
...
@@ -230,9 +228,8 @@ TEST_F(FoldedBatchNormOpTest, SimpleRandomOPENCL) {
...
@@ -230,9 +228,8 @@ TEST_F(FoldedBatchNormOpTest, SimpleRandomOPENCL) {
}
}
TEST_F
(
FoldedBatchNormOpTest
,
SimpleRandomHalfOPENCL
)
{
TEST_F
(
FoldedBatchNormOpTest
,
SimpleRandomHalfOPENCL
)
{
// srand(time(NULL));
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
height
=
64
;
index_t
height
=
64
;
...
@@ -286,9 +283,8 @@ TEST_F(FoldedBatchNormOpTest, SimpleRandomHalfOPENCL) {
...
@@ -286,9 +283,8 @@ TEST_F(FoldedBatchNormOpTest, SimpleRandomHalfOPENCL) {
}
}
TEST_F
(
FoldedBatchNormOpTest
,
ComplexRandomOPENCL
)
{
TEST_F
(
FoldedBatchNormOpTest
,
ComplexRandomOPENCL
)
{
// srand(time(NULL));
static
unsigned
int
seed
=
123
;
// generate random input
// generate random input
static
unsigned
int
seed
=
time
(
NULL
);
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
height
=
103
;
index_t
height
=
103
;
...
@@ -340,10 +336,8 @@ TEST_F(FoldedBatchNormOpTest, ComplexRandomOPENCL) {
...
@@ -340,10 +336,8 @@ TEST_F(FoldedBatchNormOpTest, ComplexRandomOPENCL) {
}
}
TEST_F
(
FoldedBatchNormOpTest
,
ComplexRandomHalfOPENCL
)
{
TEST_F
(
FoldedBatchNormOpTest
,
ComplexRandomHalfOPENCL
)
{
// srand(time(NULL));
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
batch
=
1
+
rand_r
(
&
seed
)
%
10
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
channels
=
3
+
rand_r
(
&
seed
)
%
50
;
index_t
height
=
103
;
index_t
height
=
103
;
...
...
mace/ops/fused_conv_2d_test.cc
浏览文件 @
982c865f
...
@@ -278,10 +278,9 @@ static void TestComplexConvNxNS12(const std::vector<index_t> &shape) {
...
@@ -278,10 +278,9 @@ static void TestComplexConvNxNS12(const std::vector<index_t> &shape) {
testing
::
internal
::
LogToStderr
();
testing
::
internal
::
LogToStderr
();
auto
func
=
[
&
](
int
kernel_h
,
int
kernel_w
,
int
stride_h
,
int
stride_w
,
auto
func
=
[
&
](
int
kernel_h
,
int
kernel_w
,
int
stride_h
,
int
stride_w
,
Padding
type
)
{
Padding
type
)
{
// srand(time(NULL));
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
index_t
batch
=
3
+
(
rand_r
(
&
seed
)
%
10
);
index_t
batch
=
3
+
(
rand_r
(
&
seed
)
%
10
);
index_t
height
=
shape
[
0
];
index_t
height
=
shape
[
0
];
index_t
width
=
shape
[
1
];
index_t
width
=
shape
[
1
];
...
@@ -355,10 +354,9 @@ static void TestHalfComplexConvNxNS12(const std::vector<index_t> &shape) {
...
@@ -355,10 +354,9 @@ static void TestHalfComplexConvNxNS12(const std::vector<index_t> &shape) {
testing
::
internal
::
LogToStderr
();
testing
::
internal
::
LogToStderr
();
auto
func
=
[
&
](
int
kernel_h
,
int
kernel_w
,
int
stride_h
,
int
stride_w
,
auto
func
=
[
&
](
int
kernel_h
,
int
kernel_w
,
int
stride_h
,
int
stride_w
,
Padding
type
)
{
Padding
type
)
{
// srand(time(NULL));
// generate random input
// generate random input
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
index_t
batch
=
3
+
(
rand_r
(
&
seed
)
%
10
);
index_t
batch
=
3
+
(
rand_r
(
&
seed
)
%
10
);
index_t
height
=
shape
[
0
];
index_t
height
=
shape
[
0
];
index_t
width
=
shape
[
1
];
index_t
width
=
shape
[
1
];
...
...
mace/ops/resize_bilinear_test.cc
浏览文件 @
982c865f
...
@@ -65,9 +65,9 @@ TEST_F(ResizeBilinearTest, ResizeBilinearWAlignCorners) {
...
@@ -65,9 +65,9 @@ TEST_F(ResizeBilinearTest, ResizeBilinearWAlignCorners) {
template
<
DeviceType
D
>
template
<
DeviceType
D
>
void
TestRandomResizeBilinear
()
{
void
TestRandomResizeBilinear
()
{
// srand(time(nullptr));
testing
::
internal
::
LogToStderr
();
testing
::
internal
::
LogToStderr
();
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
for
(
int
round
=
0
;
round
<
10
;
++
round
)
{
for
(
int
round
=
0
;
round
<
10
;
++
round
)
{
int
batch
=
1
+
rand_r
(
&
seed
)
%
5
;
int
batch
=
1
+
rand_r
(
&
seed
)
%
5
;
int
channels
=
1
+
rand_r
(
&
seed
)
%
100
;
int
channels
=
1
+
rand_r
(
&
seed
)
%
100
;
...
...
mace/ops/slice_test.cc
浏览文件 @
982c865f
...
@@ -16,8 +16,8 @@ class SliceOpTest : public OpsTestBase {};
...
@@ -16,8 +16,8 @@ class SliceOpTest : public OpsTestBase {};
template
<
DeviceType
D
,
typename
T
>
template
<
DeviceType
D
,
typename
T
>
void
RandomTest
(
const
int
num_outputs
)
{
void
RandomTest
(
const
int
num_outputs
)
{
// srand(time(nullptr));
static
unsigned
int
seed
=
123
;
static
unsigned
int
seed
=
time
(
NULL
)
;
const
index_t
output_channels
=
4
*
(
1
+
rand_r
(
&
seed
)
%
10
);
const
index_t
output_channels
=
4
*
(
1
+
rand_r
(
&
seed
)
%
10
);
const
index_t
input_channels
=
num_outputs
*
output_channels
;
const
index_t
input_channels
=
num_outputs
*
output_channels
;
const
index_t
batch
=
3
+
(
rand_r
(
&
seed
)
%
10
);
const
index_t
batch
=
3
+
(
rand_r
(
&
seed
)
%
10
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录