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
3383743e
Commit
3383743e
authored
Oct 02, 2017
by
Yixing Lao
Committed by
Scott Cyphers
Oct 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add multiple retrive value test (#150)
parent
4fa75e5a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
+34
-2
execute.cpp
test/execute.cpp
+34
-2
No files found.
test/execute.cpp
View file @
3383743e
...
...
@@ -82,14 +82,46 @@ TEST(execute, test_abc_tuple)
(
*
cf
)({
abc
},
{
result_tuple
});
ASSERT_EQ
((
vector
<
float
>
{
54
,
80
,
110
,
144
}),
result
->
get_vector
());
(
*
cf
)({
bac
},
{
result_tuple
});
ASSERT_EQ
((
vector
<
float
>
{
54
,
80
,
110
,
144
}),
result
->
get_vector
());
(
*
cf
)({
acb
},
{
result_tuple
});
ASSERT_EQ
((
vector
<
float
>
{
50
,
72
,
98
,
128
}),
result
->
get_vector
());
}
// Multiple retrive values
TEST
(
execute
,
test_tuple_result
)
{
auto
shape
=
Shape
{
2
,
2
};
auto
A
=
make_shared
<
op
::
Parameter
>
(
element
::
Float32
::
element_type
(),
shape
);
auto
B
=
make_shared
<
op
::
Parameter
>
(
element
::
Float32
::
element_type
(),
shape
);
auto
C
=
make_shared
<
op
::
Parameter
>
(
element
::
Float32
::
element_type
(),
shape
);
auto
A_add_B
=
make_shared
<
op
::
Add
>
(
A
,
B
);
auto
A_add_B_mul_C
=
make_shared
<
op
::
Multiply
>
(
A_add_B
,
C
);
auto
f
=
make_shared
<
Function
>
(
make_shared
<
op
::
Tuple
>
(
Nodes
{
A_add_B
,
A_add_B_mul_C
}),
op
::
Parameters
{
A
,
B
,
C
});
auto
external
=
make_shared
<
ngraph
::
runtime
::
ExternalFunction
>
(
f
);
auto
cf
=
external
->
make_call_frame
();
auto
a
=
ngraph
::
runtime
::
make_tensor
<
element
::
Float32
>
(
shape
);
*
a
=
vector
<
float
>
{
1
,
2
,
3
,
4
};
auto
b
=
ngraph
::
runtime
::
make_tensor
<
element
::
Float32
>
(
shape
);
*
b
=
vector
<
float
>
{
5
,
6
,
7
,
8
};
auto
c
=
ngraph
::
runtime
::
make_tensor
<
element
::
Float32
>
(
shape
);
*
c
=
vector
<
float
>
{
9
,
10
,
11
,
12
};
auto
r0
=
ngraph
::
runtime
::
make_tensor
<
element
::
Float32
>
(
shape
);
auto
r1
=
ngraph
::
runtime
::
make_tensor
<
element
::
Float32
>
(
shape
);
auto
result_tuple
=
ngraph
::
runtime
::
make_tuple
({
r0
,
r1
});
(
*
cf
)({
a
,
b
,
c
},
{
result_tuple
});
ASSERT_EQ
((
vector
<
float
>
{
6
,
8
,
10
,
12
}),
r0
->
get_vector
());
ASSERT_EQ
((
vector
<
float
>
{
54
,
80
,
110
,
144
}),
r1
->
get_vector
());
}
TEST
(
execute
,
test_abs
)
{
auto
shape
=
Shape
{
2
,
2
};
...
...
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