Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
39cdee0e
Commit
39cdee0e
authored
May 25, 2019
by
Robert Kimball
Committed by
Scott Cyphers
May 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update a few files to build on windows (#2974)
* update a few files to build on windows * more fixes
parent
0c813cf2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
77 deletions
+82
-77
backend_fused_op.in.cpp
test/backend_fused_op.in.cpp
+20
-20
backend_gather.in.cpp
test/backend_gather.in.cpp
+40
-35
cpu_test.cpp
test/cpu_test.cpp
+19
-19
serialize.cpp
test/serialize.cpp
+3
-3
No files found.
test/backend_fused_op.in.cpp
View file @
39cdee0e
...
@@ -461,18 +461,18 @@ NGRAPH_TEST(${BACKEND_NAME}, normalize_across_chw_scalar_scale_2d)
...
@@ -461,18 +461,18 @@ NGRAPH_TEST(${BACKEND_NAME}, normalize_across_chw_scalar_scale_2d)
test_case
.
add_input
<
float
>
({
2.
f
});
test_case
.
add_input
<
float
>
({
2.
f
});
test_case
.
add_expected_output
<
float
>
(
data_shape
,
test_case
.
add_expected_output
<
float
>
(
data_shape
,
{
0.07844645
,
{
0.07844645
f
,
0.15689291
,
0.15689291
f
,
0.23533936
,
0.23533936
f
,
0.31378582
,
0.31378582
f
,
0.39223227
,
0.39223227
f
,
0.47067872
,
0.47067872
f
,
0.54912518
,
0.54912518
f
,
0.62757163
,
0.62757163
f
,
0.70601809
,
0.70601809
f
,
0.78446454
,
0.78446454
f
,
0.86291099
,
0.86291099
f
,
0.94135745
});
0.94135745
f
});
test_case
.
run
();
test_case
.
run
();
}
}
...
@@ -498,10 +498,10 @@ NGRAPH_TEST(${BACKEND_NAME}, normalize_across_chw_w_scale)
...
@@ -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_input
<
float
>
({
2.
f
,
3.
f
});
test_case
.
add_expected_output
<
float
>
(
test_case
.
add_expected_output
<
float
>
(
data_shape
,
{
0.02857143
,
0.05714286
,
0.08571429
,
0.11428571
,
0.14285714
,
0.17142857
,
data_shape
,
{
0.02857143
f
,
0.05714286
f
,
0.08571429
f
,
0.11428571
f
,
0.14285714
f
,
0.17142857
f
,
0.2
,
0.22857143
,
0.25714286
,
0.28571429
,
0.31428571
,
0.34285714
,
0.2
f
,
0.22857143
f
,
0.25714286
f
,
0.28571429
f
,
0.31428571
f
,
0.34285714
f
,
0.55714286
,
0.6
,
0.64285714
,
0.68571429
,
0.72857143
,
0.77142857
,
0.55714286
f
,
0.6
f
,
0.64285714
f
,
0.68571429
f
,
0.72857143
f
,
0.77142857
f
,
0.81428571
,
0.85714286
,
0.9
,
0.94285714
,
0.98571429
,
1.02857143
});
0.81428571
f
,
0.85714286
f
,
0.9
f
,
0.94285714
f
,
0.98571429
f
,
1.02857143
f
});
test_case
.
run
();
test_case
.
run
();
}
}
...
@@ -528,10 +528,10 @@ NGRAPH_TEST(DISABLED_${BACKEND_NAME}, normalize_across_hw_w_scale)
...
@@ -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_input
<
float
>
({
2.
f
,
3.
f
});
test_case
.
add_expected_output
<
float
>
(
test_case
.
add_expected_output
<
float
>
(
data_shape
,
{
0.07844646
,
0.15689291
,
0.23533936
,
0.31378582
,
0.39223227
,
0.47067872
,
data_shape
,
{
0.07844646
f
,
0.15689291
f
,
0.23533936
f
,
0.31378582
f
,
0.39223227
f
,
0.47067872
f
,
0.5491252
,
0.62757164
,
0.7060181
,
0.78446454
,
0.862911
,
0.94135743
,
0.5491252
f
,
0.62757164
f
,
0.7060181
f
,
0.78446454
f
,
0.862911
f
,
0.94135743
f
,
0.5982327
,
0.64425063
,
0.6902685
,
0.7362864
,
0.7823043
,
0.8283222
,
0.5982327
f
,
0.64425063
f
,
0.6902685
f
,
0.7362864
f
,
0.7823043
f
,
0.8283222
f
,
0.87434006
,
0.920358
,
0.9663758
,
1.0123938
,
1.0584116
,
1.1044296
});
0.87434006
f
,
0.920358
f
,
0.9663758
f
,
1.0123938
f
,
1.0584116
f
,
1.1044296
f
});
test_case
.
run
();
test_case
.
run
();
}
}
...
...
test/backend_gather.in.cpp
View file @
39cdee0e
...
@@ -50,14 +50,14 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis)
...
@@ -50,14 +50,14 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis)
// Create some tensors for input/output
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
2.0
f
,
2.1
f
,
3.0
f
,
3.1
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
1
,
1
,
2
});
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
1
,
1
,
2
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
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.0
f
,
1.1
f
,
2.0
f
,
2.1
f
,
2.0
f
,
2.1
f
,
3.0
f
,
3.1
f
}),
read_vector
<
float
>
(
result
),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
MIN_FLOAT_TOLERANCE_BITS
));
}
}
...
@@ -76,7 +76,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices_no_axis)
...
@@ -76,7 +76,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices_no_axis)
// Create some tensors for input/output
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
2.0
f
,
2.1
f
,
3.0
f
,
3.1
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
1
});
copy_data
(
i
,
vector
<
int32_t
>
{
1
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
...
@@ -84,7 +84,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices_no_axis)
...
@@ -84,7 +84,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices_no_axis)
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
c
->
call_with_validate
({
result
},
{
p
,
i
});
EXPECT_TRUE
(
test
::
all_close_f
(
EXPECT_TRUE
(
test
::
all_close_f
(
(
vector
<
float
>
{
2.0
,
2.1
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
(
vector
<
float
>
{
2.0
f
,
2.1
f
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
}
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather
)
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather
)
...
@@ -101,14 +101,14 @@ NGRAPH_TEST(${BACKEND_NAME}, gather)
...
@@ -101,14 +101,14 @@ NGRAPH_TEST(${BACKEND_NAME}, gather)
// Create some tensors for input/output
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
1.2
f
,
2.0
f
,
2.1
f
,
2.2
f
,
3.0
f
,
3.1
f
,
3.2
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
2
});
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
2
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
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.0
f
,
1.2
f
,
2.0
f
,
2.2
f
,
3.0
f
,
3.2
f
}),
read_vector
<
float
>
(
result
),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
MIN_FLOAT_TOLERANCE_BITS
));
}
}
...
@@ -127,7 +127,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices)
...
@@ -127,7 +127,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices)
// Create some tensors for input/output
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
1.2
f
,
2.0
f
,
2.1
f
,
2.2
f
,
3.0
f
,
3.1
f
,
3.2
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
0
});
copy_data
(
i
,
vector
<
int32_t
>
{
0
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
...
@@ -135,7 +135,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices)
...
@@ -135,7 +135,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices)
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
c
->
call_with_validate
({
result
},
{
p
,
i
});
EXPECT_TRUE
(
test
::
all_close_f
(
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.0
f
,
2.0
f
,
3.0
f
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
}
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_single_indices
)
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_single_indices
)
...
@@ -152,7 +152,7 @@ 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
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
1.2
f
,
1.3
f
,
1.4
f
,
1.5
f
,
1.6
f
,
1.7
f
,
1.8
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
1
,
2
});
copy_data
(
i
,
vector
<
int32_t
>
{
1
,
2
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
...
@@ -160,7 +160,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_single_indices)
...
@@ -160,7 +160,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_single_indices)
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
c
->
call_with_validate
({
result
},
{
p
,
i
});
EXPECT_TRUE
(
test
::
all_close_f
(
EXPECT_TRUE
(
test
::
all_close_f
(
(
vector
<
float
>
{
1.5
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
(
vector
<
float
>
{
1.5
f
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
}
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_scalar_from_2d
)
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_scalar_from_2d
)
...
@@ -177,7 +177,7 @@ 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
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
1.2
f
,
1.3
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
0
,
1
,
1
});
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
0
,
1
,
1
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
...
@@ -185,7 +185,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_scalar_from_2d)
...
@@ -185,7 +185,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_scalar_from_2d)
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
c
->
call_with_validate
({
result
},
{
p
,
i
});
EXPECT_TRUE
(
test
::
all_close_f
(
EXPECT_TRUE
(
test
::
all_close_f
(
(
vector
<
float
>
{
1.0
,
1.3
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
(
vector
<
float
>
{
1.0
f
,
1.3
f
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
}
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_1d_from_2d
)
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_1d_from_2d
)
...
@@ -202,15 +202,16 @@ 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
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
1.2
f
,
1.3
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
1
,
0
});
copy_data
(
i
,
vector
<
int32_t
>
{
1
,
0
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
c
->
call_with_validate
({
result
},
{
p
,
i
});
EXPECT_TRUE
(
test
::
all_close_f
(
EXPECT_TRUE
(
test
::
all_close_f
((
vector
<
float
>
{
1.2
f
,
1.3
f
,
1.0
f
,
1.1
f
}),
(
vector
<
float
>
{
1.2
,
1.3
,
1.0
,
1.1
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
}
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_scalar_from_3d
)
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_scalar_from_3d
)
...
@@ -227,7 +228,7 @@ 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
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
1.2
f
,
1.3
f
,
2.0
f
,
2.1
f
,
2.2
f
,
2.3
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
0
,
1
,
1
,
0
,
1
});
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
0
,
1
,
1
,
0
,
1
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
...
@@ -235,7 +236,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_scalar_from_3d)
...
@@ -235,7 +236,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_scalar_from_3d)
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
c
->
call_with_validate
({
result
},
{
p
,
i
});
EXPECT_TRUE
(
test
::
all_close_f
(
EXPECT_TRUE
(
test
::
all_close_f
(
(
vector
<
float
>
{
1.1
,
2.1
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
(
vector
<
float
>
{
1.1
f
,
2.1
f
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
}
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_1d_from_3d
)
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_1d_from_3d
)
...
@@ -252,15 +253,16 @@ 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
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
1.2
f
,
1.3
f
,
2.0
f
,
2.1
f
,
2.2
f
,
2.3
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
1
,
1
,
0
});
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
1
,
1
,
0
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
c
->
call_with_validate
({
result
},
{
p
,
i
});
EXPECT_TRUE
(
test
::
all_close_f
(
EXPECT_TRUE
(
test
::
all_close_f
((
vector
<
float
>
{
1.2
f
,
1.3
f
,
2.0
f
,
2.1
f
}),
(
vector
<
float
>
{
1.2
,
1.3
,
2.0
,
2.1
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
}
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_2d_from_3d
)
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_2d_from_3d
)
...
@@ -277,15 +279,16 @@ 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
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
1.2
f
,
1.3
f
,
2.0
f
,
2.1
f
,
2.2
f
,
2.3
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
1
});
copy_data
(
i
,
vector
<
int32_t
>
{
1
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
c
->
call_with_validate
({
result
},
{
p
,
i
});
EXPECT_TRUE
(
test
::
all_close_f
(
EXPECT_TRUE
(
test
::
all_close_f
((
vector
<
float
>
{
2.0
f
,
2.1
f
,
2.2
f
,
2.3
f
}),
(
vector
<
float
>
{
2.0
,
2.1
,
2.2
,
2.3
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
}
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_batch_scalar_from_2d
)
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_batch_scalar_from_2d
)
...
@@ -302,7 +305,7 @@ 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
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
1.2
f
,
1.3
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
0
,
0
,
1
});
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
0
,
0
,
1
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
...
@@ -310,7 +313,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_scalar_from_2d)
...
@@ -310,7 +313,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_scalar_from_2d)
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
c
->
call_with_validate
({
result
},
{
p
,
i
});
EXPECT_TRUE
(
test
::
all_close_f
(
EXPECT_TRUE
(
test
::
all_close_f
(
(
vector
<
float
>
{
1.0
,
1.1
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
(
vector
<
float
>
{
1.0
f
,
1.1
f
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
}
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_batch_1d_from_2d
)
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_batch_1d_from_2d
)
...
@@ -327,15 +330,16 @@ 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
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
1.2
f
,
1.3
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
1
,
0
});
copy_data
(
i
,
vector
<
int32_t
>
{
1
,
0
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
c
->
call_with_validate
({
result
},
{
p
,
i
});
EXPECT_TRUE
(
test
::
all_close_f
(
EXPECT_TRUE
(
test
::
all_close_f
((
vector
<
float
>
{
1.2
f
,
1.3
f
,
1.0
f
,
1.1
f
}),
(
vector
<
float
>
{
1.2
,
1.3
,
1.0
,
1.1
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
}
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_batch_scalar_from_3d
)
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_batch_scalar_from_3d
)
...
@@ -352,15 +356,16 @@ 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
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
1.2
f
,
1.3
f
,
2.0
f
,
2.1
f
,
2.2
f
,
2.3
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
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
});
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
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
c
->
call_with_validate
({
result
},
{
p
,
i
});
EXPECT_TRUE
(
test
::
all_close_f
(
EXPECT_TRUE
(
test
::
all_close_f
((
vector
<
float
>
{
1.1
f
,
2.1
f
,
1.3
f
,
2.2
f
}),
(
vector
<
float
>
{
1.1
,
2.1
,
1.3
,
2.2
}),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
}
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_batch_1d_from_3d
)
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
gather_nd_batch_1d_from_3d
)
...
@@ -377,14 +382,14 @@ 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
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
1.2
f
,
1.3
f
,
2.0
f
,
2.1
f
,
2.2
f
,
2.3
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
1
,
1
,
0
,
0
,
0
,
1
,
1
});
copy_data
(
i
,
vector
<
int32_t
>
{
0
,
1
,
1
,
0
,
0
,
0
,
1
,
1
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
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.2
f
,
1.3
f
,
2.0
f
,
2.1
f
,
1.0
f
,
1.1
f
,
2.2
f
,
2.3
f
}),
read_vector
<
float
>
(
result
),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
MIN_FLOAT_TOLERANCE_BITS
));
}
}
...
@@ -403,14 +408,14 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_2d_from_3d)
...
@@ -403,14 +408,14 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_2d_from_3d)
// Create some tensors for input/output
// Create some tensors for input/output
auto
p
=
backend
->
create_tensor
(
element
::
f32
,
params_shape
);
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.0
f
,
1.1
f
,
1.2
f
,
1.3
f
,
2.0
f
,
2.1
f
,
2.2
f
,
2.3
f
});
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
auto
i
=
backend
->
create_tensor
(
element
::
i32
,
indices_shape
);
copy_data
(
i
,
vector
<
int32_t
>
{
1
,
0
});
copy_data
(
i
,
vector
<
int32_t
>
{
1
,
0
});
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
out_shape
);
auto
c
=
backend
->
compile
(
f
);
auto
c
=
backend
->
compile
(
f
);
c
->
call_with_validate
({
result
},
{
p
,
i
});
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.0
f
,
2.1
f
,
2.2
f
,
2.3
f
,
1.0
f
,
1.1
f
,
1.2
f
,
1.3
f
}),
read_vector
<
float
>
(
result
),
read_vector
<
float
>
(
result
),
MIN_FLOAT_TOLERANCE_BITS
));
MIN_FLOAT_TOLERANCE_BITS
));
}
}
...
...
test/cpu_test.cpp
View file @
39cdee0e
...
@@ -1516,25 +1516,25 @@ TEST(cpu_test, max_pool_with_indices_bprop_2d_2channel_2image)
...
@@ -1516,25 +1516,25 @@ TEST(cpu_test, max_pool_with_indices_bprop_2d_2channel_2image)
auto
d
=
backend
->
create_tensor
(
element
::
f32
,
shape_i
);
auto
d
=
backend
->
create_tensor
(
element
::
f32
,
shape_i
);
copy_data
(
d
,
copy_data
(
d
,
test
::
NDArray
<
float
,
4
>
({{{{
0.3
,
0.3
,
0.2
},
// img 0 chan 0
test
::
NDArray
<
float
,
4
>
({{{{
0.3
f
,
0.3
f
,
0.2
f
},
// img 0 chan 0
{
0.3
,
0.3
,
0.2
},
{
0.3
f
,
0.3
f
,
0.2
f
},
{
0.2
,
0.1
,
0.2
},
{
0.2
f
,
0.1
f
,
0.2
f
},
{
0.2
,
0.2
,
0.2
}},
{
0.2
f
,
0.2
f
,
0.2
f
}},
{{
0.3
,
0.3
,
0.3
},
// img 0 chan 1
{{
0.3
f
,
0.3
f
,
0.3
f
},
// img 0 chan 1
{
0.3
,
0.3
,
0.3
},
{
0.3
f
,
0.3
f
,
0.3
f
},
{
0.3
,
0.1
,
0.2
},
{
0.3
f
,
0.1
f
,
0.2
f
},
{
0.3
,
0.1
,
0.4
}}},
{
0.3
f
,
0.1
f
,
0.4
f
}}},
{{{
0.2
,
0.2
,
0.2
},
// img 1 chan 0
{{{
0.2
f
,
0.2
f
,
0.2
f
},
// img 1 chan 0
{
0.2
,
0.2
,
0.3
},
{
0.2
f
,
0.2
f
,
0.3
f
},
{
0.2
,
0.3
,
0.3
},
{
0.2
f
,
0.3
f
,
0.3
f
},
{
0.2
,
0.3
,
0.3
}},
{
0.2
f
,
0.3
f
,
0.3
f
}},
{{
0.2
,
0.2
,
0.1
},
// img 1 chan 1
{{
0.2
f
,
0.2
f
,
0.1
f
},
// img 1 chan 1
{
0.2
,
0.2
,
0.2
},
{
0.2
f
,
0.2
f
,
0.2
f
},
{
0.2
,
0.2
,
0.2
},
{
0.2
f
,
0.2
f
,
0.2
f
},
{
0.1
,
0.1
,
0.2
}}}})
{
0.1
f
,
0.1
f
,
0.2
f
}}}})
.
get_vector
());
.
get_vector
());
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
shape_a
);
auto
result
=
backend
->
create_tensor
(
element
::
f32
,
shape_a
);
...
...
test/serialize.cpp
View file @
39cdee0e
...
@@ -261,9 +261,9 @@ TEST(serialize, passthrough)
...
@@ -261,9 +261,9 @@ TEST(serialize, passthrough)
TEST
(
serialize
,
constant_infinity_nan
)
TEST
(
serialize
,
constant_infinity_nan
)
{
{
vector
<
float
>
a_data
{
123
,
456
,
INFINITY
,
-
INFINITY
,
NAN
};
vector
<
float
>
a_data
{
123
.
f
,
456.
f
,
INFINITY
,
-
INFINITY
,
NAN
};
vector
<
float
>
b_data
{
5
,
5
,
5
,
5
,
5
,
5
};
vector
<
float
>
b_data
{
5
.
f
,
5.
f
,
5.
f
,
5.
f
,
5.
f
,
5.
f
};
vector
<
float
>
c_data
{
0.05
,
0.05
,
0.05
,
0.05
,
0.05
,
0.05001
,
0.05
};
vector
<
float
>
c_data
{
0.05
f
,
0.05
f
,
0.05
f
,
0.05
f
,
0.05
f
,
0.05001
f
,
0.05
f
};
vector
<
int64_t
>
d_data
{
-
100
,
-
10
,
-
1
,
0
,
50
,
5000000000001
};
vector
<
int64_t
>
d_data
{
-
100
,
-
10
,
-
1
,
0
,
50
,
5000000000001
};
auto
A
=
make_shared
<
op
::
Constant
>
(
element
::
f32
,
Shape
{
5
},
a_data
);
auto
A
=
make_shared
<
op
::
Constant
>
(
element
::
f32
,
Shape
{
5
},
a_data
);
auto
B
=
make_shared
<
op
::
Constant
>
(
element
::
f32
,
Shape
{
6
},
b_data
);
auto
B
=
make_shared
<
op
::
Constant
>
(
element
::
f32
,
Shape
{
6
},
b_data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment