Commit 39cdee0e authored by Robert Kimball's avatar Robert Kimball Committed by Scott Cyphers

update a few files to build on windows (#2974)

* update a few files to build on windows

* more fixes
parent 0c813cf2
......@@ -461,18 +461,18 @@ NGRAPH_TEST(${BACKEND_NAME}, normalize_across_chw_scalar_scale_2d)
test_case.add_input<float>({2.f});
test_case.add_expected_output<float>(data_shape,
{0.07844645,
0.15689291,
0.23533936,
0.31378582,
0.39223227,
0.47067872,
0.54912518,
0.62757163,
0.70601809,
0.78446454,
0.86291099,
0.94135745});
{0.07844645f,
0.15689291f,
0.23533936f,
0.31378582f,
0.39223227f,
0.47067872f,
0.54912518f,
0.62757163f,
0.70601809f,
0.78446454f,
0.86291099f,
0.94135745f});
test_case.run();
}
......@@ -498,10 +498,10 @@ NGRAPH_TEST(${BACKEND_NAME}, normalize_across_chw_w_scale)
test_case.add_input<float>({2.f, 3.f});
test_case.add_expected_output<float>(
data_shape, {0.02857143, 0.05714286, 0.08571429, 0.11428571, 0.14285714, 0.17142857,
0.2, 0.22857143, 0.25714286, 0.28571429, 0.31428571, 0.34285714,
0.55714286, 0.6, 0.64285714, 0.68571429, 0.72857143, 0.77142857,
0.81428571, 0.85714286, 0.9, 0.94285714, 0.98571429, 1.02857143});
data_shape, {0.02857143f, 0.05714286f, 0.08571429f, 0.11428571f, 0.14285714f, 0.17142857f,
0.2f, 0.22857143f, 0.25714286f, 0.28571429f, 0.31428571f, 0.34285714f,
0.55714286f, 0.6f, 0.64285714f, 0.68571429f, 0.72857143f, 0.77142857f,
0.81428571f, 0.85714286f, 0.9f, 0.94285714f, 0.98571429f, 1.02857143f});
test_case.run();
}
......@@ -528,10 +528,10 @@ NGRAPH_TEST(DISABLED_${BACKEND_NAME}, normalize_across_hw_w_scale)
test_case.add_input<float>({2.f, 3.f});
test_case.add_expected_output<float>(
data_shape, {0.07844646, 0.15689291, 0.23533936, 0.31378582, 0.39223227, 0.47067872,
0.5491252, 0.62757164, 0.7060181, 0.78446454, 0.862911, 0.94135743,
0.5982327, 0.64425063, 0.6902685, 0.7362864, 0.7823043, 0.8283222,
0.87434006, 0.920358, 0.9663758, 1.0123938, 1.0584116, 1.1044296});
data_shape, {0.07844646f, 0.15689291f, 0.23533936f, 0.31378582f, 0.39223227f, 0.47067872f,
0.5491252f, 0.62757164f, 0.7060181f, 0.78446454f, 0.862911f, 0.94135743f,
0.5982327f, 0.64425063f, 0.6902685f, 0.7362864f, 0.7823043f, 0.8283222f,
0.87434006f, 0.920358f, 0.9663758f, 1.0123938f, 1.0584116f, 1.1044296f});
test_case.run();
}
......
......@@ -50,14 +50,14 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 2.0, 2.1, 3.0, 3.1});
copy_data(p, vector<float>{1.0f, 1.1f, 2.0f, 2.1f, 3.0f, 3.1f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{0, 1, 1, 2});
auto result = backend->create_tensor(element::f32, out_shape);
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f((vector<float>{1.0, 1.1, 2.0, 2.1, 2.0, 2.1, 3.0, 3.1}),
EXPECT_TRUE(test::all_close_f((vector<float>{1.0f, 1.1f, 2.0f, 2.1f, 2.0f, 2.1f, 3.0f, 3.1f}),
read_vector<float>(result),
MIN_FLOAT_TOLERANCE_BITS));
}
......@@ -76,7 +76,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices_no_axis)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 2.0, 2.1, 3.0, 3.1});
copy_data(p, vector<float>{1.0f, 1.1f, 2.0f, 2.1f, 3.0f, 3.1f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{1});
auto result = backend->create_tensor(element::f32, out_shape);
......@@ -84,7 +84,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices_no_axis)
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f(
(vector<float>{2.0, 2.1}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
(vector<float>{2.0f, 2.1f}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
}
NGRAPH_TEST(${BACKEND_NAME}, gather)
......@@ -101,14 +101,14 @@ NGRAPH_TEST(${BACKEND_NAME}, gather)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 1.2, 2.0, 2.1, 2.2, 3.0, 3.1, 3.2});
copy_data(p, vector<float>{1.0f, 1.1f, 1.2f, 2.0f, 2.1f, 2.2f, 3.0f, 3.1f, 3.2f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{0, 2});
auto result = backend->create_tensor(element::f32, out_shape);
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f((vector<float>{1.0, 1.2, 2.0, 2.2, 3.0, 3.2}),
EXPECT_TRUE(test::all_close_f((vector<float>{1.0f, 1.2f, 2.0f, 2.2f, 3.0f, 3.2f}),
read_vector<float>(result),
MIN_FLOAT_TOLERANCE_BITS));
}
......@@ -127,7 +127,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 1.2, 2.0, 2.1, 2.2, 3.0, 3.1, 3.2});
copy_data(p, vector<float>{1.0f, 1.1f, 1.2f, 2.0f, 2.1f, 2.2f, 3.0f, 3.1f, 3.2f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{0});
auto result = backend->create_tensor(element::f32, out_shape);
......@@ -135,7 +135,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices)
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f(
(vector<float>{1.0, 2.0, 3.0}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
(vector<float>{1.0f, 2.0f, 3.0f}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
}
NGRAPH_TEST(${BACKEND_NAME}, gather_nd_single_indices)
......@@ -152,7 +152,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_single_indices)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8});
copy_data(p, vector<float>{1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{1, 2});
auto result = backend->create_tensor(element::f32, out_shape);
......@@ -160,7 +160,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_single_indices)
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f(
(vector<float>{1.5}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
(vector<float>{1.5f}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
}
NGRAPH_TEST(${BACKEND_NAME}, gather_nd_scalar_from_2d)
......@@ -177,7 +177,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_scalar_from_2d)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 1.2, 1.3});
copy_data(p, vector<float>{1.0f, 1.1f, 1.2f, 1.3f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{0, 0, 1, 1});
auto result = backend->create_tensor(element::f32, out_shape);
......@@ -185,7 +185,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_scalar_from_2d)
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f(
(vector<float>{1.0, 1.3}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
(vector<float>{1.0f, 1.3f}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
}
NGRAPH_TEST(${BACKEND_NAME}, gather_nd_1d_from_2d)
......@@ -202,15 +202,16 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_1d_from_2d)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 1.2, 1.3});
copy_data(p, vector<float>{1.0f, 1.1f, 1.2f, 1.3f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{1, 0});
auto result = backend->create_tensor(element::f32, out_shape);
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f(
(vector<float>{1.2, 1.3, 1.0, 1.1}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
EXPECT_TRUE(test::all_close_f((vector<float>{1.2f, 1.3f, 1.0f, 1.1f}),
read_vector<float>(result),
MIN_FLOAT_TOLERANCE_BITS));
}
NGRAPH_TEST(${BACKEND_NAME}, gather_nd_scalar_from_3d)
......@@ -227,7 +228,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_scalar_from_3d)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 1.2, 1.3, 2.0, 2.1, 2.2, 2.3});
copy_data(p, vector<float>{1.0f, 1.1f, 1.2f, 1.3f, 2.0f, 2.1f, 2.2f, 2.3f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{0, 0, 1, 1, 0, 1});
auto result = backend->create_tensor(element::f32, out_shape);
......@@ -235,7 +236,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_scalar_from_3d)
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f(
(vector<float>{1.1, 2.1}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
(vector<float>{1.1f, 2.1f}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
}
NGRAPH_TEST(${BACKEND_NAME}, gather_nd_1d_from_3d)
......@@ -252,15 +253,16 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_1d_from_3d)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 1.2, 1.3, 2.0, 2.1, 2.2, 2.3});
copy_data(p, vector<float>{1.0f, 1.1f, 1.2f, 1.3f, 2.0f, 2.1f, 2.2f, 2.3f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{0, 1, 1, 0});
auto result = backend->create_tensor(element::f32, out_shape);
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f(
(vector<float>{1.2, 1.3, 2.0, 2.1}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
EXPECT_TRUE(test::all_close_f((vector<float>{1.2f, 1.3f, 2.0f, 2.1f}),
read_vector<float>(result),
MIN_FLOAT_TOLERANCE_BITS));
}
NGRAPH_TEST(${BACKEND_NAME}, gather_nd_2d_from_3d)
......@@ -277,15 +279,16 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_2d_from_3d)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 1.2, 1.3, 2.0, 2.1, 2.2, 2.3});
copy_data(p, vector<float>{1.0f, 1.1f, 1.2f, 1.3f, 2.0f, 2.1f, 2.2f, 2.3f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{1});
auto result = backend->create_tensor(element::f32, out_shape);
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f(
(vector<float>{2.0, 2.1, 2.2, 2.3}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
EXPECT_TRUE(test::all_close_f((vector<float>{2.0f, 2.1f, 2.2f, 2.3f}),
read_vector<float>(result),
MIN_FLOAT_TOLERANCE_BITS));
}
NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_scalar_from_2d)
......@@ -302,7 +305,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_scalar_from_2d)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 1.2, 1.3});
copy_data(p, vector<float>{1.0f, 1.1f, 1.2f, 1.3f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{0, 0, 0, 1});
auto result = backend->create_tensor(element::f32, out_shape);
......@@ -310,7 +313,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_scalar_from_2d)
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f(
(vector<float>{1.0, 1.1}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
(vector<float>{1.0f, 1.1f}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
}
NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_1d_from_2d)
......@@ -327,15 +330,16 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_1d_from_2d)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 1.2, 1.3});
copy_data(p, vector<float>{1.0f, 1.1f, 1.2f, 1.3f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{1, 0});
auto result = backend->create_tensor(element::f32, out_shape);
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f(
(vector<float>{1.2, 1.3, 1.0, 1.1}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
EXPECT_TRUE(test::all_close_f((vector<float>{1.2f, 1.3f, 1.0f, 1.1f}),
read_vector<float>(result),
MIN_FLOAT_TOLERANCE_BITS));
}
NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_scalar_from_3d)
......@@ -352,15 +356,16 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_scalar_from_3d)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 1.2, 1.3, 2.0, 2.1, 2.2, 2.3});
copy_data(p, vector<float>{1.0f, 1.1f, 1.2f, 1.3f, 2.0f, 2.1f, 2.2f, 2.3f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0});
auto result = backend->create_tensor(element::f32, out_shape);
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f(
(vector<float>{1.1, 2.1, 1.3, 2.2}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
EXPECT_TRUE(test::all_close_f((vector<float>{1.1f, 2.1f, 1.3f, 2.2f}),
read_vector<float>(result),
MIN_FLOAT_TOLERANCE_BITS));
}
NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_1d_from_3d)
......@@ -377,14 +382,14 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_1d_from_3d)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 1.2, 1.3, 2.0, 2.1, 2.2, 2.3});
copy_data(p, vector<float>{1.0f, 1.1f, 1.2f, 1.3f, 2.0f, 2.1f, 2.2f, 2.3f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{0, 1, 1, 0, 0, 0, 1, 1});
auto result = backend->create_tensor(element::f32, out_shape);
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f((vector<float>{1.2, 1.3, 2.0, 2.1, 1.0, 1.1, 2.2, 2.3}),
EXPECT_TRUE(test::all_close_f((vector<float>{1.2f, 1.3f, 2.0f, 2.1f, 1.0f, 1.1f, 2.2f, 2.3f}),
read_vector<float>(result),
MIN_FLOAT_TOLERANCE_BITS));
}
......@@ -403,14 +408,14 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_2d_from_3d)
// Create some tensors for input/output
auto p = backend->create_tensor(element::f32, params_shape);
copy_data(p, vector<float>{1.0, 1.1, 1.2, 1.3, 2.0, 2.1, 2.2, 2.3});
copy_data(p, vector<float>{1.0f, 1.1f, 1.2f, 1.3f, 2.0f, 2.1f, 2.2f, 2.3f});
auto i = backend->create_tensor(element::i32, indices_shape);
copy_data(i, vector<int32_t>{1, 0});
auto result = backend->create_tensor(element::f32, out_shape);
auto c = backend->compile(f);
c->call_with_validate({result}, {p, i});
EXPECT_TRUE(test::all_close_f((vector<float>{2.0, 2.1, 2.2, 2.3, 1.0, 1.1, 1.2, 1.3}),
EXPECT_TRUE(test::all_close_f((vector<float>{2.0f, 2.1f, 2.2f, 2.3f, 1.0f, 1.1f, 1.2f, 1.3f}),
read_vector<float>(result),
MIN_FLOAT_TOLERANCE_BITS));
}
......
......@@ -1516,25 +1516,25 @@ TEST(cpu_test, max_pool_with_indices_bprop_2d_2channel_2image)
auto d = backend->create_tensor(element::f32, shape_i);
copy_data(d,
test::NDArray<float, 4>({{{{0.3, 0.3, 0.2}, // img 0 chan 0
{0.3, 0.3, 0.2},
{0.2, 0.1, 0.2},
{0.2, 0.2, 0.2}},
{{0.3, 0.3, 0.3}, // img 0 chan 1
{0.3, 0.3, 0.3},
{0.3, 0.1, 0.2},
{0.3, 0.1, 0.4}}},
{{{0.2, 0.2, 0.2}, // img 1 chan 0
{0.2, 0.2, 0.3},
{0.2, 0.3, 0.3},
{0.2, 0.3, 0.3}},
{{0.2, 0.2, 0.1}, // img 1 chan 1
{0.2, 0.2, 0.2},
{0.2, 0.2, 0.2},
{0.1, 0.1, 0.2}}}})
test::NDArray<float, 4>({{{{0.3f, 0.3f, 0.2f}, // img 0 chan 0
{0.3f, 0.3f, 0.2f},
{0.2f, 0.1f, 0.2f},
{0.2f, 0.2f, 0.2f}},
{{0.3f, 0.3f, 0.3f}, // img 0 chan 1
{0.3f, 0.3f, 0.3f},
{0.3f, 0.1f, 0.2f},
{0.3f, 0.1f, 0.4f}}},
{{{0.2f, 0.2f, 0.2f}, // img 1 chan 0
{0.2f, 0.2f, 0.3f},
{0.2f, 0.3f, 0.3f},
{0.2f, 0.3f, 0.3f}},
{{0.2f, 0.2f, 0.1f}, // img 1 chan 1
{0.2f, 0.2f, 0.2f},
{0.2f, 0.2f, 0.2f},
{0.1f, 0.1f, 0.2f}}}})
.get_vector());
auto result = backend->create_tensor(element::f32, shape_a);
......
......@@ -261,9 +261,9 @@ TEST(serialize, passthrough)
TEST(serialize, constant_infinity_nan)
{
vector<float> a_data{123, 456, INFINITY, -INFINITY, NAN};
vector<float> b_data{5, 5, 5, 5, 5, 5};
vector<float> c_data{0.05, 0.05, 0.05, 0.05, 0.05, 0.05001, 0.05};
vector<float> a_data{123.f, 456.f, INFINITY, -INFINITY, NAN};
vector<float> b_data{5.f, 5.f, 5.f, 5.f, 5.f, 5.f};
vector<float> c_data{0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05001f, 0.05f};
vector<int64_t> d_data{-100, -10, -1, 0, 50, 5000000000001};
auto A = make_shared<op::Constant>(element::f32, Shape{5}, a_data);
auto B = make_shared<op::Constant>(element::f32, Shape{6}, b_data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment