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
4a39a0f7
Commit
4a39a0f7
authored
Oct 11, 2021
by
Shucai Xiao
Browse files
Merge branch 'develop' of github.com:ROCmSoftwarePlatform/AMDMIGraphX into add-conv_bn_add-test
parents
5564172e
bb827865
Changes
542
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
142 additions
and
59 deletions
+142
-59
test/verify/quant_dot_3args_3.cpp
test/verify/quant_dot_3args_3.cpp
+7
-6
test/verify/quant_dot_3args_4.cpp
test/verify/quant_dot_3args_4.cpp
+9
-7
test/verify/quant_dot_3args_5.cpp
test/verify/quant_dot_3args_5.cpp
+26
-0
test/verify/run_verify.cpp
test/verify/run_verify.cpp
+17
-13
test/verify/test_acosh.cpp
test/verify/test_acosh.cpp
+4
-4
test/verify/test_add_broadcast.cpp
test/verify/test_add_broadcast.cpp
+1
-1
test/verify/test_add_broadcast2.cpp
test/verify/test_add_broadcast2.cpp
+1
-1
test/verify/test_add_broadcast3.cpp
test/verify/test_add_broadcast3.cpp
+1
-1
test/verify/test_add_broadcast4.cpp
test/verify/test_add_broadcast4.cpp
+1
-1
test/verify/test_add_broadcast5.cpp
test/verify/test_add_broadcast5.cpp
+1
-1
test/verify/test_add_broadcast6.cpp
test/verify/test_add_broadcast6.cpp
+22
-0
test/verify/test_add_gelu.cpp
test/verify/test_add_gelu.cpp
+3
-3
test/verify/test_atanh.cpp
test/verify/test_atanh.cpp
+4
-4
test/verify/test_clip.cpp
test/verify/test_clip.cpp
+4
-4
test/verify/test_concat_pooling.cpp
test/verify/test_concat_pooling.cpp
+5
-5
test/verify/test_concat_transpose.cpp
test/verify/test_concat_transpose.cpp
+3
-2
test/verify/test_concat_transpose2.cpp
test/verify/test_concat_transpose2.cpp
+2
-1
test/verify/test_concat_transpose3.cpp
test/verify/test_concat_transpose3.cpp
+4
-2
test/verify/test_conv_bias_clipped_relu.cpp
test/verify/test_conv_bias_clipped_relu.cpp
+3
-3
test/verify/test_dequantizelinear.cpp
test/verify/test_dequantizelinear.cpp
+24
-0
No files found.
test/verify/quant_dot_3args_3.cpp
View file @
4a39a0f7
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/apply_alpha_beta.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
...
...
@@ -14,12 +15,12 @@ struct quant_dot_3args_3 : verify_program<quant_dot_3args_3>
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
int8_type
,
{
7
,
8
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
int32_type
,
{
2
,
7
}};
auto
l1
=
mm
->
add_parameter
(
"a"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"b"
,
m2_shape
);
auto
tl2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"dims"
,
{
1
,
0
}}}),
l2
);
auto
l3
=
mm
->
add_
parameter
(
"c"
,
m3_shape
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"quant_dot"
,
{{
"alpha"
,
2
},
{
"beta"
,
3
}}),
l1
,
tl
2
,
l
3
);
auto
l1
=
mm
->
add_parameter
(
"a"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"b"
,
m2_shape
);
auto
tl2
=
mm
->
add_
instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
l2
);
auto
l3
=
mm
->
add_parameter
(
"c"
,
m3_shape
);
migraphx
::
add_apply_alpha_beta
(
*
mm
,
{
l1
,
tl2
,
l3
},
migraphx
::
make_op
(
"quant_dot"
),
2
,
3
);
return
p
;
}
};
test/verify/quant_dot_3args_4.cpp
View file @
4a39a0f7
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/apply_alpha_beta.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
...
...
@@ -14,13 +15,14 @@ struct quant_dot_3args_4 : verify_program<quant_dot_3args_4>
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
int8_type
,
{
7
,
8
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
int32_type
,
{
2
,
7
}};
auto
l1
=
mm
->
add_parameter
(
"a"
,
m1_shape
);
auto
tl1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"dims"
,
{
1
,
0
}}}),
l1
);
auto
l2
=
mm
->
add_parameter
(
"b"
,
m2_shape
);
auto
tl2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"dims"
,
{
1
,
0
}}}),
l2
);
auto
l3
=
mm
->
add_parameter
(
"c"
,
m3_shape
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"quant_dot"
,
{{
"alpha"
,
3
},
{
"beta"
,
2
}}),
tl1
,
tl2
,
l3
);
auto
l1
=
mm
->
add_parameter
(
"a"
,
m1_shape
);
auto
tl1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
l1
);
auto
l2
=
mm
->
add_parameter
(
"b"
,
m2_shape
);
auto
tl2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
l2
);
auto
l3
=
mm
->
add_parameter
(
"c"
,
m3_shape
);
migraphx
::
add_apply_alpha_beta
(
*
mm
,
{
tl1
,
tl2
,
l3
},
migraphx
::
make_op
(
"quant_dot"
),
3
,
2
);
return
p
;
}
};
test/verify/quant_dot_3args_5.cpp
0 → 100644
View file @
4a39a0f7
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/apply_alpha_beta.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
quant_dot_3args_5
:
verify_program
<
quant_dot_3args_5
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
int8_type
,
{
6
,
2
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
int8_type
,
{
7
,
6
}};
auto
l1
=
mm
->
add_parameter
(
"a"
,
m1_shape
);
auto
tl1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
l1
);
auto
l2
=
mm
->
add_parameter
(
"b"
,
m2_shape
);
auto
tl2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
l2
);
migraphx
::
add_apply_alpha_beta
(
*
mm
,
{
tl1
,
tl2
},
migraphx
::
make_op
(
"quant_dot"
),
3
);
return
p
;
}
};
test/verify/run_verify.cpp
View file @
4a39a0f7
#include "run_verify.hpp"
#include "auto_print.hpp"
#include "verify_program.hpp"
#include "test.hpp"
#include <migraphx/env.hpp>
#include <migraphx/ref/target.hpp>
#include <migraphx/ranges.hpp>
...
...
@@ -26,7 +27,7 @@ std::future<typename std::result_of<Function()>::type> detach_async(Function&& f
std
::
packaged_task
<
result_type
()
>
task
(
std
::
forward
<
Function
>
(
f
));
auto
fut
=
task
.
get_future
();
std
::
thread
(
std
::
move
(
task
)).
detach
();
return
std
::
move
(
fut
)
;
return
fut
;
}
return
std
::
async
(
std
::
launch
::
deferred
,
std
::
forward
<
Function
>
(
f
));
}
...
...
@@ -98,7 +99,9 @@ std::pair<migraphx::program, std::vector<migraphx::argument>> run_verify::run_ta
for
(
auto
&&
x
:
p
.
get_parameter_shapes
())
{
if
(
m
.
count
(
x
.
first
)
==
0
)
{
m
[
x
.
first
]
=
t
.
allocate
(
x
.
second
);
}
}
validate
(
t
,
p
,
m
);
p
.
eval
(
m
);
...
...
@@ -108,7 +111,7 @@ std::pair<migraphx::program, std::vector<migraphx::argument>> run_verify::run_ta
std
::
transform
(
tres
.
begin
(),
tres
.
end
(),
res
.
begin
(),
[
&
](
auto
&
argu
)
{
return
t
.
copy_from
(
argu
);
});
return
std
::
make_pair
(
p
,
res
);
return
std
::
make_pair
(
std
::
move
(
p
)
,
res
);
}
template
<
class
T
>
...
...
@@ -121,7 +124,6 @@ void run_verify::verify(const std::string& name, const migraphx::program& p) con
{
using
result_future
=
std
::
future
<
std
::
pair
<
migraphx
::
program
,
std
::
vector
<
migraphx
::
argument
>>>
;
std
::
cout
<<
"[ RUN ] "
<<
name
<<
std
::
endl
;
auto_print
::
set_terminate_handler
(
name
);
std
::
vector
<
std
::
pair
<
std
::
string
,
result_future
>>
results
;
std
::
vector
<
std
::
string
>
target_names
;
...
...
@@ -180,25 +182,27 @@ void run_verify::verify(const std::string& name, const migraphx::program& p) con
std
::
cout
<<
tname
<<
":
\n
"
<<
cp
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
}
EXPECT
(
passed
);
}
}
std
::
set_terminate
(
nullptr
);
std
::
cout
<<
"[ COMPLETE ] "
<<
name
<<
std
::
endl
;
}
void
run_verify
::
run
(
int
argc
,
const
char
*
argv
[])
const
{
std
::
set
<
std
::
string
>
args
(
argv
+
1
,
argv
+
argc
);
const
auto
&
ps
=
get_programs
();
for
(
auto
&&
p
:
ps
)
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
std
::
string
>>
labels
;
for
(
auto
&&
p
:
get_programs
())
{
if
(
not
args
.
empty
())
{
if
(
args
.
count
(
p
.
name
)
==
0
and
args
.
count
(
p
.
section
)
==
0
)
continue
;
}
verify
(
p
.
name
,
p
.
get_program
());
labels
[
p
.
section
].
push_back
(
p
.
name
);
test
::
add_test_case
(
p
.
name
,
[
=
]
{
verify
(
p
.
name
,
p
.
get_program
());
});
}
test
::
driver
d
{};
d
.
get_case_names
=
[
&
](
const
std
::
string
&
name
)
->
std
::
vector
<
std
::
string
>
{
if
(
labels
.
count
(
name
)
>
0
)
return
labels
.
at
(
name
);
return
{
name
};
};
d
.
run
(
argc
,
argv
);
}
void
run_verify
::
disable_parallel_for
(
const
std
::
string
&
name
)
{
info
[
name
].
parallel
=
false
;
}
...
...
test/verify/test_acosh.cpp
View file @
4a39a0f7
...
...
@@ -14,10 +14,10 @@ struct test_acosh : verify_program<test_acosh>
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
min_val
=
mm
->
add_literal
(
1.1
f
);
auto
max_val
=
mm
->
add_literal
(
100.0
f
);
min_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"output_lens"
,
{
16
}}}),
min_val
);
max_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"output_lens"
,
{
16
}}}),
max_val
);
min_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
16
}}}),
min_val
);
max_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
16
}}}),
max_val
);
auto
cx
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"clip"
),
x
,
min_val
,
max_val
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"acosh"
),
cx
);
return
p
;
...
...
test/verify/test_add_broadcast.cpp
View file @
4a39a0f7
...
...
@@ -16,7 +16,7 @@ struct test_add_broadcast : verify_program<test_add_broadcast>
auto
x
=
mm
->
add_parameter
(
"x"
,
{
migraphx
::
shape
::
float_type
,
{
2
,
2
,
3
}});
auto
y
=
mm
->
add_parameter
(
"y"
,
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}});
auto
by
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
0
},
{
"
dim
s"
,
x
->
get_shape
().
lens
()}}),
y
);
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
0
},
{
"
out_len
s"
,
x
->
get_shape
().
lens
()}}),
y
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
by
);
return
p
;
}
...
...
test/verify/test_add_broadcast2.cpp
View file @
4a39a0f7
...
...
@@ -16,7 +16,7 @@ struct test_add_broadcast2 : verify_program<test_add_broadcast2>
auto
x
=
mm
->
add_parameter
(
"x"
,
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
}});
auto
y
=
mm
->
add_parameter
(
"y"
,
{
migraphx
::
shape
::
float_type
,
{
3
}});
auto
by
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
1
},
{
"
dim
s"
,
x
->
get_shape
().
lens
()}}),
y
);
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
1
},
{
"
out_len
s"
,
x
->
get_shape
().
lens
()}}),
y
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
by
);
return
p
;
}
...
...
test/verify/test_add_broadcast3.cpp
View file @
4a39a0f7
...
...
@@ -16,7 +16,7 @@ struct test_add_broadcast3 : verify_program<test_add_broadcast3>
auto
x
=
mm
->
add_parameter
(
"x"
,
{
migraphx
::
shape
::
float_type
,
{
2
,
4
,
5
}});
auto
y
=
mm
->
add_parameter
(
"y"
,
{
migraphx
::
shape
::
float_type
,
{
4
}});
auto
by
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
1
},
{
"
dim
s"
,
x
->
get_shape
().
lens
()}}),
y
);
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
1
},
{
"
out_len
s"
,
x
->
get_shape
().
lens
()}}),
y
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
by
);
return
p
;
}
...
...
test/verify/test_add_broadcast4.cpp
View file @
4a39a0f7
...
...
@@ -16,7 +16,7 @@ struct test_add_broadcast4 : verify_program<test_add_broadcast4>
auto
x
=
mm
->
add_parameter
(
"x"
,
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
5
}});
auto
y
=
mm
->
add_parameter
(
"y"
,
{
migraphx
::
shape
::
float_type
,
{
3
}});
auto
by
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
1
},
{
"
dim
s"
,
x
->
get_shape
().
lens
()}}),
y
);
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
1
},
{
"
out_len
s"
,
x
->
get_shape
().
lens
()}}),
y
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
by
);
return
p
;
}
...
...
test/verify/test_add_broadcast5.cpp
View file @
4a39a0f7
...
...
@@ -16,7 +16,7 @@ struct test_add_broadcast5 : verify_program<test_add_broadcast5>
auto
x
=
mm
->
add_parameter
(
"x"
,
{
migraphx
::
shape
::
float_type
,
{
2
,
4
,
8
}});
auto
y
=
mm
->
add_parameter
(
"y"
,
{
migraphx
::
shape
::
float_type
,
{
4
}});
auto
by
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
1
},
{
"
dim
s"
,
x
->
get_shape
().
lens
()}}),
y
);
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
1
},
{
"
out_len
s"
,
x
->
get_shape
().
lens
()}}),
y
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
by
);
return
p
;
}
...
...
test/verify/test_add_broadcast6.cpp
0 → 100644
View file @
4a39a0f7
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/instruction.hpp>
struct
test_add_broadcast6
:
verify_program
<
test_add_broadcast6
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
{
migraphx
::
shape
::
float_type
,
{
1
,
64
,
568
,
1328
}});
auto
y
=
mm
->
add_parameter
(
"y"
,
{
migraphx
::
shape
::
float_type
,
{
64
}});
auto
by
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
1
},
{
"out_lens"
,
{
1
,
64
,
568
,
1328
}}}),
y
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
by
);
return
p
;
}
};
test/verify/test_add_gelu.cpp
View file @
4a39a0f7
...
...
@@ -18,14 +18,14 @@ struct test_add_gelu : verify_program<test_add_gelu>
auto
sqrt2
=
mm
->
add_literal
(
static_cast
<
float
>
(
M_SQRT2
));
auto
add
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
y
);
auto
half_mbcast
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out
put
_lens"
,
input_lens
}}),
half
);
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
input_lens
}}),
half
);
auto
mul_half
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
add
,
half_mbcast
);
auto
sqrt2_mbcast
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out
put
_lens"
,
input_lens
}}),
sqrt2
);
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
input_lens
}}),
sqrt2
);
auto
div
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"div"
),
add
,
sqrt2_mbcast
);
auto
erf
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"erf"
),
div
);
auto
one_mbcast
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out
put
_lens"
,
input_lens
}}),
one
);
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
input_lens
}}),
one
);
auto
add_one
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
erf
,
one_mbcast
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
mul_half
,
add_one
);
return
p
;
...
...
test/verify/test_atanh.cpp
100755 → 100644
View file @
4a39a0f7
...
...
@@ -14,10 +14,10 @@ struct test_atanh : verify_program<test_atanh>
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
min_val
=
mm
->
add_literal
(
-
0.95
f
);
auto
max_val
=
mm
->
add_literal
(
0.95
f
);
min_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"output_lens"
,
{
16
}}}),
min_val
);
max_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"output_lens"
,
{
16
}}}),
max_val
);
min_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
16
}}}),
min_val
);
max_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
16
}}}),
max_val
);
auto
cx
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"clip"
),
x
,
min_val
,
max_val
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"atanh"
),
cx
);
return
p
;
...
...
test/verify/test_clip.cpp
View file @
4a39a0f7
...
...
@@ -13,10 +13,10 @@ struct test_clip : verify_program<test_clip>
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
}});
auto
min_val
=
mm
->
add_literal
(
0.0
f
);
auto
max_val
=
mm
->
add_literal
(
6.0
f
);
min_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"output_lens"
,
{
3
}}}),
min_val
);
max_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"output_lens"
,
{
3
}}}),
max_val
);
min_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
3
}}}),
min_val
);
max_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
3
}}}),
max_val
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"clip"
),
x
,
min_val
,
max_val
);
return
p
;
}
...
...
test/verify/test_concat_pooling.cpp
View file @
4a39a0f7
...
...
@@ -12,11 +12,11 @@ struct test_concat_pooling : verify_program<test_concat_pooling>
auto
*
mm
=
p
.
get_main_module
();
auto
input
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
256
,
8
,
8
}});
auto
transpose
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"
dims
"
,
{
0
,
2
,
3
,
1
}}}),
input
);
auto
concat
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
3
}}),
transpose
);
auto
concat_t
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"
dims
"
,
{
0
,
3
,
1
,
2
}}}),
concat
);
auto
transpose
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"
permutation
"
,
{
0
,
2
,
3
,
1
}}}),
input
);
auto
concat
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
3
}}),
transpose
);
auto
concat_t
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"
permutation
"
,
{
0
,
3
,
1
,
2
}}}),
concat
);
auto
pooling
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"pooling"
,
{{
"mode"
,
"average"
},
...
...
test/verify/test_concat_transpose.cpp
View file @
4a39a0f7
...
...
@@ -16,8 +16,9 @@ struct test_concat_transpose : verify_program<test_concat_transpose>
migraphx
::
shape
s2
{
migraphx
::
shape
::
int32_type
,
{
2
,
4
}};
auto
l0
=
mm
->
add_parameter
(
"x"
,
s0
);
auto
lp1
=
mm
->
add_parameter
(
"y"
,
s1
);
auto
l1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"dims"
,
{
1
,
0
}}}),
lp1
);
auto
l2
=
mm
->
add_parameter
(
"z"
,
s2
);
auto
l1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
lp1
);
auto
l2
=
mm
->
add_parameter
(
"z"
,
s2
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
axis
}}),
l0
,
l1
,
l2
);
return
p
;
}
...
...
test/verify/test_concat_transpose2.cpp
View file @
4a39a0f7
...
...
@@ -17,7 +17,8 @@ struct test_concat_transpose2 : verify_program<test_concat_transpose2>
auto
l0
=
mm
->
add_parameter
(
"x"
,
s0
);
auto
l1
=
mm
->
add_parameter
(
"y"
,
s1
);
auto
lp2
=
mm
->
add_parameter
(
"z"
,
s2
);
auto
l2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"dims"
,
{
1
,
0
}}}),
lp2
);
auto
l2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
lp2
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
axis
}}),
l0
,
l1
,
l2
);
return
p
;
}
...
...
test/verify/test_concat_transpose3.cpp
View file @
4a39a0f7
...
...
@@ -16,9 +16,11 @@ struct test_concat_transpose3 : verify_program<test_concat_transpose3>
migraphx
::
shape
s2
{
migraphx
::
shape
::
int32_type
,
{
5
,
2
}};
auto
l0
=
mm
->
add_parameter
(
"x"
,
s0
);
auto
lp1
=
mm
->
add_parameter
(
"y"
,
s1
);
auto
l1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"dims"
,
{
1
,
0
}}}),
lp1
);
auto
l1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
lp1
);
auto
lp2
=
mm
->
add_parameter
(
"z"
,
s2
);
auto
l2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"dims"
,
{
1
,
0
}}}),
lp2
);
auto
l2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
lp2
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
axis
}}),
l0
,
l1
,
l2
);
return
p
;
}
...
...
test/verify/test_conv_bias_clipped_relu.cpp
View file @
4a39a0f7
...
...
@@ -22,15 +22,15 @@ struct test_conv_bias_clipped_relu : verify_program<test_conv_bias_clipped_relu>
auto
bias
=
mm
->
add_literal
(
l0
);
auto
conv
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"convolution"
),
input
,
weights
);
auto
bcast_add
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
1
},
{
"
dim
s"
,
conv
->
get_shape
().
lens
()}}),
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
1
},
{
"
out_len
s"
,
conv
->
get_shape
().
lens
()}}),
bias
);
auto
bias_add
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
conv
,
bcast_add
);
auto
min_val
=
mm
->
add_literal
(
0.0
f
);
auto
max_val
=
mm
->
add_literal
(
6.0
f
);
min_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out
put
_lens"
,
input_lens
}}),
min_val
);
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
input_lens
}}),
min_val
);
max_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out
put
_lens"
,
input_lens
}}),
max_val
);
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
input_lens
}}),
max_val
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"clip"
),
bias_add
,
min_val
,
max_val
);
return
p
;
}
...
...
test/verify/test_dequantizelinear.cpp
0 → 100644
View file @
4a39a0f7
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_dequantizelinear
:
verify_program
<
test_dequantizelinear
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sx
{
migraphx
::
shape
::
int8_type
,
{
2
,
2
,
2
}};
migraphx
::
shape
ss
{
migraphx
::
shape
::
float_type
,
{
2
,
2
,
2
}};
migraphx
::
shape
sz
{
migraphx
::
shape
::
int8_type
,
{
2
,
2
,
2
}};
auto
input1
=
mm
->
add_parameter
(
"x"
,
sx
);
auto
input2
=
mm
->
add_parameter
(
"x_scale"
,
ss
);
auto
input3
=
mm
->
add_parameter
(
"x_zero_point"
,
sz
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dequantizelinear"
),
input1
,
input2
,
input3
);
mm
->
add_return
({
r
});
return
p
;
};
};
Prev
1
…
20
21
22
23
24
25
26
27
28
Next
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