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
7e297b13
Commit
7e297b13
authored
Jun 13, 2022
by
Paul
Browse files
Merge
parents
86ea5e91
aa7ff911
Changes
765
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
351 additions
and
13 deletions
+351
-13
test/verify/test_prefix_scan_sum_reverse.cpp
test/verify/test_prefix_scan_sum_reverse.cpp
+20
-0
test/verify/test_reduce_op_large.cpp
test/verify/test_reduce_op_large.cpp
+14
-1
test/verify/test_reduce_op_small.cpp
test/verify/test_reduce_op_small.cpp
+3
-2
test/verify/test_roialign.cpp
test/verify/test_roialign.cpp
+35
-0
test/verify/test_roialign_nondefault.cpp
test/verify/test_roialign_nondefault.cpp
+39
-0
test/verify/test_roialign_nonstandard.cpp
test/verify/test_roialign_nonstandard.cpp
+36
-0
test/verify/test_rsqrt.cpp
test/verify/test_rsqrt.cpp
+2
-2
test/verify/test_scatter0.cpp
test/verify/test_scatter0.cpp
+1
-1
test/verify/test_scatter1.cpp
test/verify/test_scatter1.cpp
+1
-1
test/verify/test_scatternd.cpp
test/verify/test_scatternd.cpp
+30
-0
test/verify/test_scatternd_add.cpp
test/verify/test_scatternd_add.cpp
+30
-0
test/verify/test_scatternd_mul.cpp
test/verify/test_scatternd_mul.cpp
+28
-0
test/verify/test_sqrt_half1.cpp
test/verify/test_sqrt_half1.cpp
+20
-0
test/verify/test_sqrt_half2.cpp
test/verify/test_sqrt_half2.cpp
+21
-0
test/verify/test_sqrt_half4.cpp
test/verify/test_sqrt_half4.cpp
+20
-0
test/verify/test_step_broadcast_transpose.cpp
test/verify/test_step_broadcast_transpose.cpp
+4
-3
test/verify/test_step_transpose.cpp
test/verify/test_step_transpose.cpp
+3
-2
test/verify/test_sub2.cpp
test/verify/test_sub2.cpp
+1
-1
test/verify/test_sub_int.cpp
test/verify/test_sub_int.cpp
+21
-0
test/verify/test_topk_0.cpp
test/verify/test_topk_0.cpp
+22
-0
No files found.
test/verify/test_prefix_scan_sum_reverse.cpp
0 → 100644
View file @
7e297b13
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_prefix_scan_sum_reverse
:
verify_program
<
test_prefix_scan_sum_reverse
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
,
3
,
3
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"prefix_scan_sum"
,
{{
"axis"
,
1
},
{
"exclusive"
,
false
},
{
"reverse"
,
true
}}),
x
);
return
p
;
}
};
test/verify/test_reduce_op_large.cpp
View file @
7e297b13
...
...
@@ -17,7 +17,7 @@ struct test_reduce_op_large : verify_program<test_reduce_op_large<Op, Axis, T>>
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
T
,
{
3
,
1026
,
4
,
3
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
mm
->
add_instruction
(
Op
{{
1
}},
x
);
mm
->
add_instruction
(
Op
{{
Axis
}},
x
);
return
p
;
};
};
...
...
@@ -27,3 +27,16 @@ template struct test_reduce_op_large<migraphx::op::reduce_mean, 1, migraphx::sha
template
struct
test_reduce_op_large
<
migraphx
::
op
::
reduce_min
,
1
,
migraphx
::
shape
::
float_type
>;
template
struct
test_reduce_op_large
<
migraphx
::
op
::
reduce_prod
,
2
,
migraphx
::
shape
::
float_type
>;
template
struct
test_reduce_op_large
<
migraphx
::
op
::
reduce_sum
,
1
,
migraphx
::
shape
::
float_type
>;
struct
test_reduce_mean
:
verify_program
<
test_reduce_mean
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
1
,
384
,
1024
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
mm
->
add_instruction
(
migraphx
::
op
::
reduce_mean
{{
1
}},
x
);
return
p
;
};
};
test/verify/test_reduce_op_small.cpp
View file @
7e297b13
...
...
@@ -15,13 +15,14 @@ struct test_reduce_op_small : verify_program<test_reduce_op_small<Op, Axis, T>>
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
T
,
{
3
,
4
,
8
,
8
}};
migraphx
::
shape
s
{
T
,
{
3
,
4
,
2
,
2
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
mm
->
add_instruction
(
Op
{{
1
}},
x
);
mm
->
add_instruction
(
Op
{{
Axis
}},
x
);
return
p
;
};
};
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_sum
,
1
,
migraphx
::
shape
::
float_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_sum
,
2
,
migraphx
::
shape
::
int32_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_mean
,
2
,
migraphx
::
shape
::
int32_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_max
,
2
,
migraphx
::
shape
::
int32_type
>;
...
...
test/verify/test_roialign.cpp
0 → 100644
View file @
7e297b13
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_roialign
:
verify_program
<
test_roialign
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
x_s
{
migraphx
::
shape
::
float_type
,
{
5
,
4
,
10
,
10
}};
migraphx
::
shape
roi_s
{
migraphx
::
shape
::
float_type
,
{
5
,
4
}};
migraphx
::
shape
ind_s
{
migraphx
::
shape
::
int64_type
,
{
5
}};
std
::
vector
<
int64_t
>
ind_vec
=
{
0
,
2
,
3
,
4
,
1
};
auto
x
=
mm
->
add_parameter
(
"x"
,
x_s
);
auto
roi
=
mm
->
add_parameter
(
"roi"
,
roi_s
);
auto
ind
=
mm
->
add_literal
(
migraphx
::
literal
(
ind_s
,
ind_vec
));
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"roialign"
,
{{
"spatial_scale"
,
1.0
},
{
"output_height"
,
5
},
{
"output_width"
,
5
},
{
"sampling_ratio"
,
2
}}),
x
,
roi
,
ind
);
mm
->
add_return
({
r
});
return
p
;
}
};
test/verify/test_roialign_nondefault.cpp
0 → 100644
View file @
7e297b13
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/op/common.hpp>
struct
test_roialign_nondefault
:
verify_program
<
test_roialign_nondefault
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
x_s
{
migraphx
::
shape
::
float_type
,
{
5
,
4
,
10
,
10
}};
migraphx
::
shape
roi_s
{
migraphx
::
shape
::
float_type
,
{
5
,
4
}};
migraphx
::
shape
ind_s
{
migraphx
::
shape
::
int64_type
,
{
5
}};
std
::
vector
<
int64_t
>
ind_vec
=
{
0
,
2
,
3
,
4
,
1
};
auto
x
=
mm
->
add_parameter
(
"x"
,
x_s
);
auto
roi
=
mm
->
add_parameter
(
"roi"
,
roi_s
);
auto
ind
=
mm
->
add_literal
(
migraphx
::
literal
(
ind_s
,
ind_vec
));
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"roialign"
,
{{
"coordinate_transformation_mode"
,
"output_half_pixel"
},
{
"mode"
,
migraphx
::
op
::
pooling_mode
::
max
},
{
"spatial_scale"
,
1.0
},
{
"output_height"
,
5
},
{
"output_width"
,
5
},
{
"sampling_ratio"
,
2
}}),
x
,
roi
,
ind
);
mm
->
add_return
({
r
});
return
p
;
}
};
test/verify/test_roialign_nonstandard.cpp
0 → 100644
View file @
7e297b13
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_roialign_nonstandard
:
verify_program
<
test_roialign_nonstandard
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x_s
=
migraphx
::
shape
::
from_permutation
(
migraphx
::
shape
::
float_type
,
{
5
,
4
,
10
,
10
},
{
0
,
2
,
3
,
1
});
migraphx
::
shape
roi_s
{
migraphx
::
shape
::
float_type
,
{
5
,
4
}};
migraphx
::
shape
ind_s
{
migraphx
::
shape
::
int64_type
,
{
5
}};
std
::
vector
<
int64_t
>
ind_vec
=
{
0
,
2
,
3
,
4
,
1
};
auto
x
=
mm
->
add_parameter
(
"x"
,
x_s
);
auto
roi
=
mm
->
add_parameter
(
"roi"
,
roi_s
);
auto
ind
=
mm
->
add_literal
(
migraphx
::
literal
(
ind_s
,
ind_vec
));
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"roialign"
,
{{
"spatial_scale"
,
1.0
},
{
"output_height"
,
5
},
{
"output_width"
,
5
},
{
"sampling_ratio"
,
2
}}),
x
,
roi
,
ind
);
mm
->
add_return
({
r
});
return
p
;
}
};
test/verify/test_rsqrt.cpp
View file @
7e297b13
...
...
@@ -16,9 +16,9 @@ struct test_rsqrt : verify_program<test_rsqrt>
auto
min_val
=
mm
->
add_literal
(
1.0
f
);
auto
max_val
=
mm
->
add_literal
(
std
::
numeric_limits
<
float
>::
max
());
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
);
auto
l0
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"clip"
),
x
,
min_val
,
max_val
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"rsqrt"
),
l0
);
return
p
;
...
...
test/verify/test_scatter0.cpp
View file @
7e297b13
...
...
@@ -18,7 +18,7 @@ struct test_scatter0 : verify_program<test_scatter0>
auto
pd
=
mm
->
add_parameter
(
"data"
,
sd
);
auto
li
=
mm
->
add_literal
(
migraphx
::
literal
{
si
,
vi
});
auto
pu
=
mm
->
add_parameter
(
"update"
,
su
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatter"
,
{{
"axis"
,
-
1
}}),
pd
,
li
,
pu
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatter
_none
"
,
{{
"axis"
,
-
1
}}),
pd
,
li
,
pu
);
mm
->
add_return
({
r
});
return
p
;
...
...
test/verify/test_scatter1.cpp
View file @
7e297b13
...
...
@@ -19,7 +19,7 @@ struct test_scatter1 : verify_program<test_scatter1>
auto
pd
=
mm
->
add_parameter
(
"data"
,
sd
);
auto
li
=
mm
->
add_literal
(
migraphx
::
literal
{
si
,
vi
});
auto
pu
=
mm
->
add_parameter
(
"update"
,
su
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatter"
,
{{
"axis"
,
-
2
}}),
pd
,
li
,
pu
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatter
_none
"
,
{{
"axis"
,
-
2
}}),
pd
,
li
,
pu
);
mm
->
add_return
({
r
});
return
p
;
...
...
test/verify/test_scatternd.cpp
0 → 100644
View file @
7e297b13
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_scatternd
:
verify_program
<
test_scatternd
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
dtype
=
migraphx
::
shape
::
float_type
;
auto
itype
=
migraphx
::
shape
::
int64_type
;
migraphx
::
shape
ds
{
dtype
,
{
1
}};
migraphx
::
shape
is
{
itype
,
{
4
,
1
}};
migraphx
::
shape
us
{
dtype
,
{
4
}};
std
::
vector
<
int64_t
>
ind_vec
{
4
,
3
,
1
,
7
};
auto
ld
=
mm
->
add_literal
(
migraphx
::
literal
{
ds
,
{
1
}});
auto
data
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
8
}}}),
ld
);
auto
indices
=
mm
->
add_literal
(
migraphx
::
literal
{
is
,
ind_vec
});
auto
updates
=
mm
->
add_parameter
(
"update"
,
us
);
auto
scatternd
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatternd_none"
),
data
,
indices
,
updates
);
mm
->
add_return
({
scatternd
});
return
p
;
}
};
test/verify/test_scatternd_add.cpp
0 → 100644
View file @
7e297b13
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_scatternd_add
:
verify_program
<
test_scatternd_add
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
dtype
=
migraphx
::
shape
::
float_type
;
auto
itype
=
migraphx
::
shape
::
int64_type
;
migraphx
::
shape
ds
{
dtype
,
{
8
}};
migraphx
::
shape
is
{
itype
,
{
1
,
4
}};
migraphx
::
shape
us
{
dtype
,
{
4
}};
std
::
vector
<
int64_t
>
ind_vec
{
4
,
3
,
1
,
7
};
auto
data
=
mm
->
add_parameter
(
"data"
,
ds
);
auto
indices
=
mm
->
add_literal
(
migraphx
::
literal
{
is
,
ind_vec
});
auto
t_ind
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
indices
);
auto
updates
=
mm
->
add_parameter
(
"update"
,
us
);
auto
scatternd
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatternd_add"
),
data
,
t_ind
,
updates
);
mm
->
add_return
({
scatternd
});
return
p
;
}
};
test/verify/test_scatternd_mul.cpp
0 → 100644
View file @
7e297b13
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_scatternd_mul
:
verify_program
<
test_scatternd_mul
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
dtype
=
migraphx
::
shape
::
float_type
;
auto
itype
=
migraphx
::
shape
::
int64_type
;
migraphx
::
shape
ds
{
dtype
,
{
8
}};
migraphx
::
shape
is
{
itype
,
{
4
,
1
}};
migraphx
::
shape
us
{
dtype
,
{
4
}};
std
::
vector
<
int64_t
>
ind_vec
{
4
,
3
,
1
,
7
};
auto
data
=
mm
->
add_parameter
(
"data"
,
ds
);
auto
indices
=
mm
->
add_literal
(
migraphx
::
literal
{
is
,
ind_vec
});
auto
updates
=
mm
->
add_parameter
(
"update"
,
us
);
auto
scatternd
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatternd_mul"
),
data
,
indices
,
updates
);
mm
->
add_return
({
scatternd
});
return
p
;
}
};
test/verify/test_sqrt_half1.cpp
0 → 100644
View file @
7e297b13
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
// math op on half-precision float with odd size tensor can't fit half2 packing
struct
test_sqrt_half1
:
verify_program
<
test_sqrt_half1
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
half_type
,
{
5
}};
auto
param
=
mm
->
add_parameter
(
"x"
,
s
);
auto
param_abs
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"abs"
),
param
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"sqrt"
),
param_abs
);
return
p
;
}
};
test/verify/test_sqrt_half2.cpp
0 → 100644
View file @
7e297b13
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
// math op on half-precision float with tensor size that's divisible by 2,
// but not divisible by 4
struct
test_sqrt_half2
:
verify_program
<
test_sqrt_half2
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
half_type
,
{
6
}};
auto
param
=
mm
->
add_parameter
(
"x"
,
s
);
auto
param_abs
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"abs"
),
param
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"sqrt"
),
param_abs
);
return
p
;
}
};
test/verify/test_sqrt_half4.cpp
0 → 100644
View file @
7e297b13
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
// math op on half-precision float with tensor size that fits into half4 packing
struct
test_sqrt_half4
:
verify_program
<
test_sqrt_half4
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
half_type
,
{
8
}};
auto
param
=
mm
->
add_parameter
(
"x"
,
s
);
auto
param_abs
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"abs"
),
param
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"sqrt"
),
param_abs
);
return
p
;
}
};
test/verify/test_step_broadcast_transpose.cpp
View file @
7e297b13
...
...
@@ -13,9 +13,10 @@ struct test_step_broadcast_transpose : verify_program<test_step_broadcast_transp
migraphx
::
shape
s1
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
1
,
6
}};
auto
l0
=
mm
->
add_parameter
(
"x"
,
s1
);
auto
ml
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"output_lens"
,
{
2
,
1
,
4
,
6
}}}),
l0
);
auto
tl
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"dims"
,
{
0
,
2
,
3
,
1
}}}),
ml
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
2
,
1
,
4
,
6
}}}),
l0
);
auto
tl
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
0
,
2
,
3
,
1
}}}),
ml
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"step"
,
{{
"axes"
,
{
0
,
1
,
2
}},
{
"steps"
,
{
2
,
2
,
3
}}}),
tl
);
mm
->
add_return
({
r
});
...
...
test/verify/test_step_transpose.cpp
View file @
7e297b13
...
...
@@ -12,8 +12,9 @@ struct test_step_transpose : verify_program<test_step_transpose>
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s1
{
migraphx
::
shape
::
float_type
,
{
2
,
1
,
4
,
6
}};
auto
l0
=
mm
->
add_parameter
(
"x"
,
s1
);
auto
tl
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"dims"
,
{
0
,
2
,
3
,
1
}}}),
l0
);
auto
r
=
mm
->
add_instruction
(
auto
tl
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
0
,
2
,
3
,
1
}}}),
l0
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"step"
,
{{
"axes"
,
{
0
,
1
,
2
}},
{
"steps"
,
{
2
,
2
,
3
}}}),
tl
);
mm
->
add_return
({
r
});
...
...
test/verify/test_sub2.cpp
View file @
7e297b13
...
...
@@ -16,7 +16,7 @@ struct test_sub2 : verify_program<test_sub2>
auto
y
=
mm
->
add_parameter
(
"y"
,
s
);
auto
z
=
mm
->
add_parameter
(
"z"
,
b
);
auto
zb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
1
},
{
"
dim
s"
,
s
.
lens
()}}),
z
);
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
1
},
{
"
out_len
s"
,
s
.
lens
()}}),
z
);
auto
diff
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
x
,
y
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
diff
,
zb
);
return
p
;
...
...
test/verify/test_sub_int.cpp
0 → 100644
View file @
7e297b13
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_sub_int
:
verify_program
<
test_sub_int
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
{
migraphx
::
shape
::
int16_type
,
{
4
,
5
}});
auto
y
=
mm
->
add_parameter
(
"y"
,
{
migraphx
::
shape
::
int16_type
,
{
2
,
3
,
4
,
5
}});
auto
xb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
2
,
3
,
4
,
5
}}}),
x
);
auto
diff
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
y
,
xb
);
mm
->
add_return
({
diff
});
return
p
;
}
};
test/verify/test_topk_0.cpp
0 → 100644
View file @
7e297b13
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_topk_0
:
verify_program
<
test_topk_0
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
,
5
}};
auto
data
=
mm
->
add_parameter
(
"data"
,
s
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"topk"
,
{{
"axis"
,
1
},
{
"k"
,
4
},
{
"largest"
,
1
}}),
data
);
auto
r0
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
0
}}),
r
);
mm
->
add_return
({
r0
});
return
p
;
}
};
Prev
1
…
33
34
35
36
37
38
39
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