Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
b9e55afe
Commit
b9e55afe
authored
Jan 07, 2019
by
Paul
Browse files
Add more tests for compute overloads
parent
9b40d1f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
test/const_eval_test.cpp
test/const_eval_test.cpp
+41
-0
No files found.
test/const_eval_test.cpp
View file @
b9e55afe
...
...
@@ -33,6 +33,22 @@ struct sum_cf_op
}
};
struct
non_computable_cf
{
std
::
string
name
()
const
{
return
"non_computable"
;
}
migraphx
::
shape
compute_shape
(
std
::
vector
<
migraphx
::
shape
>
inputs
)
const
{
if
(
inputs
.
empty
())
return
{};
return
inputs
.
front
();
}
};
struct
test_context
{
void
finish
()
const
{}
};
TEST_CASE
(
literal_test
)
{
migraphx
::
program
p
;
...
...
@@ -75,4 +91,29 @@ TEST_CASE(op_test3)
CHECK
(
sum2
->
eval
().
empty
());
}
TEST_CASE
(
compute_op_c
)
{
migraphx
::
operation
op
=
sum_op
{};
auto
one
=
migraphx
::
literal
{
1
}.
get_argument
();
auto
two
=
migraphx
::
literal
{
2
}.
get_argument
();
EXPECT
(
test
::
throws
([
&
]
{
op
.
compute
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
}},
{
one
,
two
});
}));
}
TEST_CASE
(
compute_nop_c
)
{
migraphx
::
operation
op
=
non_computable_cf
{};
auto
one
=
migraphx
::
literal
{
1
}.
get_argument
();
auto
two
=
migraphx
::
literal
{
2
}.
get_argument
();
EXPECT
(
test
::
throws
([
&
]
{
op
.
compute
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
}},
{
one
,
two
});
}));
}
TEST_CASE
(
compute_nop_context
)
{
migraphx
::
operation
op
=
non_computable_cf
{};
auto
one
=
migraphx
::
literal
{
1
}.
get_argument
();
auto
two
=
migraphx
::
literal
{
2
}.
get_argument
();
migraphx
::
context
ctx
=
test_context
{};
EXPECT
(
test
::
throws
([
&
]
{
op
.
compute
(
ctx
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
}},
{
one
,
two
});
}));
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
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