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
c34bdf3b
Commit
c34bdf3b
authored
Jul 11, 2018
by
wsttiger
Browse files
Added a test for contiguous but not working
parent
3dc42104
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
test/miopen/miopen.cpp
test/miopen/miopen.cpp
+41
-0
No files found.
test/miopen/miopen.cpp
View file @
c34bdf3b
...
@@ -158,6 +158,45 @@ struct test_gemm
...
@@ -158,6 +158,45 @@ struct test_gemm
}
}
};
};
struct
test_contiguous
{
migraph
::
program
create_program
()
const
{
migraph
::
program
p
;
migraph
::
shape
s
{
migraph
::
shape
::
float_type
,
{
32
,
16
,
128
,
128
},
{
262144
,
128
,
1
,
16384
}};
auto
x
=
p
.
add_parameter
(
"x"
,
s
);
p
.
add_instruction
(
migraph
::
contiguous
{},
x
);
return
p
;
}
migraph
::
program
::
parameter_map
create_params
()
const
{
migraph
::
program
::
parameter_map
m
;
m
[
"x"
]
=
migraph
::
generate_argument
({
migraph
::
shape
::
float_type
,
{
32
,
16
,
128
,
128
}});
return
m
;
}
};
void
contiguous_test
()
{
migraph
::
shape
a_shape
{
migraph
::
shape
::
float_type
,
{
1
,
3
,
2
,
2
},
{
12
,
1
,
6
,
3
}};
std
::
vector
<
float
>
data
(
12
);
std
::
iota
(
data
.
begin
(),
data
.
end
(),
0
);
migraph
::
program
p
;
auto
l
=
p
.
add_literal
(
migraph
::
literal
{
a_shape
,
data
});
p
.
add_instruction
(
migraph
::
contiguous
{},
l
);
p
.
compile
(
migraph
::
miopen
::
miopen_target
{});
auto
result
=
p
.
eval
({});
std
::
vector
<
float
>
results_vector
(
12
);
result
.
visit
([
&
](
auto
output
)
{
results_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
std
::
vector
<
size_t
>
new_lens
=
{
1
,
3
,
2
,
2
};
std
::
vector
<
size_t
>
new_strides
=
{
12
,
1
,
6
,
3
};
std
::
vector
<
float
>
gold
=
{
0
,
3
,
6
,
9
,
1
,
4
,
7
,
10
,
2
,
5
,
8
,
11
};
EXPECT
(
test
::
verify_range
(
results_vector
,
gold
));
}
int
main
()
int
main
()
{
{
verify_program
<
test_add
>
();
verify_program
<
test_add
>
();
...
@@ -165,4 +204,6 @@ int main()
...
@@ -165,4 +204,6 @@ int main()
verify_program
<
test_conv_relu
>
();
verify_program
<
test_conv_relu
>
();
verify_program
<
test_conv_pooling
>
();
verify_program
<
test_conv_pooling
>
();
verify_program
<
test_gemm
>
();
verify_program
<
test_gemm
>
();
// verify_program<test_contiguous>();
contiguous_test
();
}
}
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