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
11e155c2
Commit
11e155c2
authored
Jun 13, 2022
by
Paul
Browse files
Merge
parents
8a9c5bce
aa7ff911
Changes
397
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
263 additions
and
11 deletions
+263
-11
test/verify/test_conv_pooling.cpp
test/verify/test_conv_pooling.cpp
+3
-1
test/verify/test_gathernd_batch_dims_1.cpp
test/verify/test_gathernd_batch_dims_1.cpp
+22
-0
test/verify/test_gathernd_batch_dims_2.cpp
test/verify/test_gathernd_batch_dims_2.cpp
+21
-0
test/verify/test_gathernd_default.cpp
test/verify/test_gathernd_default.cpp
+20
-0
test/verify/test_gathernd_negative_indices.cpp
test/verify/test_gathernd_negative_indices.cpp
+22
-0
test/verify/test_global_avg_pooling.cpp
test/verify/test_global_avg_pooling.cpp
+1
-1
test/verify/test_global_max_pooling.cpp
test/verify/test_global_max_pooling.cpp
+1
-1
test/verify/test_isnan_broadcast.cpp
test/verify/test_isnan_broadcast.cpp
+24
-0
test/verify/test_isnan_float.cpp
test/verify/test_isnan_float.cpp
+19
-0
test/verify/test_isnan_half.cpp
test/verify/test_isnan_half.cpp
+20
-0
test/verify/test_max_pooling_ceil_3d.cpp
test/verify/test_max_pooling_ceil_3d.cpp
+2
-1
test/verify/test_pooling_autopad.cpp
test/verify/test_pooling_autopad.cpp
+1
-1
test/verify/test_prefix_scan_sum_2d.cpp
test/verify/test_prefix_scan_sum_2d.cpp
+4
-2
test/verify/test_prefix_scan_sum_exclusive.cpp
test/verify/test_prefix_scan_sum_exclusive.cpp
+20
-0
test/verify/test_prefix_scan_sum_exclusive_reverse.cpp
test/verify/test_prefix_scan_sum_exclusive_reverse.cpp
+21
-0
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
+1
-1
test/verify/test_reduce_op_small.cpp
test/verify/test_reduce_op_small.cpp
+3
-2
test/verify/test_roialign_nondefault.cpp
test/verify/test_roialign_nondefault.cpp
+2
-1
test/verify/test_roialign_nonstandard.cpp
test/verify/test_roialign_nonstandard.cpp
+36
-0
No files found.
test/verify/test_conv_pooling.cpp
View file @
11e155c2
...
...
@@ -3,6 +3,7 @@
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/op/common.hpp>
struct
test_conv_pooling
:
verify_program
<
test_conv_pooling
>
{
...
...
@@ -15,7 +16,8 @@ struct test_conv_pooling : verify_program<test_conv_pooling>
auto
weights
=
mm
->
add_parameter
(
"w"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
3
,
3
,
3
}});
auto
conv
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"convolution"
),
input
,
weights
);
auto
pooling
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"pooling"
,
{{
"mode"
,
"max"
}}),
conv
);
auto
pooling
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"pooling"
,
{{
"mode"
,
migraphx
::
op
::
pooling_mode
::
max
}}),
conv
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"relu"
),
pooling
);
return
p
;
}
...
...
test/verify/test_gathernd_batch_dims_1.cpp
0 → 100644
View file @
11e155c2
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_gathernd_batch_dims_1
:
verify_program
<
test_gathernd_batch_dims_1
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
ds
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
2
,
3
}};
migraphx
::
shape
is
{
migraphx
::
shape
::
int64_type
,
{
2
,
3
,
2
}};
std
::
vector
<
int64_t
>
indices
{
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
,
1
,
0
};
auto
a0
=
mm
->
add_parameter
(
"data"
,
ds
);
auto
a1
=
mm
->
add_literal
(
migraphx
::
literal
{
is
,
indices
});
int
batch_dims
=
1
;
mm
->
add_instruction
(
migraphx
::
make_op
(
"gathernd"
,
{{
"batch_dims"
,
batch_dims
}}),
a0
,
a1
);
return
p
;
}
};
test/verify/test_gathernd_batch_dims_2.cpp
0 → 100644
View file @
11e155c2
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_gathernd_batch_dims_2
:
verify_program
<
test_gathernd_batch_dims_2
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
ds
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
1
,
3
}};
migraphx
::
shape
is
{
migraphx
::
shape
::
int64_type
,
{
2
,
3
,
2
}};
std
::
vector
<
int64_t
>
indices
{
0
,
0
,
0
,
1
,
0
,
2
,
0
,
2
,
0
,
1
,
0
,
0
};
auto
a0
=
mm
->
add_parameter
(
"data"
,
ds
);
auto
a1
=
mm
->
add_literal
(
migraphx
::
literal
{
is
,
indices
});
int
batch_dims
=
2
;
mm
->
add_instruction
(
migraphx
::
make_op
(
"gathernd"
,
{{
"batch_dims"
,
batch_dims
}}),
a0
,
a1
);
return
p
;
}
};
test/verify/test_gathernd_default.cpp
0 → 100644
View file @
11e155c2
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_gathernd_default
:
verify_program
<
test_gathernd_default
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
ds
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}};
migraphx
::
shape
is
{
migraphx
::
shape
::
int64_type
,
{
2
,
2
}};
std
::
vector
<
int64_t
>
indices
{
0
,
0
,
1
,
1
};
auto
a0
=
mm
->
add_parameter
(
"data"
,
ds
);
auto
a1
=
mm
->
add_literal
(
migraphx
::
literal
{
is
,
indices
});
mm
->
add_instruction
(
migraphx
::
make_op
(
"gathernd"
),
a0
,
a1
);
return
p
;
}
};
test/verify/test_gathernd_negative_indices.cpp
0 → 100644
View file @
11e155c2
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_gathernd_negative_indices
:
verify_program
<
test_gathernd_negative_indices
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
ds
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}};
migraphx
::
shape
is
{
migraphx
::
shape
::
int64_type
,
{
2
,
1
,
1
}};
std
::
vector
<
int64_t
>
indices
{
-
1
,
0
};
auto
a0
=
mm
->
add_parameter
(
"data"
,
ds
);
auto
a1
=
mm
->
add_literal
(
migraphx
::
literal
{
is
,
indices
});
int
batch_dims
=
1
;
mm
->
add_instruction
(
migraphx
::
make_op
(
"gathernd"
,
{{
"batch_dims"
,
batch_dims
}}),
a0
,
a1
);
return
p
;
}
};
test/verify/test_global_avg_pooling.cpp
View file @
11e155c2
...
...
@@ -13,7 +13,7 @@ struct test_global_avg_pooling : verify_program<test_global_avg_pooling>
auto
*
mm
=
p
.
get_main_module
();
auto
input
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
16
,
16
}});
auto
op
=
migraphx
::
op
::
pooling
{
"
average
"
};
auto
op
=
migraphx
::
op
::
pooling
{
migraphx
::
op
::
pooling_mode
::
average
};
auto
lens
=
input
->
get_shape
().
lens
();
op
.
lengths
=
{
lens
[
2
],
lens
[
3
]};
mm
->
add_instruction
(
op
,
input
);
...
...
test/verify/test_global_max_pooling.cpp
View file @
11e155c2
...
...
@@ -13,7 +13,7 @@ struct test_global_max_pooling : verify_program<test_global_max_pooling>
auto
*
mm
=
p
.
get_main_module
();
auto
input
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
16
,
16
}});
auto
op
=
migraphx
::
op
::
pooling
{
"max"
};
auto
op
=
migraphx
::
op
::
pooling
{
migraphx
::
op
::
pooling_mode
::
max
};
auto
lens
=
input
->
get_shape
().
lens
();
op
.
lengths
=
{
lens
[
2
],
lens
[
3
]};
mm
->
add_instruction
(
op
,
input
);
...
...
test/verify/test_isnan_broadcast.cpp
0 → 100644
View file @
11e155c2
#include <limits>
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_isnan_broadcast
:
verify_program
<
test_isnan_broadcast
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
}});
auto
s0
=
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}};
x
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
0
},
{
"out_lens"
,
s0
.
lens
()}}),
x
);
std
::
vector
<
float
>
data0
{
2
,
std
::
numeric_limits
<
float
>::
quiet_NaN
()};
migraphx
::
shape
s1
{
migraphx
::
shape
::
float_type
,
{
1
,
2
}};
auto
l0
=
mm
->
add_literal
(
migraphx
::
literal
{
s1
,
data0
});
x
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
0
}}),
x
,
l0
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"isnan"
),
x
);
return
p
;
}
};
test/verify/test_isnan_float.cpp
0 → 100644
View file @
11e155c2
#include <limits>
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_isnan_float
:
verify_program
<
test_isnan_float
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
}});
auto
l0
=
mm
->
add_literal
(
std
::
numeric_limits
<
float
>::
quiet_NaN
());
x
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
0
}}),
x
,
l0
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"isnan"
),
x
);
return
p
;
}
};
test/verify/test_isnan_half.cpp
0 → 100644
View file @
11e155c2
#include <limits>
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/half.hpp>
struct
test_isnan_half
:
verify_program
<
test_isnan_half
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
half_type
,
{
2
}});
auto
l0
=
mm
->
add_literal
(
std
::
numeric_limits
<
migraphx
::
half
>::
quiet_NaN
());
x
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
0
}}),
x
,
l0
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"isnan"
),
x
);
return
p
;
}
};
test/verify/test_max_pooling_ceil_3d.cpp
100755 → 100644
View file @
11e155c2
...
...
@@ -12,7 +12,8 @@ struct test_max_pooling_ceil_3d : verify_program<test_max_pooling_ceil_3d>
auto
*
mm
=
p
.
get_main_module
();
auto
input
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
5
,
5
,
5
}});
auto
op
=
migraphx
::
op
::
pooling
{
"max"
,
{
1
,
1
,
1
},
{
3
,
3
,
3
},
{
3
,
3
,
3
},
true
};
auto
op
=
migraphx
::
op
::
pooling
{
migraphx
::
op
::
pooling_mode
::
max
,
{
1
,
1
,
1
},
{
3
,
3
,
3
},
{
3
,
3
,
3
},
true
};
mm
->
add_instruction
(
op
,
input
);
return
p
;
}
...
...
test/verify/test_pooling_autopad.cpp
View file @
11e155c2
...
...
@@ -12,7 +12,7 @@ struct test_pooling_autopad : verify_program<test_pooling_autopad>
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s0
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
63
,
63
}};
auto
l0
=
mm
->
add_parameter
(
"x"
,
s0
);
migraphx
::
op
::
pooling
op
{
"max"
};
migraphx
::
op
::
pooling
op
{
migraphx
::
op
::
pooling_mode
::
max
};
op
.
lengths
=
{
2
,
2
};
op
.
stride
=
{
2
,
2
};
mm
->
add_instruction
(
op
,
l0
);
...
...
test/verify/test_prefix_scan_sum_2d.cpp
100755 → 100644
View file @
11e155c2
...
...
@@ -9,10 +9,12 @@ struct test_prefix_scan_sum_2d_small : verify_program<test_prefix_scan_sum_2d_sm
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
,
3
}};
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
1
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
xb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
3
,
3
}}}),
x
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"prefix_scan_sum"
,
{{
"axis"
,
1
},
{
"exclusive"
,
false
}}),
x
);
migraphx
::
make_op
(
"prefix_scan_sum"
,
{{
"axis"
,
1
},
{
"exclusive"
,
false
}}),
x
b
);
return
p
;
}
};
...
...
test/verify/test_prefix_scan_sum_exclusive.cpp
0 → 100644
View file @
11e155c2
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_prefix_scan_sum_exclusive
:
verify_program
<
test_prefix_scan_sum_exclusive
>
{
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"
,
2
},
{
"exclusive"
,
true
},
{
"reverse"
,
false
}}),
x
);
return
p
;
}
};
test/verify/test_prefix_scan_sum_exclusive_reverse.cpp
0 → 100644
View file @
11e155c2
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_prefix_scan_sum_exclusive_reverse
:
verify_program
<
test_prefix_scan_sum_exclusive_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"
,
0
},
{
"exclusive"
,
true
},
{
"reverse"
,
true
}}),
x
);
return
p
;
}
};
test/verify/test_prefix_scan_sum_reverse.cpp
0 → 100644
View file @
11e155c2
#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 @
11e155c2
...
...
@@ -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
;
};
};
...
...
test/verify/test_reduce_op_small.cpp
View file @
11e155c2
...
...
@@ -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_nondefault.cpp
View file @
11e155c2
...
...
@@ -3,6 +3,7 @@
#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
>
{
...
...
@@ -23,7 +24,7 @@ struct test_roialign_nondefault : verify_program<test_roialign_nondefault>
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"roialign"
,
{{
"coordinate_transformation_mode"
,
"output_half_pixel"
},
{
"mode"
,
"max"
},
{
"mode"
,
migraphx
::
op
::
pooling_mode
::
max
},
{
"spatial_scale"
,
1.0
},
{
"output_height"
,
5
},
{
"output_width"
,
5
},
...
...
test/verify/test_roialign_nonstandard.cpp
0 → 100644
View file @
11e155c2
#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
;
}
};
Prev
1
…
15
16
17
18
19
20
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