提交 cbd3e38f 编写于 作者: U Unknown 提交者: liutuo

revert merge

上级 982c865f
...@@ -64,10 +64,11 @@ TEST_F(AddnOpTest, CPUSimpleAdd3) { SimpleAdd3<DeviceType::CPU>(); } ...@@ -64,10 +64,11 @@ TEST_F(AddnOpTest, CPUSimpleAdd3) { SimpleAdd3<DeviceType::CPU>(); }
template <DeviceType D> template <DeviceType D>
void RandomTest() { void RandomTest() {
testing::internal::LogToStderr(); testing::internal::LogToStderr();
static unsigned int seed = time(NULL); srand(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);
......
...@@ -77,9 +77,10 @@ TEST_F(BatchNormOpTest, SimpleCPU) { Simple<DeviceType::CPU>(); } ...@@ -77,9 +77,10 @@ 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 = time(NULL); static unsigned int seed = 123;
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;
...@@ -149,8 +150,10 @@ TEST_F(BatchNormOpTest, SimpleRandomOPENCL) { ...@@ -149,8 +150,10 @@ 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 = time(NULL); static unsigned int seed = 123;
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;
...@@ -221,8 +224,10 @@ TEST_F(BatchNormOpTest, SimpleRandomHalfOPENCL) { ...@@ -221,8 +224,10 @@ 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 = time(NULL); static unsigned int seed = 123;
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;
...@@ -292,8 +297,10 @@ TEST_F(BatchNormOpTest, ComplexRandomOPENCL) { ...@@ -292,8 +297,10 @@ 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 = time(NULL); static unsigned int seed = 123;
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;
......
...@@ -62,8 +62,10 @@ TEST_F(BiasAddOpTest, BiasAddSimpleOPENCL) { ...@@ -62,8 +62,10 @@ 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 = time(NULL); static unsigned int seed = 123;
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;
...@@ -111,8 +113,10 @@ TEST_F(BiasAddOpTest, SimpleRandomOPENCL) { ...@@ -111,8 +113,10 @@ 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 = time(NULL); static unsigned int seed = 123;
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;
......
...@@ -92,7 +92,8 @@ TEST_F(ConcatOpTest, CPUSimpleVertical) { ...@@ -92,7 +92,8 @@ TEST_F(ConcatOpTest, CPUSimpleVertical) {
} }
TEST_F(ConcatOpTest, CPURandom) { TEST_F(ConcatOpTest, CPURandom) {
static unsigned int seed = time(nullptr); // srand(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;
......
...@@ -351,9 +351,10 @@ static void TestComplexConvNxNS12(const std::vector<index_t> &shape, ...@@ -351,9 +351,10 @@ 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 = time(NULL); static unsigned int seed = 123;
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];
......
...@@ -207,8 +207,10 @@ void TestNxNS12(const index_t height, const index_t width) { ...@@ -207,8 +207,10 @@ 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 = time(NULL); static unsigned int seed = 123;
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;
......
...@@ -174,8 +174,10 @@ width}); ...@@ -174,8 +174,10 @@ width});
*/ */
TEST_F(FoldedBatchNormOpTest, SimpleRandomOPENCL) { TEST_F(FoldedBatchNormOpTest, SimpleRandomOPENCL) {
// srand(time(NULL));
// generate random input // generate random input
static unsigned int seed = time(NULL); static unsigned int seed = 123;
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;
...@@ -228,8 +230,9 @@ TEST_F(FoldedBatchNormOpTest, SimpleRandomOPENCL) { ...@@ -228,8 +230,9 @@ 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 = time(NULL); static unsigned int seed = 123;
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;
...@@ -283,8 +286,9 @@ TEST_F(FoldedBatchNormOpTest, SimpleRandomHalfOPENCL) { ...@@ -283,8 +286,9 @@ 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;
...@@ -336,8 +340,10 @@ TEST_F(FoldedBatchNormOpTest, ComplexRandomOPENCL) { ...@@ -336,8 +340,10 @@ 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 = time(NULL); static unsigned int seed = 123;
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;
......
...@@ -278,9 +278,10 @@ static void TestComplexConvNxNS12(const std::vector<index_t> &shape) { ...@@ -278,9 +278,10 @@ 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 = time(NULL); static unsigned int seed = 123;
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];
...@@ -354,9 +355,10 @@ static void TestHalfComplexConvNxNS12(const std::vector<index_t> &shape) { ...@@ -354,9 +355,10 @@ 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 = time(NULL); static unsigned int seed = 123;
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];
......
...@@ -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 = time(NULL); static unsigned int seed = 123;
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;
......
...@@ -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 = time(NULL); static unsigned int seed = 123;
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.
先完成此消息的编辑!
想要评论请 注册