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
7a7040aa
Unverified
Commit
7a7040aa
authored
Mar 18, 2023
by
Umang Yadav
Committed by
GitHub
Mar 18, 2023
Browse files
Dynamically plug-in backend target libs (#1608)
Fixes #1595
parent
9ef6801e
Changes
50
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
473 additions
and
512 deletions
+473
-512
test/api/CMakeLists.txt
test/api/CMakeLists.txt
+4
-2
test/context_test.cpp
test/context_test.cpp
+0
-40
test/fpga/get_target_assignments.cpp
test/fpga/get_target_assignments.cpp
+0
-1
test/gpu/jit.cpp
test/gpu/jit.cpp
+4
-4
test/gpu/literal.cpp
test/gpu/literal.cpp
+2
-1
test/gpu/manage_host_buffer.cpp
test/gpu/manage_host_buffer.cpp
+2
-2
test/gpu/mlir.cpp
test/gpu/mlir.cpp
+2
-2
test/gpu/quantization.cpp
test/gpu/quantization.cpp
+5
-6
test/gpu/stream_sync.cpp
test/gpu/stream_sync.cpp
+2
-1
test/marker.cpp
test/marker.cpp
+2
-3
test/module_test.cpp
test/module_test.cpp
+1
-1
test/onnx/verify_onnx.cpp
test/onnx/verify_onnx.cpp
+59
-59
test/perf_report.cpp
test/perf_report.cpp
+2
-3
test/program_test.cpp
test/program_test.cpp
+8
-8
test/quantization.cpp
test/quantization.cpp
+9
-9
test/ref_dev_examples.cpp
test/ref_dev_examples.cpp
+4
-4
test/ref_dot_op_test.cpp
test/ref_dot_op_test.cpp
+42
-42
test/ref_loop_test.cpp
test/ref_loop_test.cpp
+2
-2
test/ref_ops_nonstd_shape_test.cpp
test/ref_ops_nonstd_shape_test.cpp
+11
-10
test/ref_ops_test.cpp
test/ref_ops_test.cpp
+312
-312
No files found.
test/api/CMakeLists.txt
View file @
7a7040aa
...
...
@@ -56,8 +56,10 @@ add_api_test(custom_op test_custom_op.cpp ${TEST_ONNX_DIR})
add_api_test
(
tf_parser test_tf_parser.cpp
${
TEST_TF_DIR
}
)
# GPU-based tests
if
(
MIGRAPHX_ENABLE_GPU
)
list
(
APPEND CMAKE_PREFIX_PATH /opt/rocm
)
find_package
(
hip
)
add_api_test
(
gpu test_gpu.cpp
${
TEST_ONNX_DIR
}
)
target_link_libraries
(
test_api_gpu
migraphx_gpu
)
target_link_libraries
(
test_api_gpu
hip::host
)
add_api_test
(
custom_op_gpu test_custom_op_gpu.cpp
${
TEST_ONNX_DIR
}
)
target_link_libraries
(
test_api_custom_op_gpu
migraphx_gpu
)
target_link_libraries
(
test_api_custom_op_gpu
hip::host
)
endif
()
test/context_test.cpp
deleted
100644 → 0
View file @
9ef6801e
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <migraphx/serialize.hpp>
#include <migraphx/context.hpp>
#include <migraphx/ref/context.hpp>
#include <migraphx/functional.hpp>
#include <test.hpp>
TEST_CASE
(
context
)
{
migraphx
::
context
ctx
=
migraphx
::
ref
::
context
{};
migraphx
::
value
v
=
ctx
.
to_value
();
EXPECT
(
v
.
empty
());
migraphx
::
context
cpu_ctx
=
migraphx
::
ref
::
context
{};
cpu_ctx
.
from_value
(
v
);
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
test/fpga/get_target_assignments.cpp
View file @
7a7040aa
...
...
@@ -26,7 +26,6 @@
#include <migraphx/make_op.hpp>
#include <migraphx/program.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/fpga/target.hpp>
#include <migraphx/target_assignments.hpp>
#include <migraphx/iterator_for.hpp>
...
...
test/gpu/jit.cpp
View file @
7a7040aa
...
...
@@ -27,8 +27,8 @@
#include <migraphx/generate.hpp>
#include <migraphx/program.hpp>
#include <migraphx/par_for.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/gpu/kernel.hpp>
#include <migraphx/gpu/target.hpp>
#include <migraphx/gpu/hip.hpp>
#include <migraphx/gpu/context.hpp>
#include <migraphx/gpu/device_name.hpp>
...
...
@@ -235,7 +235,7 @@ TEST_CASE(code_object_hip)
auto
y
=
mm
->
add_parameter
(
"output"
,
input
);
mm
->
add_instruction
(
co
,
x
,
y
);
migraphx
::
compile_options
options
;
p
.
compile
(
migraphx
::
gpu
::
target
{}
,
options
);
p
.
compile
(
migraphx
::
make_
target
(
"gpu"
)
,
options
);
auto
result
=
migraphx
::
gpu
::
from_gpu
(
p
.
eval
({{
"output"
,
migraphx
::
gpu
::
allocate_gpu
(
input
)}}).
front
());
...
...
@@ -261,7 +261,7 @@ TEST_CASE(compile_code_object_hip)
auto
x
=
mm
->
add_literal
(
input_literal
);
auto
y
=
mm
->
add_parameter
(
"output"
,
input
);
mm
->
add_instruction
(
co
,
x
,
y
);
p
.
compile
(
migraphx
::
gpu
::
target
{}
,
migraphx
::
compile_options
{});
p
.
compile
(
migraphx
::
make_
target
(
"gpu"
)
,
migraphx
::
compile_options
{});
auto
result
=
migraphx
::
gpu
::
from_gpu
(
p
.
eval
({{
"output"
,
migraphx
::
gpu
::
allocate_gpu
(
input
)}}).
front
());
...
...
@@ -284,7 +284,7 @@ TEST_CASE(compile_pointwise)
auto
x
=
mm
->
add_literal
(
input_literal
);
auto
y
=
mm
->
add_parameter
(
"output"
,
input
);
mm
->
add_instruction
(
co
,
x
,
y
);
p
.
compile
(
migraphx
::
gpu
::
target
{}
,
migraphx
::
compile_options
{});
p
.
compile
(
migraphx
::
make_
target
(
"gpu"
)
,
migraphx
::
compile_options
{});
auto
result
=
migraphx
::
gpu
::
from_gpu
(
p
.
eval
({{
"output"
,
migraphx
::
gpu
::
allocate_gpu
(
input
)}}).
front
());
...
...
test/gpu/literal.cpp
View file @
7a7040aa
...
...
@@ -26,6 +26,7 @@
#include <migraphx/program.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/gpu/target.hpp>
#include <migraphx/gpu/hip.hpp>
...
...
@@ -35,7 +36,7 @@ void gpu_literal_test()
auto
*
mm
=
p
.
get_main_module
();
auto
lit
=
generate_literal
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
3
,
3
,
3
}});
mm
->
add_literal
(
lit
);
p
.
compile
(
migraphx
::
gpu
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"gpu"
)
);
auto
scratch
=
p
.
get_parameter
(
"scratch"
);
if
(
scratch
==
mm
->
end
())
{
...
...
test/gpu/manage_host_buffer.cpp
View file @
7a7040aa
...
...
@@ -25,7 +25,7 @@
#include <iostream>
#include <vector>
#include <hip/hip_runtime_api.h>
#include <migraphx/
gpu/
target.hpp>
#include <migraphx/
register_
target.hpp>
#include <migraphx/verify.hpp>
#include <test.hpp>
#include <basic_ops.hpp>
...
...
@@ -57,7 +57,7 @@ TEST_CASE(host_same_buffer_copy)
pp
[
"a"
]
=
migraphx
::
argument
(
ss
,
a_vec
.
data
());
pp
[
"b"
]
=
migraphx
::
argument
(
ss
,
b_vec
.
data
());
std
::
vector
<
float
>
gpu_result
;
migraphx
::
target
gpu_t
=
migraphx
::
gpu
::
target
{}
;
migraphx
::
target
gpu_t
=
migraphx
::
make_
target
(
"gpu"
)
;
migraphx
::
compile_options
options
;
options
.
offload_copy
=
true
;
p
.
compile
(
gpu_t
,
options
);
...
...
test/gpu/mlir.cpp
View file @
7a7040aa
...
...
@@ -25,7 +25,7 @@
#include <migraphx/gpu/target.hpp>
#include <migraphx/gpu/context.hpp>
#include <migraphx/gpu/write_literals.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/module.hpp>
#include <migraphx/program.hpp>
#include <migraphx/make_op.hpp>
...
...
@@ -121,7 +121,7 @@ migraphx::argument run_gpu(migraphx::program p, const migraphx::parameter_map& i
migraphx
::
argument
run_ref
(
migraphx
::
program
p
,
const
migraphx
::
parameter_map
&
inputs
)
{
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
return
p
.
eval
(
inputs
).
front
();
}
...
...
test/gpu/quantization.cpp
View file @
7a7040aa
...
...
@@ -27,8 +27,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/quantization.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/ref/target.hpp>
#include <migraphx/gpu/target.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/propagate_constant.hpp>
...
...
@@ -39,8 +38,8 @@
TEST_CASE
(
gpu_target_copy
)
{
migraphx
::
target
gpu_t
=
migraphx
::
gpu
::
target
{}
;
migraphx
::
target
ref_t
=
migraphx
::
ref
::
target
{}
;
migraphx
::
target
gpu_t
=
migraphx
::
make_
target
(
"gpu"
)
;
migraphx
::
target
ref_t
=
migraphx
::
make_
target
(
"ref"
)
;
migraphx
::
shape
s
{
migraphx
::
shape
::
int8_type
,
{
2
,
3
,
4
,
5
}};
auto
ref_arg_orig
=
migraphx
::
generate_argument
(
s
,
0x123456L
);
...
...
@@ -104,11 +103,11 @@ TEST_CASE(int8_quantization)
m
[
"a"
]
=
migraphx
::
generate_argument
(
sa
);
m
[
"b"
]
=
migraphx
::
generate_argument
(
sb
);
std
::
vector
<
float
>
ref_result
;
migraphx
::
target
ref_t
=
migraphx
::
ref
::
target
{}
;
migraphx
::
target
ref_t
=
migraphx
::
make_
target
(
"ref"
)
;
run_prog
(
p
,
ref_t
,
m
,
ref_result
);
std
::
vector
<
float
>
gpu_result
;
migraphx
::
target
gpu_t
=
migraphx
::
gpu
::
target
{}
;
migraphx
::
target
gpu_t
=
migraphx
::
make_
target
(
"gpu"
)
;
run_prog
(
p
,
gpu_t
,
m
,
gpu_result
);
EXPECT
(
migraphx
::
verify_range
(
ref_result
,
gpu_result
));
...
...
test/gpu/stream_sync.cpp
View file @
7a7040aa
...
...
@@ -24,6 +24,7 @@
#include <iostream>
#include <vector>
#include <migraphx/register_target.hpp>
#include <migraphx/gpu/context.hpp>
#include <migraphx/context.hpp>
#include <migraphx/gpu/compile_hip.hpp>
...
...
@@ -133,7 +134,7 @@ TEST_CASE(test_stream_sync)
auto
mult_out
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
x
,
y
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
mult_out
,
test_val
);
p
.
compile
(
migraphx
::
gpu
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"gpu"
)
);
// Run network and then verify with kernel
auto
args
=
p
.
eval
({{
"x"
,
ginput
},
{
"output"
,
goutput
}},
{
pstream
.
get
(),
true
});
...
...
test/marker.cpp
View file @
7a7040aa
...
...
@@ -22,12 +22,11 @@
* THE SOFTWARE.
*/
#include <migraphx/program.hpp>
#include <migraphx/ref/target.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/marker.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/register_target.hpp>
#include "test.hpp"
struct
mock_marker
...
...
@@ -64,7 +63,7 @@ TEST_CASE(marker)
auto
one
=
mm
->
add_literal
(
1
);
auto
two
=
mm
->
add_literal
(
2
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
one
,
two
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
mock_marker
temp_marker
;
p
.
mark
({},
temp_marker
);
...
...
test/module_test.cpp
View file @
7a7040aa
...
...
@@ -25,7 +25,7 @@
#include <migraphx/iterator_for.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/pass_manager.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/ranges.hpp>
#include <sstream>
#include "test.hpp"
...
...
test/onnx/verify_onnx.cpp
View file @
7a7040aa
...
...
@@ -26,7 +26,7 @@
#include <migraphx/literal.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/program.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/pass_manager.hpp>
#include <migraphx/verify.hpp>
#include <migraphx/onnx.hpp>
...
...
@@ -36,7 +36,7 @@
TEST_CASE
(
averagepool_notset_test
)
{
auto
p
=
migraphx
::
parse_onnx
(
"averagepool_notset_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
std
::
vector
<
float
>
data_x
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
};
migraphx
::
shape
s_x
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
5
,
5
}};
...
...
@@ -54,7 +54,7 @@ TEST_CASE(averagepool_notset_test)
TEST_CASE
(
averagepool_nt_cip_test
)
{
auto
p
=
migraphx
::
parse_onnx
(
"averagepool_nt_cip_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
std
::
vector
<
float
>
data_x
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
};
migraphx
::
shape
s_x
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
5
,
5
}};
...
...
@@ -72,7 +72,7 @@ TEST_CASE(averagepool_nt_cip_test)
TEST_CASE
(
batch_norm_flat_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"batch_norm_flat_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
x_shape
{
migraphx
::
shape
::
float_type
,
{
10
}};
migraphx
::
shape
c_shape
(
migraphx
::
shape
::
float_type
,
{
1
});
...
...
@@ -118,7 +118,7 @@ TEST_CASE(batch_norm_flat_test)
TEST_CASE
(
batch_norm_rank_2_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"batch_norm_rank_2_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
x_shape
{
migraphx
::
shape
::
float_type
,
{
2
,
5
}};
migraphx
::
shape
c_shape
(
migraphx
::
shape
::
float_type
,
{
5
});
...
...
@@ -155,7 +155,7 @@ TEST_CASE(batch_norm_rank_2_test)
TEST_CASE
(
batch_norm_1d_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"batch_norm_1d_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
x_shape
{
migraphx
::
shape
::
half_type
,
{
2
,
3
,
4
}};
migraphx
::
shape
c_shape
(
migraphx
::
shape
::
float_type
,
{
3
});
...
...
@@ -191,7 +191,7 @@ TEST_CASE(batch_norm_1d_test)
TEST_CASE
(
batch_norm_2d_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"batch_norm_2d_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
x_shape
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
,
4
}};
migraphx
::
shape
c_shape
(
migraphx
::
shape
::
float_type
,
{
3
});
...
...
@@ -257,7 +257,7 @@ TEST_CASE(batch_norm_2d_test)
TEST_CASE
(
batch_norm_3d_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"batch_norm_3d_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
x_shape
{
migraphx
::
shape
::
half_type
,
{
2
,
2
,
2
,
2
,
2
}};
migraphx
::
shape
c_shape
(
migraphx
::
shape
::
half_type
,
{
2
});
...
...
@@ -299,7 +299,7 @@ TEST_CASE(batch_norm_3d_test)
TEST_CASE
(
celu_verify_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"celu_verify_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
3
}};
std
::
vector
<
float
>
data
=
{
-
5.5
,
2.0
,
100.
,
7.0
,
0.
,
-
1.
};
...
...
@@ -321,7 +321,7 @@ TEST_CASE(celu_verify_test)
TEST_CASE
(
clip_args_type_mismatch
)
{
auto
p
=
migraphx
::
parse_onnx
(
"clip_test_args_type_mismatch.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s_0
{
migraphx
::
shape
::
float_type
,
{
3
,
3
}};
migraphx
::
parameter_map
pp
;
std
::
vector
<
float
>
data_0
=
{
0.9
,
1.2
,
1.7
,
1.9
,
2.2
,
2.7
,
2.9
,
3.2
,
3.7
};
...
...
@@ -337,7 +337,7 @@ TEST_CASE(clip_args_type_mismatch)
TEST_CASE
(
depthtospace_simple_test
)
{
auto
p
=
migraphx
::
parse_onnx
(
"depthtospace_simple_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
std
::
vector
<
float
>
data_in
(
48
);
std
::
iota
(
std
::
begin
(
data_in
),
std
::
end
(
data_in
),
0
);
migraphx
::
shape
s_x
{
migraphx
::
shape
::
float_type
,
{
1
,
8
,
2
,
3
}};
...
...
@@ -355,7 +355,7 @@ TEST_CASE(depthtospace_simple_test)
TEST_CASE
(
spacetodepth_simple_test
)
{
auto
p
=
migraphx
::
parse_onnx
(
"spacetodepth_simple_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
std
::
vector
<
float
>
data_in
(
48
);
std
::
iota
(
std
::
begin
(
data_in
),
std
::
end
(
data_in
),
0
);
migraphx
::
shape
s_x
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
4
,
6
}};
...
...
@@ -374,7 +374,7 @@ TEST_CASE(spacetodepth_depthtospace_test)
{
// space to depth
auto
p1
=
migraphx
::
parse_onnx
(
"spacetodepth_simple_test.onnx"
);
p1
.
compile
(
migraphx
::
ref
::
target
{}
);
p1
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
std
::
vector
<
float
>
data_in
(
48
);
std
::
iota
(
std
::
begin
(
data_in
),
std
::
end
(
data_in
),
0
);
migraphx
::
shape
s_x_1
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
4
,
6
}};
...
...
@@ -383,7 +383,7 @@ TEST_CASE(spacetodepth_depthtospace_test)
auto
result1
=
p1
.
eval
(
pp1
).
back
();
// depth to space
auto
p2
=
migraphx
::
parse_onnx
(
"depthtospace_simple_test.onnx"
);
p2
.
compile
(
migraphx
::
ref
::
target
{}
);
p2
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
parameter_map
pp2
;
pp2
[
"x"
]
=
result1
;
auto
result2
=
p2
.
eval
(
pp2
).
back
();
...
...
@@ -395,7 +395,7 @@ TEST_CASE(spacetodepth_depthtospace_test)
TEST_CASE
(
eyelike_verify_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"eyelike_verify_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
,
4
}};
std
::
vector
<
float
>
data
{
12
,
0
};
...
...
@@ -413,7 +413,7 @@ TEST_CASE(eyelike_verify_test)
TEST_CASE
(
eyelike_verify_negk_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"eyelike_verify_negk_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
,
4
}};
std
::
vector
<
float
>
data
{
12
,
0
};
...
...
@@ -431,7 +431,7 @@ TEST_CASE(eyelike_verify_negk_test)
TEST_CASE
(
gather_elements
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"gather_elements_axis0_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s_data
{
migraphx
::
shape
::
float_type
,
{
3
,
4
}};
std
::
vector
<
float
>
data
=
{
0.25
,
0.75
,
0.9375
,
0.4375
,
0.6875
,
0.5625
,
-
0.875
,
0.1875
,
-
0.125
,
0.5
,
-
0.9375
,
-
0.0625
};
...
...
@@ -454,7 +454,7 @@ TEST_CASE(gather_elements)
TEST_CASE
(
gemm_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"gemm_brcst_C_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
5
,
6
}};
std
::
vector
<
float
>
a_data
=
{
0.26472837
,
0.8525864
,
0.41929847
,
0.14151508
,
0.43216065
,
...
...
@@ -498,7 +498,7 @@ TEST_CASE(gemm_test)
TEST_CASE
(
gemm_half_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"gemm_half_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
half_type
,
{
8
,
6
}};
std
::
vector
<
float
>
tmp
=
{
0.2646
,
0.8525
,
0.4192
,
0.1415
,
0.4321
,
0.675
,
0.4248
,
0.8203
,
...
...
@@ -542,7 +542,7 @@ TEST_CASE(gemm_half_test)
TEST_CASE
(
greaterorequal_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"greaterorequal_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
}};
std
::
vector
<
float
>
data1
=
{
0.25
,
0.75
,
0.9375
};
...
...
@@ -563,7 +563,7 @@ TEST_CASE(greaterorequal_test)
TEST_CASE
(
hardsigmoid_verify_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"hardsigmoid_verify_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
5
}};
std
::
vector
<
float
>
data
=
{
-
10.0
,
-
2.5
,
-
1.0
,
-
0.5
,
0
,
1.0
,
2.0
,
2.5
,
2.6
,
100.0
};
...
...
@@ -587,7 +587,7 @@ TEST_CASE(hardsigmoid_verify_test)
TEST_CASE
(
if_else_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"if_else_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s_data
{
migraphx
::
shape
::
float_type
,
{
2
,
3
}};
std
::
vector
<
float
>
data
=
{
0.0625
,
0.75
,
-
0.0625
,
0.125
,
-
0.125
,
-
0.5625
};
migraphx
::
shape
bool_data
{
migraphx
::
shape
::
bool_type
,
{
1
}};
...
...
@@ -609,7 +609,7 @@ TEST_CASE(if_else_test)
TEST_CASE
(
if_else_test_inlined
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"if_else_test_inlined.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s_data
{
migraphx
::
shape
::
float_type
,
{
2
,
3
}};
std
::
vector
<
float
>
data
=
{
0.0625
,
0.75
,
-
0.0625
,
0.125
,
-
0.125
,
-
0.5625
};
...
...
@@ -628,7 +628,7 @@ TEST_CASE(if_else_test_inlined)
TEST_CASE
(
if_then_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"if_then_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s_data
{
migraphx
::
shape
::
float_type
,
{
2
,
3
}};
std
::
vector
<
float
>
data
=
{
0.0625
,
0.75
,
-
0.0625
,
0.125
,
-
0.125
,
-
0.5625
};
migraphx
::
shape
bool_data
{
migraphx
::
shape
::
bool_type
,
{
1
}};
...
...
@@ -651,7 +651,7 @@ TEST_CASE(if_then_test)
TEST_CASE
(
if_then_test_inlined
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"if_then_test_inlined.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s_data
{
migraphx
::
shape
::
float_type
,
{
2
,
3
}};
std
::
vector
<
float
>
data
=
{
0.0625
,
0.75
,
-
0.0625
,
0.125
,
-
0.125
,
-
0.5625
};
...
...
@@ -671,7 +671,7 @@ TEST_CASE(if_literal_test)
{
auto
run_prog
=
[](
bool
cond
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"if_literal_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s_data
{
migraphx
::
shape
::
bool_type
};
std
::
vector
<
char
>
data
=
{
static_cast
<
char
>
(
cond
)};
...
...
@@ -704,7 +704,7 @@ TEST_CASE(if_then_else_multi_output_shapes_inlined_test)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"if_then_else_multi_output_shapes_inlined_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
x_data
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
1
}};
migraphx
::
shape
y_data
{
migraphx
::
shape
::
float_type
,
{
2
,
3
}};
std
::
vector
<
float
>
data
=
{
0.0625
,
0.75
,
-
0.0625
,
0.125
,
-
0.125
,
-
0.5625
};
...
...
@@ -733,7 +733,7 @@ TEST_CASE(if_then_else_multi_output_shapes_inlined_test)
TEST_CASE
(
if_then_else_multi_output_shapes_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"if_then_else_multi_output_shapes_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s_data
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
1
}};
std
::
vector
<
float
>
data
=
{
0.0625
,
0.75
,
-
0.0625
,
0.125
,
-
0.125
,
-
0.5625
};
migraphx
::
shape
bool_data
{
migraphx
::
shape
::
bool_type
,
{
1
}};
...
...
@@ -765,7 +765,7 @@ TEST_CASE(if_pl_test)
{
auto
run_prog
=
[](
bool
cond
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"if_pl_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
xs
{
migraphx
::
shape
::
float_type
,
{
2
,
3
}};
migraphx
::
shape
ys
{
migraphx
::
shape
::
float_type
,
{
3
,
3
}};
migraphx
::
shape
cond_s
{
migraphx
::
shape
::
bool_type
};
...
...
@@ -805,7 +805,7 @@ TEST_CASE(if_tuple_test)
{
auto
run_prog
=
[](
bool
cond
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"if_tuple_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
xs
{
migraphx
::
shape
::
float_type
,
{
1
,
4
}};
migraphx
::
shape
ys
{
migraphx
::
shape
::
float_type
,
{
3
,
4
}};
migraphx
::
shape
cond_s
{
migraphx
::
shape
::
bool_type
};
...
...
@@ -854,7 +854,7 @@ TEST_CASE(instance_norm_test)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"instance_norm_val_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
result_vector
(
9
);
result
.
visit
([
&
](
auto
output
)
{
result_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -884,7 +884,7 @@ TEST_CASE(instance_norm_3d_test)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"instance_norm_val_3d_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
result_vector
(
16
);
result
.
visit
([
&
](
auto
output
)
{
result_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -912,7 +912,7 @@ TEST_CASE(instance_norm_3d_test)
TEST_CASE
(
lessorequal_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"lessorequal_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
}};
std
::
vector
<
float
>
data1
=
{
0.25
,
0.75
,
0.9375
};
...
...
@@ -933,7 +933,7 @@ TEST_CASE(lessorequal_test)
TEST_CASE
(
lpnormalization_1norm
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"lpnormalization_l1_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
,
4
}};
std
::
vector
<
float
>
data
{
0.
f
,
2.
f
,
-
2.
f
,
1.
f
,
1.
f
,
-
5.
f
,
3.
f
,
-
1.
f
,
-
4.
f
,
3.
f
,
0.
f
,
0.
f
};
migraphx
::
parameter_map
pp
;
...
...
@@ -961,7 +961,7 @@ TEST_CASE(lpnormalization_1norm)
TEST_CASE
(
lpnormalization_2norm
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"lpnormalization_l2_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
,
4
}};
std
::
vector
<
float
>
data
{
0.
f
,
2.
f
,
-
2.
f
,
1.
f
,
1.
f
,
-
5.
f
,
3.
f
,
-
1.
f
,
-
4.
f
,
3.
f
,
0.
f
,
0.
f
};
migraphx
::
parameter_map
pp
;
...
...
@@ -989,7 +989,7 @@ TEST_CASE(lpnormalization_2norm)
TEST_CASE
(
mean_broadcast_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"mean_broadcast_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s0
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
4
}};
std
::
vector
<
float
>
data0
(
12
,
1
);
...
...
@@ -1020,7 +1020,7 @@ TEST_CASE(mean_broadcast_test)
TEST_CASE
(
mean_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"mean_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
double_type
,
{
2
,
2
,
2
}};
const
int
num_elms
=
8
;
...
...
@@ -1047,7 +1047,7 @@ TEST_CASE(mean_test)
TEST_CASE
(
mean_integral_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"mean_integral_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
int32_type
,
{
2
,
2
,
2
}};
const
int
num_elms
=
8
;
...
...
@@ -1074,7 +1074,7 @@ TEST_CASE(mean_integral_test)
TEST_CASE
(
mod_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"mod_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
int32_type
,
{
3
,
3
,
3
}};
...
...
@@ -1101,7 +1101,7 @@ TEST_CASE(mod_test)
TEST_CASE
(
mod_test_different_types
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"mod_test_different_dtypes.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s_int16
{
migraphx
::
shape
::
int16_type
,
{
3
,
3
,
3
}};
migraphx
::
shape
s_int32
{
migraphx
::
shape
::
int32_type
,
{
3
,
3
,
3
}};
...
...
@@ -1129,7 +1129,7 @@ TEST_CASE(mod_test_different_types)
TEST_CASE
(
mod_test_fmod
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"mod_test_fmod.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
,
3
,
3
}};
...
...
@@ -1158,7 +1158,7 @@ TEST_CASE(mod_test_fmod)
TEST_CASE
(
mod_test_fmod_different_types
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"mod_test_fmod_different_dtypes.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s_float
{
migraphx
::
shape
::
float_type
,
{
3
,
3
,
3
}};
migraphx
::
shape
s_int
{
migraphx
::
shape
::
int32_type
,
{
3
,
3
,
3
}};
...
...
@@ -1188,7 +1188,7 @@ TEST_CASE(mod_test_fmod_different_types)
TEST_CASE
(
nonzero_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"nonzero_dynamic_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
bool_type
,
{
2
,
2
}};
std
::
vector
<
char
>
data
=
{
1
,
1
,
1
,
0
};
...
...
@@ -1207,7 +1207,7 @@ TEST_CASE(nonzero_test)
TEST_CASE
(
resize_downsample_f_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"resize_downsample_f_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
sx
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
2
,
4
}};
std
::
vector
<
float
>
dx
(
sx
.
elements
());
...
...
@@ -1228,7 +1228,7 @@ TEST_CASE(resize_downsample_f_test)
TEST_CASE
(
resize_upsample_linear_ac_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"resize_upsample_linear_ac_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
sx
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
2
,
2
}};
std
::
vector
<
float
>
dx
=
{
1.0
f
,
2.0
f
,
3.0
f
,
4.0
f
};
...
...
@@ -1263,7 +1263,7 @@ TEST_CASE(resize_upsample_linear_ac_test)
TEST_CASE
(
resize_upsample_linear_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"resize_upsample_linear_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
sx
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
2
,
2
}};
std
::
vector
<
float
>
dx
=
{
1.0
f
,
2.0
f
,
3.0
f
,
4.0
f
};
...
...
@@ -1284,7 +1284,7 @@ TEST_CASE(resize_upsample_linear_test)
TEST_CASE
(
resize_upsample_pf_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"resize_upsample_pf_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
sx
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
2
,
2
}};
std
::
vector
<
float
>
dx
=
{
1.0
f
,
2.0
f
,
3.0
f
,
4.0
f
};
...
...
@@ -1305,7 +1305,7 @@ TEST_CASE(resize_upsample_pf_test)
TEST_CASE
(
reversesequence_4D_verify_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"reversesequence_4D_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
xs
{
migraphx
::
shape
::
float_type
,
{
2
,
2
,
2
,
2
}};
std
::
vector
<
float
>
x_data
=
{
...
...
@@ -1326,7 +1326,7 @@ TEST_CASE(reversesequence_4D_verify_test)
TEST_CASE
(
reversesequence_batch_verify_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"reversesequence_batch_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
xs
{
migraphx
::
shape
::
float_type
,
{
4
,
4
}};
std
::
vector
<
float
>
x_data
=
{
...
...
@@ -1347,7 +1347,7 @@ TEST_CASE(reversesequence_batch_verify_test)
TEST_CASE
(
reversesequence_time_verify_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"reversesequence_time_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
xs
{
migraphx
::
shape
::
float_type
,
{
4
,
4
}};
std
::
vector
<
float
>
x_data
=
{
...
...
@@ -1368,7 +1368,7 @@ TEST_CASE(reversesequence_time_verify_test)
TEST_CASE
(
selu_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"selu_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
xs
{
migraphx
::
shape
::
double_type
,
{
2
,
3
}};
std
::
vector
<
double
>
x_data
=
{
1.1
,
2.1
,
0.0
,
-
1.3
,
-
5.3
,
12.0
};
...
...
@@ -1388,7 +1388,7 @@ TEST_CASE(selu_test)
TEST_CASE
(
size_verify_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"size_verify_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
5
,
3
}};
std
::
vector
<
float
>
data
(
30
,
1.
);
...
...
@@ -1403,7 +1403,7 @@ TEST_CASE(size_verify_test)
TEST_CASE
(
slice_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"slice_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
sh_data
{
migraphx
::
shape
::
float_type
,
{
3
,
2
}};
std
::
vector
<
float
>
data
=
{
0
,
1
,
2
,
3
,
4
,
5
};
...
...
@@ -1422,7 +1422,7 @@ TEST_CASE(slice_test)
TEST_CASE
(
slice_5arg_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"slice_5arg_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
sh_data
{
migraphx
::
shape
::
float_type
,
{
5
,
5
}};
// start
std
::
vector
<
float
>
data
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
...
...
@@ -1442,7 +1442,7 @@ TEST_CASE(slice_5arg_test)
TEST_CASE
(
slice_reverse_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"slice_5arg_reverse_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
sh_data
{
migraphx
::
shape
::
float_type
,
{
5
,
5
}};
// start
std
::
vector
<
float
>
data
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
...
...
@@ -1462,7 +1462,7 @@ TEST_CASE(slice_reverse_test)
TEST_CASE
(
slice_step_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"slice_5arg_step_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
sh_data
{
migraphx
::
shape
::
float_type
,
{
5
,
5
}};
// start
std
::
vector
<
float
>
data
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
...
...
@@ -1482,7 +1482,7 @@ TEST_CASE(slice_step_test)
TEST_CASE
(
softplus_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"softplus_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
5
}};
std
::
vector
<
float
>
data
=
{
0
,
1
,
2
,
3
,
4
};
...
...
@@ -1503,7 +1503,7 @@ TEST_CASE(softplus_test)
TEST_CASE
(
softsign_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"softsign_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
5
}};
std
::
vector
<
float
>
data
=
{
0
,
1
,
2
,
3
,
4
};
...
...
@@ -1543,7 +1543,7 @@ TEST_CASE(upsample_test)
TEST_CASE
(
where_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"where_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
shape
c_shape
{
migraphx
::
shape
::
bool_type
,
{
2
}};
std
::
vector
<
int8_t
>
c_data
=
{
1
,
0
};
...
...
test/perf_report.cpp
View file @
7a7040aa
...
...
@@ -22,10 +22,9 @@
* THE SOFTWARE.
*/
#include <migraphx/program.hpp>
#include <migraphx/ref/target.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/register_target.hpp>
#include "test.hpp"
TEST_CASE
(
perf_report
)
...
...
@@ -37,7 +36,7 @@ TEST_CASE(perf_report)
auto
one
=
mm
->
add_literal
(
1
);
auto
two
=
mm
->
add_literal
(
2
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
one
,
two
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
p
.
perf_report
(
ss
,
2
,
{});
std
::
string
output
=
ss
.
str
();
...
...
test/program_test.cpp
View file @
7a7040aa
...
...
@@ -25,7 +25,7 @@
#include <migraphx/program.hpp>
#include <migraphx/iterator_for.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <sstream>
#include <migraphx/apply_alpha_beta.hpp>
#include "test.hpp"
...
...
@@ -139,10 +139,10 @@ TEST_CASE(program_copy)
migraphx
::
program
p2
{};
p2
=
p1
;
p2
.
compile
(
migraphx
::
ref
::
target
{}
);
p2
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
EXPECT
(
p1
!=
p2
);
p1
.
compile
(
migraphx
::
ref
::
target
{}
);
p1
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
EXPECT
(
p1
==
p2
);
EXPECT
(
p1
.
get_parameter_names
()
==
p2
.
get_parameter_names
());
...
...
@@ -153,7 +153,7 @@ TEST_CASE(program_copy)
auto
p2
(
p1
);
EXPECT
(
p1
==
p2
);
p1
.
compile
(
migraphx
::
ref
::
target
{}
);
p1
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
EXPECT
(
p1
!=
p2
);
p2
=
p1
;
...
...
@@ -168,8 +168,8 @@ TEST_CASE(program_copy)
p2
=
p1
;
EXPECT
(
p1
==
p2
);
p1
.
compile
(
migraphx
::
ref
::
target
{}
);
p2
.
compile
(
migraphx
::
ref
::
target
{}
);
p1
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
p2
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
EXPECT
(
p1
==
p2
);
}
...
...
@@ -190,8 +190,8 @@ TEST_CASE(program_copy)
p2
=
p1
;
EXPECT
(
p2
==
p1
);
p1
.
compile
(
migraphx
::
ref
::
target
{}
);
p2
.
compile
(
migraphx
::
ref
::
target
{}
);
p1
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
p2
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
EXPECT
(
p2
==
p1
);
}
}
...
...
test/quantization.cpp
View file @
7a7040aa
...
...
@@ -27,7 +27,7 @@
#include <migraphx/operators.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/verify.hpp>
#include <migraphx/apply_alpha_beta.hpp>
#include <migraphx/quantization.hpp>
...
...
@@ -487,7 +487,7 @@ TEST_CASE(op_capture)
{
auto
p
=
create_program_float
();
auto
op_capture_p
=
create_program_op
();
migraphx
::
target
t
=
migraphx
::
ref
::
target
{}
;
migraphx
::
target
t
=
migraphx
::
make_
target
(
"ref"
)
;
std
::
size_t
param_index
=
0
;
migraphx
::
run_passes
(
p
,
{
migraphx
::
capture_arguments_pass
{{
"dot"
,
"convolution"
},
{},
&
param_index
}});
...
...
@@ -562,7 +562,7 @@ TEST_CASE(op_capture_subgraph)
{
auto
p
=
create_program
();
auto
op_capture_p
=
create_program_op
();
migraphx
::
target
t
=
migraphx
::
ref
::
target
{}
;
migraphx
::
target
t
=
migraphx
::
make_
target
(
"ref"
)
;
std
::
size_t
param_index
=
0
;
migraphx
::
run_passes
(
p
,
{
migraphx
::
capture_arguments_pass
{{
"dot"
,
"convolution"
},
{},
&
param_index
}});
...
...
@@ -1010,7 +1010,7 @@ TEST_CASE(target_copy)
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
,
3
}};
m
[
"x"
]
=
migraphx
::
generate_argument
(
s
);
std
::
vector
<
float
>
ref_result
;
migraphx
::
target
ref_t
=
migraphx
::
ref
::
target
{}
;
migraphx
::
target
ref_t
=
migraphx
::
make_
target
(
"ref"
)
;
run_prog
(
p
,
ref_t
,
m
,
ref_result
);
std
::
vector
<
float
>
orig_result
;
...
...
@@ -1074,7 +1074,7 @@ TEST_CASE(int8_quantization_dot)
m
[
"a"
]
=
migraphx
::
generate_argument
(
sa
,
get_hash
(
std
::
string
(
"a"
)));
m
[
"b"
]
=
migraphx
::
generate_argument
(
sb
,
get_hash
(
std
::
string
(
"b"
)));
std
::
vector
<
float
>
quant_result
;
migraphx
::
target
ref_t
=
migraphx
::
ref
::
target
{}
;
migraphx
::
target
ref_t
=
migraphx
::
make_
target
(
"ref"
)
;
run_prog
(
p
,
ref_t
,
m
,
quant_result
,
true
);
std
::
vector
<
float
>
no_quant_result
;
...
...
@@ -1119,7 +1119,7 @@ TEST_CASE(int8_quantization_conv)
{
auto
p
=
create_program
();
std
::
vector
<
float
>
quant_result
;
migraphx
::
target
ref_t
=
migraphx
::
ref
::
target
{}
;
migraphx
::
target
ref_t
=
migraphx
::
make_
target
(
"ref"
)
;
run_prog
(
p
,
ref_t
,
quant_result
,
true
);
std
::
vector
<
float
>
no_quant_result
;
...
...
@@ -1261,13 +1261,13 @@ TEST_CASE(test_op_capture)
auto
calc
=
[](
std
::
size_t
,
const
std
::
vector
<
migraphx
::
argument
>&
)
{};
migraphx
::
program
capture_p
=
p
;
migraphx
::
target
t
=
migraphx
::
ref
::
target
{}
;
migraphx
::
target
t
=
migraphx
::
make_
target
(
"ref"
)
;
std
::
size_t
param_index
=
0
;
migraphx
::
run_passes
(
capture_p
,
{
migraphx
::
capture_arguments_pass
{{
"dot"
},
calc
,
&
param_index
}});
p
.
compile
(
migraphx
::
ref
::
target
{}
);
capture_p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
capture_p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
cap_res
=
capture_p
.
eval
({}).
back
();
auto
res
=
p
.
eval
({}).
back
();
...
...
test/ref_dev_examples.cpp
View file @
7a7040aa
...
...
@@ -28,7 +28,7 @@
#include <migraphx/argument.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/verify.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/onnx.hpp>
#include "test.hpp"
...
...
@@ -54,7 +54,7 @@ TEST_CASE(add_two_literals)
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
one
,
two
);
// compile the program on the reference device
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
// evaulate the program and retreive the result
auto
result
=
p
.
eval
({}).
back
();
...
...
@@ -78,7 +78,7 @@ TEST_CASE(add_parameters)
// add the "add" instruction between the "x" parameter and "two" to the module
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
two
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
// create a parameter_map object for passing a value to the "x" parameter
std
::
vector
<
int
>
data
=
{
4
};
...
...
@@ -111,7 +111,7 @@ TEST_CASE(handling_tensors)
input
,
weights
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
// Allocated buffers by the user
std
::
vector
<
float
>
a
=
{
...
...
test/ref_dot_op_test.cpp
View file @
7a7040aa
...
...
@@ -25,7 +25,7 @@
#include <vector>
#include <migraphx/literal.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/verify.hpp>
#include <migraphx/onnx.hpp>
#include <migraphx/make_op.hpp>
...
...
@@ -76,7 +76,7 @@ void dot_2d_test()
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
get_type
<
T
>
{},
{
5
,
3
}};
auto
bl
=
mm
->
add_literal
(
migraphx
::
literal
{
b_shape
,
b
});
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
al
,
bl
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
T
>
results_vector
;
result
.
visit
([
&
](
auto
output
)
{
results_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -127,7 +127,7 @@ void dot_4d_test()
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
get_type
<
T
>
{},
{
1
,
1
,
5
,
3
}};
auto
bl
=
mm
->
add_literal
(
migraphx
::
literal
{
b_shape
,
b
});
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
al
,
bl
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
T
>
results_vector
;
result
.
visit
([
&
](
auto
output
)
{
results_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -164,7 +164,7 @@ TEST_CASE(dot_3D_test)
auto
l2
=
mm
->
add_literal
(
migraphx
::
literal
{
m2_shape
,
m2
});
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
l1
,
l2
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -240,7 +240,7 @@ TEST_CASE(dot_3D_C_test0)
migraphx
::
make_op
(
"dot"
),
alpha
,
beta
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -307,7 +307,7 @@ TEST_CASE(dot_3D_C_test1)
migraphx
::
make_op
(
"dot"
),
alpha
,
beta
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -349,7 +349,7 @@ TEST_CASE(dot_4D_test1)
auto
l2
=
mm
->
add_literal
(
migraphx
::
literal
{
m2_shape
,
m2
});
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
l1
,
l2
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -403,7 +403,7 @@ TEST_CASE(dot_4D_alpha_beta_test)
migraphx
::
make_op
(
"scalar"
,
{{
"scalar_bcst_dims"
,
m12_alpha
->
get_shape
().
lens
()}}),
l_beta
);
auto
m3_beta
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
b_beta
,
l3
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
m3_beta
,
m12_alpha
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -455,7 +455,7 @@ TEST_CASE(dot_4D_alpha_beta_C_test)
migraphx
::
make_op
(
"dot"
),
alpha
,
beta
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -525,7 +525,7 @@ TEST_CASE(dot_2D_C_test0)
-
0.835966
,
5.74736
,
4.22063
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -563,7 +563,7 @@ TEST_CASE(dot_vv_inner_product)
auto
ubl
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unsqueeze"
,
{{
"axes"
,
{
1
}}}),
bl
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
ual
,
ubl
);
std
::
vector
<
float
>
gold
=
{
-
1.43461
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -600,7 +600,7 @@ TEST_CASE(dot_vv_inner_product)
migraphx
::
add_apply_alpha_beta
(
*
mm
,
std
::
vector
<
migraphx
::
instruction_ref
>
{
ual
,
ubl
},
migraphx
::
make_op
(
"dot"
),
alpha
);
std
::
vector
<
float
>
gold
=
{
-
0.4590752
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -638,7 +638,7 @@ TEST_CASE(dot_vm)
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
ual
,
bl
);
std
::
vector
<
float
>
gold
=
{
-
3.78111
,
-
3.40007
,
-
2.1972
,
-
3.31448
,
-
3.80326
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -675,7 +675,7 @@ TEST_CASE(dot_vm)
*
mm
,
std
::
vector
<
migraphx
::
instruction_ref
>
{
ual
,
bl
},
migraphx
::
make_op
(
"dot"
),
alpha
);
std
::
vector
<
float
>
gold
=
{
-
1.89056
,
-
1.70003
,
-
1.0986
,
-
1.65724
,
-
1.90163
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -722,7 +722,7 @@ TEST_CASE(dot_vm)
1.38484
,
-
2.45019
,
-
1.35064
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -770,7 +770,7 @@ TEST_CASE(dot_vm)
0.290817
,
-
0.514539
,
-
0.283635
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -809,7 +809,7 @@ TEST_CASE(dot_mv)
auto
ubl
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unsqueeze"
,
{{
"axes"
,
{
1
}}}),
bl
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
al
,
ubl
);
std
::
vector
<
float
>
gold
=
{
1.31982
,
1.19022
,
-
1.96062
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -847,7 +847,7 @@ TEST_CASE(dot_mv)
migraphx
::
add_apply_alpha_beta
(
*
mm
,
std
::
vector
<
migraphx
::
instruction_ref
>
{
al
,
ubl
},
migraphx
::
make_op
(
"dot"
),
alpha
);
std
::
vector
<
float
>
gold
=
{
0.395946
,
0.357067
,
-
0.588187
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -891,7 +891,7 @@ TEST_CASE(dot_mv)
2.87146
,
3.29447
,
0.765651
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -945,7 +945,7 @@ TEST_CASE(dot_mm1)
-
0.557691
,
6.13527
,
-
2.91743
,
2.37836
,
-
6.42584
,
1.14979
,
0.77227
,
0.349659
,
2.92759
,
2.32384
,
-
2.90664
,
0.0527679
,
-
0.547761
,
-
0.155467
,
0.964619
,
2.09133
,
-
4.44281
,
-
1.3864
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -998,7 +998,7 @@ TEST_CASE(dot_mm1)
-
0.710558
,
0.259424
,
-
0.342345
,
-
1.80522
,
-
0.580476
,
0.277368
,
-
3.95582
,
0.614823
,
-
0.415107
,
0.305138
,
0.435993
,
-
0.107089
,
-
0.767885
,
-
4.00837
,
1.09921
,
-
2.02129
,
0.109717
,
0.618422
,
0.438342
,
0.29602
,
2.00928
,
0.420871
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1043,7 +1043,7 @@ TEST_CASE(dot_mm2)
1.83096922
,
2.5512663
,
-
1.07926588
,
-
2.12749134
,
0.33014536
,
-
0.80393025
,
0.60740202
,
0.95217761
,
-
1.06087445
,
-
4.75868152
,
-
3.6687713
,
-
1.26539821
};
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
al
,
bbl
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1085,7 +1085,7 @@ TEST_CASE(dot_mm2)
1.02442564e-01
,
-
1.87659303e+00
,
-
4.67302454e-01
,
9.16189968e-01
,
-
1.33537175e-01
,
8.27398578e-01
,
1.94406914e+00
,
-
2.39250915e-01
,
-
1.77062701e+00
,
-
6.46239534e-01
,
-
7.95202750e-01
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1137,7 +1137,7 @@ TEST_CASE(dot_mm2)
-
0.61459168
,
-
0.52561056
,
0.3309648
,
-
0.46185697
,
-
1.60586695
,
-
0.98590829
,
0.63012062
,
-
0.25606052
,
-
0.69419352
,
-
1.78299913
,
-
0.38572706
,
1.92249442
,
0.3884186
,
-
0.48153048
,
0.84932351
,
0.67234919
,
-
1.07821322
,
-
0.01208216
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1185,7 +1185,7 @@ TEST_CASE(dot_mm2)
1.38307367
,
0.42677257
,
0.83759966
,
-
0.34827442
,
-
1.45067092
,
2.09599671
,
1.92882983
,
-
0.30996324
,
2.19736278
,
2.32389426
,
2.36741832
,
1.62253915
,
0.26698225
,
-
0.00741609
,
-
2.53680983
,
-
0.0679954
,
0.04499683
,
0.85354276
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1202,7 +1202,7 @@ TEST_CASE(dot_dyn_2D_test)
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
5
,
3
}};
auto
bp
=
mm
->
add_parameter
(
"b"
,
b_shape
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
ap
,
bp
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
std
::
vector
<
float
>
a
=
{
-
0.00925222
,
0.56250403
,
0.70107397
,
0.75402161
,
-
0.505885
,
1.33628943
,
-
0.11413
,
-
0.31270559
,
1.59336732
,
-
0.19361027
,
...
...
@@ -1256,7 +1256,7 @@ TEST_CASE(dot_dyn_4D_test)
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
5
,
3
}};
auto
bl
=
mm
->
add_parameter
(
"b"
,
b_shape
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
al
,
bl
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
std
::
vector
<
float
>
a
=
{
-
0.00925222
,
0.56250403
,
0.70107397
,
0.75402161
,
-
0.505885
,
1.33628943
,
-
0.11413
,
-
0.31270559
,
1.59336732
,
-
0.19361027
,
...
...
@@ -1321,7 +1321,7 @@ TEST_CASE(quant_dot_2args_multi4)
370
,
392
,
414
,
436
,
458
,
496
,
534
,
572
,
610
,
648
,
686
,
724
,
762
,
688
,
742
,
796
,
850
,
904
,
958
,
1012
,
1066
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1349,7 +1349,7 @@ TEST_CASE(quant_dot_2args_multi4)
580
,
608
,
636
,
664
,
692
,
544
,
576
,
608
,
640
,
672
,
704
,
736
,
768
,
592
,
628
,
664
,
700
,
736
,
772
,
808
,
844
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1377,7 +1377,7 @@ TEST_CASE(quant_dot_2args_multi4)
302
,
390
,
478
,
566
,
654
,
62
,
214
,
366
,
518
,
670
,
822
,
974
,
1126
,
86
,
302
,
518
,
734
,
950
,
1166
,
1382
,
1598
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1407,7 +1407,7 @@ TEST_CASE(quant_dot_2args_multi4)
398
,
510
,
622
,
734
,
846
,
68
,
196
,
324
,
452
,
580
,
708
,
836
,
964
,
74
,
218
,
362
,
506
,
650
,
794
,
938
,
1082
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1435,7 +1435,7 @@ TEST_CASE(quant_dot_2args_general)
std
::
vector
<
int
>
gold
=
{
70
,
76
,
82
,
88
,
94
,
190
,
212
,
234
,
256
,
278
,
310
,
348
,
386
,
424
,
462
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1462,7 +1462,7 @@ TEST_CASE(quant_dot_2args_general)
std
::
vector
<
int
>
gold
=
{
210
,
228
,
246
,
264
,
282
,
240
,
262
,
284
,
306
,
328
,
270
,
296
,
322
,
348
,
374
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1490,7 +1490,7 @@ TEST_CASE(quant_dot_2args_general)
std
::
vector
<
int
>
gold
=
{
28
,
76
,
124
,
172
,
220
,
76
,
252
,
428
,
604
,
780
,
124
,
428
,
732
,
1036
,
1340
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1519,7 +1519,7 @@ TEST_CASE(quant_dot_2args_general)
std
::
vector
<
int
>
gold
=
{
126
,
342
,
558
,
774
,
990
,
144
,
408
,
672
,
936
,
1200
,
162
,
474
,
786
,
1098
,
1410
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1551,7 +1551,7 @@ TEST_CASE(quant_dot_3args_general)
std
::
vector
<
int
>
gold
=
{
982
,
1011
,
1040
,
1069
,
1098
,
1127
,
1156
,
2557
,
2650
,
2743
,
2836
,
2929
,
3022
,
3115
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1579,7 +1579,7 @@ TEST_CASE(quant_dot_3args_general)
std
::
vector
<
int
>
gold
=
{
70
,
76
,
82
,
88
,
94
,
190
,
212
,
234
,
256
,
278
,
310
,
348
,
386
,
424
,
462
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1610,7 +1610,7 @@ TEST_CASE(quant_dot_3args_general)
std
::
vector
<
int
>
gold
=
{
1966
,
2025
,
2084
,
2143
,
2202
,
2261
,
2320
,
2183
,
2250
,
2317
,
2384
,
2451
,
2518
,
2585
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1641,7 +1641,7 @@ TEST_CASE(quant_dot_3args_general)
std
::
vector
<
int
>
gold
=
{
286
,
737
,
1188
,
1639
,
2090
,
2541
,
2992
,
755
,
2230
,
3705
,
5180
,
6655
,
8130
,
9605
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1674,7 +1674,7 @@ TEST_CASE(quant_dot_3args_general)
std
::
vector
<
int
>
gold
=
{
844
,
2190
,
3536
,
4882
,
6228
,
7574
,
8920
,
942
,
2480
,
4018
,
5556
,
7094
,
8632
,
10170
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1710,7 +1710,7 @@ TEST_CASE(quant_dot_3args_batch)
5916
,
6004
,
6092
,
6180
,
6268
,
6356
,
9762
,
9866
,
9970
,
10074
,
10178
,
10282
,
10386
,
11288
,
11408
,
11528
,
11648
,
11768
,
11888
,
12008
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -1748,7 +1748,7 @@ TEST_CASE(quant_dot_3args_batch)
12258
,
13237
,
14216
,
15195
,
16174
,
17153
,
24012
,
25311
,
26610
,
27909
,
29208
,
30507
,
24618
,
25949
,
27280
,
28611
,
29942
,
31273
,
25224
,
26587
,
27950
,
29313
,
30676
,
32039
};
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
m
;
result
.
visit
([
&
](
auto
output
)
{
m
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
test/ref_loop_test.cpp
View file @
7a7040aa
...
...
@@ -27,7 +27,7 @@
#include <migraphx/literal.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/quantization.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/verify.hpp>
#include <migraphx/make_op.hpp>
...
...
@@ -72,7 +72,7 @@ static auto run_prog(int64_t iter_num, bool cond, int64_t ini_val)
};
auto
p
=
create_program
();
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
migraphx
::
parameter_map
pp
;
pp
[
"iter_num"
]
=
migraphx
::
argument
(
si
,
&
iter_num
);
pp
[
"ccond"
]
=
migraphx
::
argument
(
sc
,
&
cond
);
...
...
test/ref_ops_nonstd_shape_test.cpp
View file @
7a7040aa
...
...
@@ -25,7 +25,8 @@
#include <vector>
#include <migraphx/literal.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/ref/target.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/verify.hpp>
#include <migraphx/make_op.hpp>
...
...
@@ -41,7 +42,7 @@ TEST_CASE(argmax_test_nonstd_shape)
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
2
,
0
}}}),
dl
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"argmax"
,
{{
"axis"
,
-
3
}}),
dl_trans
);
auto
p_uncompiled
=
p
;
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
auto
res_gold
=
p_uncompiled
.
eval
({}).
back
();
std
::
vector
<
int64_t
>
result_vec
;
...
...
@@ -60,7 +61,7 @@ TEST_CASE(argmin_test_nonstd_shape)
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
2
,
0
}}}),
dl
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"argmin"
,
{{
"axis"
,
-
1
}}),
dl_trans
);
auto
p_uncompiled
=
p
;
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
auto
res_gold
=
p_uncompiled
.
eval
({}).
back
();
std
::
vector
<
int64_t
>
result_vec
;
...
...
@@ -82,7 +83,7 @@ TEST_CASE(isnan_broadcast_test)
auto
l1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"broadcast"
,
{{
"axis"
,
0
},
{
"out_lens"
,
s1
.
lens
()}}),
l0
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"isnan"
),
l1
);
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
results_vector
;
result
.
visit
([
&
](
auto
output
)
{
results_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
@@ -104,7 +105,7 @@ TEST_CASE(squeeze_transpose_test)
auto
*
mm_uncompiled
=
p_uncompiled
.
get_main_module
();
mm_uncompiled
->
add_instruction
(
migraphx
::
make_op
(
"contiguous"
),
std
::
prev
(
mm_uncompiled
->
end
()));
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
auto
expected_result
=
p_uncompiled
.
eval
({}).
back
();
EXPECT
(
result
.
get_shape
()
==
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
3
}});
...
...
@@ -124,7 +125,7 @@ TEST_CASE(squeeze_multibroadcast_test)
auto
*
mm_uncompiled
=
p_uncompiled
.
get_main_module
();
mm_uncompiled
->
add_instruction
(
migraphx
::
make_op
(
"contiguous"
),
std
::
prev
(
mm_uncompiled
->
end
()));
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
auto
expected_result
=
p_uncompiled
.
eval
({}).
back
();
EXPECT
(
result
.
get_shape
()
==
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
3
,
4
,
3
}});
...
...
@@ -144,7 +145,7 @@ TEST_CASE(squeeze_slice_test)
auto
*
mm_uncompiled
=
p_uncompiled
.
get_main_module
();
mm_uncompiled
->
add_instruction
(
migraphx
::
make_op
(
"contiguous"
),
std
::
prev
(
mm_uncompiled
->
end
()));
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
auto
expected_result
=
p_uncompiled
.
eval
({}).
back
();
EXPECT
(
result
.
get_shape
()
==
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
3
}});
...
...
@@ -164,7 +165,7 @@ TEST_CASE(unsqueeze_transpose_test)
auto
*
mm_uncompiled
=
p_uncompiled
.
get_main_module
();
mm_uncompiled
->
add_instruction
(
migraphx
::
make_op
(
"contiguous"
),
std
::
prev
(
mm_uncompiled
->
end
()));
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
auto
expected_result
=
p_uncompiled
.
eval
({}).
back
();
EXPECT
(
result
.
get_shape
()
==
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
1
,
3
}});
...
...
@@ -184,7 +185,7 @@ TEST_CASE(unsqueeze_multibroadcast_test)
auto
*
mm_uncompiled
=
p_uncompiled
.
get_main_module
();
mm_uncompiled
->
add_instruction
(
migraphx
::
make_op
(
"contiguous"
),
std
::
prev
(
mm_uncompiled
->
end
()));
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
auto
expected_result
=
p_uncompiled
.
eval
({}).
back
();
EXPECT
(
result
.
get_shape
()
==
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
4
,
1
,
3
,
3
}});
...
...
@@ -204,7 +205,7 @@ TEST_CASE(unsqueeze_slice_test)
auto
*
mm_uncompiled
=
p_uncompiled
.
get_main_module
();
mm_uncompiled
->
add_instruction
(
migraphx
::
make_op
(
"contiguous"
),
std
::
prev
(
mm_uncompiled
->
end
()));
p
.
compile
(
migraphx
::
ref
::
target
{}
);
p
.
compile
(
migraphx
::
make_
target
(
"ref"
)
);
auto
result
=
p
.
eval
({}).
back
();
auto
expected_result
=
p_uncompiled
.
eval
({}).
back
();
EXPECT
(
result
.
get_shape
()
==
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
1
,
3
,
4
,
1
}});
...
...
test/ref_ops_test.cpp
View file @
7a7040aa
...
...
@@ -30,7 +30,7 @@
#include <migraphx/op/pooling.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/quantization.hpp>
#include <migraphx/re
f/
target.hpp>
#include <migraphx/re
gister_
target.hpp>
#include <migraphx/verify.hpp>
#include <migraphx/onnx.hpp>
#include <migraphx/make_op.hpp>
...
...
@@ -52,7 +52,7 @@ TEST_CASE(abs_test)
migraphx::shape s{migraphx::shape::float_type, {2, 2}};
auto l = mm->add_literal(migraphx::literal{s, {-1, 2, -3, 4}});
mm->add_instruction(migraphx::make_op("abs"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(4);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -67,7 +67,7 @@ TEST_CASE(abs_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {{2, 8, 0}, {2, 2, 0}}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("abs"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> a = {-1, 2, -3, 4};
migraphx::parameter_map params0;
...
...
@@ -88,7 +88,7 @@ TEST_CASE(acos_test)
std::vector<float> data{-0.8f, 0.0f, 1.0f};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("acos"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -106,7 +106,7 @@ TEST_CASE(acos_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("acos"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-0.8f, 0.0f, 1.0f};
migraphx::parameter_map params0;
...
...
@@ -129,7 +129,7 @@ TEST_CASE(acosh_test)
std::vector<float> data{1.1f, 1.2f, 2.0f};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("acosh"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -148,7 +148,7 @@ TEST_CASE(acosh_dyn_test)
auto input = mm->add_parameter("X", s);
std::vector<float> input_data{1.1f, 1.2f, 2.0f};
mm->add_instruction(migraphx::make_op("acosh"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::parameter_map params0;
migraphx::shape input_fixed_shape0{migraphx::shape::float_type, {3}};
...
...
@@ -178,7 +178,7 @@ TEST_CASE(add_broadcast_test)
migraphx::make_op("broadcast", {{"axis", axis}, {"out_lens", l1->get_shape().lens()}}),
l2);
mm->add_instruction(migraphx::make_op("add"), l1, l3);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
EXPECT(result.get_shape().packed());
std::vector<float> results_vector(12);
...
...
@@ -200,7 +200,7 @@ TEST_CASE(add_broadcast_test)
auto l4 =
mm->add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", {2, 2, 3}}}), l2);
mm->add_instruction(migraphx::make_op("add"), l3, l4);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
EXPECT(result.get_shape().packed());
std::vector<float> results_vector(12);
...
...
@@ -218,7 +218,7 @@ TEST_CASE(add_test)
auto l1 = mm->add_literal(migraphx::literal{s, {-1, 0, 1}});
auto l2 = mm->add_literal(migraphx::literal{s, {1, 2, 3}});
mm->add_instruction(migraphx::make_op("add"), l1, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -235,7 +235,7 @@ TEST_CASE(add_dyn_test)
auto x = mm->add_parameter("x", s);
auto y = mm->add_parameter("y", s);
mm->add_instruction(migraphx::make_op("add"), x, y);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> x_data{-1, 0, 1};
std::vector<float> y_data{1, 2, 3};
...
...
@@ -261,7 +261,7 @@ TEST_CASE(argmax_test_0)
migraphx::shape data_shape{migraphx::shape::float_type, {2, 3, 4}};
auto dl = mm->add_literal(migraphx::literal{data_shape, data});
mm->add_instruction(migraphx::make_op("argmax", {{"axis", 0}}), dl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int64_t> result_vec;
result.visit([&](auto output) { result_vec.assign(output.begin(), output.end()); });
...
...
@@ -280,7 +280,7 @@ TEST_CASE(argmax_test_1)
migraphx::shape data_shape{migraphx::shape::float_type, {2, 3, 4}};
auto dl = mm->add_literal(migraphx::literal{data_shape, data});
mm->add_instruction(migraphx::make_op("argmax", {{"axis", 1}}), dl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int64_t> result_vec;
result.visit([&](auto output) { result_vec.assign(output.begin(), output.end()); });
...
...
@@ -299,7 +299,7 @@ TEST_CASE(argmax_test_2)
migraphx::shape data_shape{migraphx::shape::float_type, {2, 3, 4}};
auto dl = mm->add_literal(migraphx::literal{data_shape, data});
mm->add_instruction(migraphx::make_op("argmax", {{"axis", 2}}), dl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int64_t> result_vec;
result.visit([&](auto output) { result_vec.assign(output.begin(), output.end()); });
...
...
@@ -318,7 +318,7 @@ TEST_CASE(argmax_test_neg_2)
migraphx::shape data_shape{migraphx::shape::float_type, {2, 3, 4}};
auto dl = mm->add_literal(migraphx::literal{data_shape, data});
mm->add_instruction(migraphx::make_op("argmax", {{"axis", -2}}), dl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int64_t> result_vec;
result.visit([&](auto output) { result_vec.assign(output.begin(), output.end()); });
...
...
@@ -333,7 +333,7 @@ TEST_CASE(argmax_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {{2, 2, 0}, {3, 6, 0}, {3, 6, 0}}};
auto dl = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("argmax", {{"axis", 0}}), dl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> data = {1.2255, 1.6834, -2.0305, -0.3221, 0.4701, 0.2583, 0.7545, 2.5758,
-1.6849, 0.0928, 0.9022, -0.8765, -0.4090, 0.9301, 2.0724, -1.5706,
...
...
@@ -359,7 +359,7 @@ TEST_CASE(argmin_test_0)
migraphx::shape data_shape{migraphx::shape::float_type, {2, 3, 4}};
auto dl = mm->add_literal(migraphx::literal{data_shape, data});
mm->add_instruction(migraphx::make_op("argmin", {{"axis", 0}}), dl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int64_t> result_vec;
result.visit([&](auto output) { result_vec.assign(output.begin(), output.end()); });
...
...
@@ -378,7 +378,7 @@ TEST_CASE(argmin_test_1)
migraphx::shape data_shape{migraphx::shape::float_type, {2, 3, 4}};
auto dl = mm->add_literal(migraphx::literal{data_shape, data});
mm->add_instruction(migraphx::make_op("argmin", {{"axis", 1}}), dl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int64_t> result_vec;
result.visit([&](auto output) { result_vec.assign(output.begin(), output.end()); });
...
...
@@ -397,7 +397,7 @@ TEST_CASE(argmin_test_2)
migraphx::shape data_shape{migraphx::shape::float_type, {2, 3, 4}};
auto dl = mm->add_literal(migraphx::literal{data_shape, data});
mm->add_instruction(migraphx::make_op("argmin", {{"axis", 2}}), dl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int64_t> result_vec;
result.visit([&](auto output) { result_vec.assign(output.begin(), output.end()); });
...
...
@@ -416,7 +416,7 @@ TEST_CASE(argmin_test_neg_1)
migraphx::shape data_shape{migraphx::shape::float_type, {2, 3, 4}};
auto dl = mm->add_literal(migraphx::literal{data_shape, data});
mm->add_instruction(migraphx::make_op("argmin", {{"axis", -1}}), dl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int64_t> result_vec;
result.visit([&](auto output) { result_vec.assign(output.begin(), output.end()); });
...
...
@@ -432,7 +432,7 @@ TEST_CASE(asin_test)
std::vector<float> data{-0.5f, 0.0f, 0.9f};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("asin"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -450,7 +450,7 @@ TEST_CASE(asin_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("asin"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-0.5f, 0.0f, 0.9f};
migraphx::parameter_map params0;
...
...
@@ -473,7 +473,7 @@ TEST_CASE(asinh_test)
std::vector<float> data{-0.5f, 0.0f, 0.9f};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("asinh"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -491,7 +491,7 @@ TEST_CASE(asinh_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("asinh"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-0.5f, 0.0f, 0.9f};
migraphx::parameter_map params0;
...
...
@@ -514,7 +514,7 @@ TEST_CASE(atan_test)
std::vector<float> data{-1.0f, 0.0f, 1.0f};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("atan"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -532,7 +532,7 @@ TEST_CASE(atan_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("atan"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-1.0f, 0.0f, 1.0f};
migraphx::parameter_map params0;
...
...
@@ -555,7 +555,7 @@ TEST_CASE(atanh_test)
std::vector<float> data{0.4435683f, 0.6223626f, 0.316958f};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("atanh"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -573,7 +573,7 @@ TEST_CASE(atanh_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("atanh"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{0.4435683f, 0.6223626f, 0.316958f};
migraphx::parameter_map params0;
...
...
@@ -602,7 +602,7 @@ TEST_CASE(avgpool_rank3_test)
std::vector<float> data{0.3, 0.2, 0.4, 0.1, 0.8, 0.5, 0.9, 0.1, 0.1, 0.7, 0.1, 0.6};
auto l0 = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(op, l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
...
...
@@ -623,7 +623,7 @@ TEST_CASE(avgpool_dyn_test)
{"padding", {0}},
{"stride", {1}}}),
x);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> data{0.3, 0.2, 0.4, 0.1, 0.8, 0.5, 0.9, 0.1, 0.1, 0.7, 0.1, 0.6};
migraphx::shape input_fixed_shape{migraphx::shape::float_type, {1, 3, 4}};
...
...
@@ -665,7 +665,7 @@ TEST_CASE(avgpool_rank3_stride2_test)
-0.2915};
auto l0 = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(op, l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -708,7 +708,7 @@ TEST_CASE(avgpool_rank5_test)
1.705, 0.444, -0.835, -0.506, 0.101, 0.602, 0.543, 0.357, 1.042};
auto l0 = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(op, l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -733,7 +733,7 @@ TEST_CASE(broadcast_test)
auto l2 = mm->add_literal(migraphx::literal{b_shape, b_data});
mm->add_instruction(
migraphx::make_op("broadcast", {{"axis", axis}, {"out_lens", l1->get_shape().lens()}}), l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
auto output = result.get<int32_t>();
EXPECT(output(0, 0) == -2);
...
...
@@ -754,7 +754,7 @@ TEST_CASE(broadcast_2in_static_test)
auto l1 = mm->add_literal(migraphx::literal{a_shape, a_data});
auto l2 = mm->add_literal(migraphx::literal{b_shape, b_data});
mm->add_instruction(migraphx::make_op("broadcast", {{"axis", axis}}), l2, l1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
auto output = result.get<int32_t>();
EXPECT(output(0, 0) == -2);
...
...
@@ -774,7 +774,7 @@ TEST_CASE(broadcast_2in_dyn_test)
auto pa = mm->add_parameter("a", a_shape);
auto lb = mm->add_literal(migraphx::literal{b_shape, b_data});
mm->add_instruction(migraphx::make_op("broadcast", {{"axis", axis}}), lb, pa);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<int32_t> a_data{0, 0, 0, 0};
migraphx::shape input_fixed_shape0{migraphx::shape::int32_type, {2, 2}};
...
...
@@ -796,7 +796,7 @@ TEST_CASE(ceil_test)
std::vector<float> data = {1.1, 1.5, 1.6, -1.1, -1.5, -1.6, 0.0, 2.0, -2.0};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("ceil"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -814,7 +814,7 @@ TEST_CASE(ceil_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("ceil"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data = {1.1, 1.5, 1.6, -1.1, -1.5, -1.6, 0.0, 2.0, -2.0};
migraphx::parameter_map params0;
...
...
@@ -842,7 +842,7 @@ TEST_CASE(clip_test)
max_val =
mm->add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", {3}}}), max_val);
mm->add_instruction(migraphx::make_op("clip"), l, min_val, max_val);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -866,7 +866,7 @@ TEST_CASE(concat_test)
auto l1 = mm->add_literal(migraphx::literal{s1, data1});
auto l2 = mm->add_literal(migraphx::literal{s2, data2});
mm->add_instruction(migraphx::make_op("concat", {{"axis", axis}}), l0, l1, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int> gold = {0, 1, 2, 3, 4, 10, 5, 6, 7, 8, 9, 20};
std::vector<int> results_vector(2 * 6);
...
...
@@ -891,7 +891,7 @@ TEST_CASE(concat_test)
auto l1 = mm->add_literal(migraphx::literal{s1, data1});
auto l2 = mm->add_literal(migraphx::literal{s2, data2});
mm->add_instruction(migraphx::make_op("concat", {{"axis", axis}}), l0, l1, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int> gold = {0, 1, 2, 3, 4, 10, 5, 6, 7, 8, 9, 20};
std::vector<int> results_vector(2 * 6);
...
...
@@ -916,7 +916,7 @@ TEST_CASE(concat_test)
auto l1 = mm->add_literal(migraphx::literal{s1, data1});
auto l2 = mm->add_literal(migraphx::literal{s2, data2});
mm->add_instruction(migraphx::make_op("concat", {{"axis", axis}}), l0, l1, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int> gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
std::vector<int> results_vector(6 * 2);
...
...
@@ -941,7 +941,7 @@ TEST_CASE(concat_test)
auto l1 = mm->add_literal(migraphx::literal{s1, data1});
auto l2 = mm->add_literal(migraphx::literal{s2, data2});
mm->add_instruction(migraphx::make_op("concat", {{"axis", axis}}), l0, l1, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int> gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
std::vector<int> results_vector(6 * 2);
...
...
@@ -966,7 +966,7 @@ TEST_CASE(concat_dyn_test)
auto input1 = mm->add_parameter("Y", s1);
auto input2 = mm->add_parameter("Z", s2);
mm->add_instruction(migraphx::make_op("concat", {{"axis", axis}}), input0, input1, input2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::shape static_shape0{migraphx::shape::int32_type, {2, 2}};
migraphx::shape static_shape1{migraphx::shape::int32_type, {3, 2}};
...
...
@@ -998,7 +998,7 @@ TEST_CASE(contiguous_test)
auto* mm = p.get_main_module();
auto l = mm->add_literal(migraphx::literal{a_shape, data});
mm->add_instruction(migraphx::make_op("contiguous"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<size_t> new_strides = {12, 4, 2, 1};
...
...
@@ -1018,7 +1018,7 @@ TEST_CASE(contiguous_param_test)
migraphx::shape a_shape{migraphx::shape::float_type, {1, 3, 2, 2}, {12, 1, 6, 3}};
auto a = mm->add_parameter("X", a_shape);
mm->add_instruction(migraphx::make_op("contiguous"), a);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> data(12);
std::iota(data.begin(), data.end(), 0);
...
...
@@ -1043,7 +1043,7 @@ TEST_CASE(contiguous_dyn_test)
{{1, 1, 0}, {2, 6, 0}, {2, 2, 0}, {2, 2, 0}}};
auto input = mm->add_parameter("X", dyn_shape);
mm->add_instruction(migraphx::make_op("contiguous"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::shape static_shape{migraphx::shape::float_type, {1, 3, 2, 2}, {12, 1, 6, 3}};
std::vector<float> data(12);
...
...
@@ -1077,7 +1077,7 @@ TEST_CASE(conv_dyn_batch_test)
input,
weights);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> a = {
2.71567607, -0.9960829, 0.91671127, 0.28140706, 0.63235772, 0.08077253, 0.80927712,
...
...
@@ -1194,7 +1194,7 @@ TEST_CASE(conv_dyn_img_shape_test)
input,
weights);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> a = {0.28007596, 0.46114671, 0.12171969, 0.52260835, 0.40916841, 0.07163955,
0.09896668, 0.98628836, 0.69406788, 0.44868846, 0.64017681, 0.27048886,
...
...
@@ -1283,7 +1283,7 @@ TEST_CASE(conv_dyn_weights_shape_test)
input,
weights);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> a = {0.28007596, 0.46114671, 0.12171969, 0.52260835, 0.40916841, 0.07163955,
0.09896668, 0.98628836, 0.69406788, 0.44868846, 0.64017681, 0.27048886,
...
...
@@ -1363,7 +1363,7 @@ TEST_CASE(conv_dyn_img_same_upper_test)
input,
weights);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> a = {0.63321185, 0.6466339, 0.8515352, 0.44240063, 0.5018913, 0.5068494,
0.75330657, 0.7383877, 0.15870683, 0.8171611, 0.56118083, 0.87004256,
...
...
@@ -1434,7 +1434,7 @@ TEST_CASE(conv_dyn_kernel_same_upper_test)
input,
weights);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> a = {0.63321185, 0.6466339, 0.8515352, 0.44240063, 0.5018913, 0.5068494,
0.75330657, 0.7383877, 0.15870683, 0.8171611, 0.56118083, 0.87004256,
...
...
@@ -1508,7 +1508,7 @@ TEST_CASE(conv_dyn_kernel_same_lower_test)
input,
weights);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> a = {0.63321185, 0.6466339, 0.8515352, 0.44240063, 0.5018913, 0.5068494,
0.75330657, 0.7383877, 0.15870683, 0.8171611, 0.56118083, 0.87004256,
...
...
@@ -1619,7 +1619,7 @@ TEST_CASE(conv2d_padding_stride_test)
mm->add_instruction(
migraphx::make_op("convolution", {{"padding", {1, 1}}, {"stride", {2, 2}}}), al, cl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(16);
...
...
@@ -1677,7 +1677,7 @@ TEST_CASE(conv2d_padding_test)
mm->add_instruction(
migraphx::make_op("convolution", {{"padding", {1, 1}}, {"stride", {1, 1}}}), al, cl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(64);
...
...
@@ -1741,7 +1741,7 @@ TEST_CASE(conv2d_test)
auto cl = mm->add_literal(migraphx::literal{c_shape, c});
mm->add_instruction(migraphx::make_op("convolution"), al, cl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(16);
...
...
@@ -1809,7 +1809,7 @@ TEST_CASE(conv3d_test)
{{"padding", {0, 0, 0}}, {"stride", {1, 1, 1}}, {"dilation", {1, 1, 1}}}),
al,
cl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(16);
...
...
@@ -1825,7 +1825,7 @@ TEST_CASE(cos_test)
std::vector<float> data{-1, 0, 1};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("cos"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -1843,7 +1843,7 @@ TEST_CASE(cos_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("cos"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-1, 0, 1};
migraphx::parameter_map params0;
...
...
@@ -1866,7 +1866,7 @@ TEST_CASE(cosh_test)
std::vector<float> data = {-1.0, 2.0, -3.0, 4.0};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("cosh"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(4);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -1884,7 +1884,7 @@ TEST_CASE(cosh_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("cosh"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data = {-1.0, 2.0, -3.0, 4.0};
migraphx::parameter_map params0;
...
...
@@ -1916,7 +1916,7 @@ TEST_CASE(deconv_1d_test)
migraphx::make_op("deconvolution", {{"padding", {0}}, {"stride", {1}}, {"dilation", {1}}}),
x,
w);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
...
...
@@ -1965,7 +1965,7 @@ TEST_CASE(deconv_3d_test)
{{"padding", {0, 0, 0}}, {"stride", {1, 1, 1}}, {"dilation", {1, 1, 1}}}),
x,
w);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
...
...
@@ -1988,7 +1988,7 @@ TEST_CASE(deconv_test)
auto w = mm->add_literal(migraphx::literal{s, w_data});
mm->add_instruction(migraphx::make_op("deconvolution"), x, w);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
...
...
@@ -2016,7 +2016,7 @@ TEST_CASE(dequantizelinear)
};
migraphx::program p1 = create_program();
p1.compile(migraphx::
ref::
target
{}
);
p1.compile(migraphx::
make_
target
("ref")
);
auto result = p1.eval({}).back();
std::vector<float> results_vector(9);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -2039,7 +2039,7 @@ TEST_CASE(dequantizelinear)
};
migraphx::program p1 = create_program();
p1.compile(migraphx::
ref::
target
{}
);
p1.compile(migraphx::
make_
target
("ref")
);
auto result = p1.eval({}).back();
std::vector<float> results_vector(9);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -2058,7 +2058,7 @@ TEST_CASE(div_test)
auto l1 = mm->add_literal(migraphx::literal{s, data1});
auto l2 = mm->add_literal(migraphx::literal{s, data2});
mm->add_instruction(migraphx::make_op("div"), l1, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -2076,7 +2076,7 @@ TEST_CASE(div_dyn_test)
auto x = mm->add_parameter("x", s);
auto y = mm->add_parameter("y", s);
mm->add_instruction(migraphx::make_op("div"), x, y);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> x_data{-1.0f, 0.5f, 1.0f};
std::vector<float> y_data{1.0f, 2.0f, 4.0f};
...
...
@@ -2101,7 +2101,7 @@ TEST_CASE(elu_test)
auto l = mm->add_literal(migraphx::literal{s, {-1.0, 2.0, -3.0, 4.0}});
float alpha = 0.5;
mm->add_instruction(migraphx::make_op("elu", {{"alpha", alpha}}), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(4);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -2118,7 +2118,7 @@ TEST_CASE(elu_dyn_test)
auto input = mm->add_parameter("X", s);
float alpha = 0.5;
mm->add_instruction(migraphx::make_op("elu", {{"alpha", alpha}}), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-1.0, 2.0, -3.0, 4.0};
migraphx::parameter_map params0;
...
...
@@ -2148,7 +2148,7 @@ TEST_CASE(equal_brcst_test)
eq);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<bool> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -2172,7 +2172,7 @@ TEST_CASE(equal_test)
eq);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<bool> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -2194,7 +2194,7 @@ TEST_CASE(equal_dyn_test)
{{"target_type", migraphx::to_value(migraphx::shape::bool_type)}}),
eq);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> l_data{1.1, 1.5, 0.1, -1.1, -1.5, -0.6, 0.0, 2.0, -2.0};
std::vector<float> r_data{1.1, 1.6, -0.1, -1.2, -1.5, -0.7, 0.0, 2.3, -2.1};
...
...
@@ -2217,7 +2217,7 @@ TEST_CASE(erf_test)
std::vector<float> data = {0.73785057, 1.58165966, -0.43597795, -0.01677432};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("erf"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -2235,7 +2235,7 @@ TEST_CASE(erf_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("erf"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data = {0.73785057, 1.58165966, -0.43597795, -0.01677432};
migraphx::parameter_map params0;
...
...
@@ -2258,7 +2258,7 @@ TEST_CASE(exp_test)
migraphx::shape s{migraphx::shape::float_type, {3}};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("exp"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -2276,7 +2276,7 @@ TEST_CASE(exp_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("exp"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-1, 0, 1};
migraphx::parameter_map params0;
...
...
@@ -2299,7 +2299,7 @@ TEST_CASE(floor_test)
std::vector<float> data = {1.1, 1.5, 0.6, -1.1, -1.5, -0.6, 0.0, 2.0, -2.0};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("floor"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -2317,7 +2317,7 @@ TEST_CASE(floor_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("floor"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data = {1.1, 1.5, 0.6, -1.1, -1.5, -0.6, 0.0, 2.0, -2.0};
migraphx::parameter_map params0;
...
...
@@ -2343,7 +2343,7 @@ TEST_CASE(fp16_test)
auto l0 = mm->add_literal(migraphx::literal{s, {a}});
auto l1 = mm->add_literal(migraphx::literal{s, {b}});
mm->add_instruction(migraphx::make_op("add"), l0, l1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<migraphx::half> results_vector(1);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -2369,7 +2369,7 @@ TEST_CASE(fp32_fp16_test)
std::vector<float> gold_res = {2.0, 4.0, 6.0, 8.0, 10.0, 12.0};
auto p = create_program();
migraphx::quantize_fp16(p, op_names);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res;
result.visit([&](auto output) { res.assign(output.begin(), output.end()); });
...
...
@@ -2421,7 +2421,7 @@ TEST_CASE(gather_test)
auto a1 = mm->add_literal(migraphx::literal{s_indices, indices});
int axis = 0;
mm->add_instruction(migraphx::make_op("gather", {{"axis", axis}}), a0, a1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res_data(4 * 5);
std::vector<float> golden = {0.5f, 1.5f, 2.5f, 6.5f, 7.5f, 8.5f};
...
...
@@ -2442,7 +2442,7 @@ TEST_CASE(gather_test)
auto a1 = mm->add_literal(migraphx::literal{s_indices, indices});
int axis = 0;
mm->add_instruction(migraphx::make_op("gather", {{"axis", axis}}), a0, a1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res_data(4 * 5);
std::vector<float> golden = {0.5f, 1.5f, 2.5f, 6.5f, 7.5f, 8.5f};
...
...
@@ -2463,7 +2463,7 @@ TEST_CASE(gather_test)
auto a1 = mm->add_literal(migraphx::literal{s_indices, indices});
int axis = 1;
mm->add_instruction(migraphx::make_op("gather", {{"axis", axis}}), a0, a1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res_data(4 * 5);
std::vector<float> golden = {0.5f, 2.5f, 3.5f, 5.5f, 6.5f, 8.5f};
...
...
@@ -2484,7 +2484,7 @@ TEST_CASE(gather_test)
auto a1 = mm->add_literal(migraphx::literal{s_indices, indices});
int axis = -1;
mm->add_instruction(migraphx::make_op("gather", {{"axis", axis}}), a0, a1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res_data(4 * 5);
std::vector<float> golden = {0.5f, 2.5f, 3.5f, 5.5f, 6.5f, 8.5f};
...
...
@@ -2506,7 +2506,7 @@ TEST_CASE(gather_test)
auto a1 = mm->add_literal(migraphx::literal{s_indices, indices});
int axis = -1;
mm->add_instruction(migraphx::make_op("gather", {{"axis", axis}}), a0, a1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res_data{};
std::vector<float> golden = {0.5f, 3.5f, 6.5f};
...
...
@@ -2528,7 +2528,7 @@ TEST_CASE(gather_test)
auto a1 = mm->add_literal(migraphx::literal{s_indices, indices});
int axis = -1;
mm->add_instruction(migraphx::make_op("gather", {{"axis", axis}}), a0, a1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res_data{};
std::vector<float> golden = {0.5f, 3.5f, 6.5f};
...
...
@@ -2550,7 +2550,7 @@ TEST_CASE(gather_test)
auto a1 = mm->add_literal(migraphx::literal{s_indices, indices});
int axis = -1;
mm->add_instruction(migraphx::make_op("gather", {{"axis", axis}}), a0, a1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res_data{};
std::vector<float> golden = {0.5f};
...
...
@@ -2575,7 +2575,7 @@ TEST_CASE(gather_dyn_test0)
migraphx::shape sresult{migraphx::shape::int32_type, {{2, 5, 0}, {1, 1, 0}, {2, 2, 0}}};
EXPECT(p.get_output_shapes().back() == sresult);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::shape input_fixed_shape{migraphx::shape::int32_type, {2, 3}};
migraphx::shape input_indices{migraphx::shape::int32_type, {1, 2}};
...
...
@@ -2609,7 +2609,7 @@ TEST_CASE(gather_dyn_test1)
migraphx::shape sresult{migraphx::shape::int32_type, {{1, 8, 7}, {2, 3, 3}, {4, 4, 0}}};
EXPECT(p.get_output_shapes().back() == sresult);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::shape input_fixed_shape{migraphx::shape::int32_type, {3, 4}};
migraphx::shape input_indices_shape{migraphx::shape::int32_type, {1, 2}};
...
...
@@ -2648,7 +2648,7 @@ TEST_CASE(gathernd_test)
auto indices = mm->add_literal(migraphx::literal{is, indices_vec});
mm->add_instruction(migraphx::make_op("gathernd"), data, indices);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res_data{};
std::vector<float> gold{0, 3};
...
...
@@ -2672,7 +2672,7 @@ TEST_CASE(gathernd_test)
auto indices = mm->add_literal(migraphx::literal{is, indices_vec});
mm->add_instruction(migraphx::make_op("gathernd"), data, indices);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res_data{};
std::vector<float> gold{2, 3, 0, 1};
...
...
@@ -2696,7 +2696,7 @@ TEST_CASE(gathernd_test)
auto indices = mm->add_literal(migraphx::literal{is, indices_vec});
mm->add_instruction(migraphx::make_op("gathernd"), data, indices);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res_data{};
std::vector<float> gold{3, 4, 5, 0, 1, 2, 0, 1, 2, 3, 4, 5};
...
...
@@ -2722,7 +2722,7 @@ TEST_CASE(gathernd_test)
mm->add_instruction(
migraphx::make_op("gathernd", {{"batch_dims", batch_dims}}), data, indices);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res_data{};
std::vector<float> gold{0, 1, 2, 3, 4, 5, 18, 19, 20, 21, 22, 23};
...
...
@@ -2749,7 +2749,7 @@ TEST_CASE(gathernd_test)
mm->add_instruction(
migraphx::make_op("gathernd", {{"batch_dims", batch_dims}}), data, indices);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res_data{};
std::vector<float> gold{0, 4, 8, 11, 13, 15};
...
...
@@ -2797,7 +2797,7 @@ TEST_CASE(gathernd_dynamic0)
auto gathernd = mm->add_instruction(gathernd_op, xdata, xindex);
mm->add_return({gathernd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::parameter_map params;
migraphx::shape input_fixed_shape0{migraphx::shape::float_type, {2, 3, 1}}; // data
...
...
@@ -2834,7 +2834,7 @@ TEST_CASE(gathernd_dynamic1)
auto gathernd = mm->add_instruction(gathernd_op, xdata, xindex);
mm->add_return({gathernd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::parameter_map params;
migraphx::shape input_fixed_shape0{migraphx::shape::float_type, {2, 3, 1}}; // data
...
...
@@ -2870,7 +2870,7 @@ TEST_CASE(gathernd_dynamic2)
auto gathernd = mm->add_instruction(gathernd_op, xdata, xindex);
mm->add_return({gathernd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::parameter_map params;
migraphx::shape input_fixed_shape0{migraphx::shape::float_type, {2, 3, 1}}; // data
...
...
@@ -2907,7 +2907,7 @@ TEST_CASE(gathernd_dynamic3)
auto gathernd = mm->add_instruction(gathernd_op, xdata, xindex);
mm->add_return({gathernd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::parameter_map params;
migraphx::shape input_fixed_shape0{migraphx::shape::float_type, {2, 3, 1}}; // data
...
...
@@ -2943,7 +2943,7 @@ TEST_CASE(gathernd_dynamic4)
auto gathernd = mm->add_instruction(gathernd_op, xdata, xindex);
mm->add_return({gathernd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::parameter_map params;
migraphx::shape input_fixed_shape0{migraphx::shape::float_type, {2}}; // data
...
...
@@ -2979,7 +2979,7 @@ TEST_CASE(gathernd_negative_index_test)
auto indices = mm->add_literal(migraphx::literal{is, indices_vec});
mm->add_instruction(migraphx::make_op("gathernd"), data, indices);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> res_data{};
std::vector<float> gold{2, 3, 0, 1};
...
...
@@ -3003,7 +3003,7 @@ TEST_CASE(gathernd_negative_index_test)
auto indices = mm->add_literal(migraphx::literal{is, indices_vec});
mm->add_instruction(migraphx::make_op("gathernd"), data, indices);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
EXPECT(test::throws([&] { p.eval({}); }));
}
...
...
@@ -3021,7 +3021,7 @@ TEST_CASE(globalavgpool_test)
std::vector<float> data{0.3, 0.2, 0.4, 0.1, 0.8, 0.5, 0.9, 0.1, 0.1, 0.7, 0.1, 0.6};
auto l0 = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(op, l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
...
...
@@ -3041,7 +3041,7 @@ TEST_CASE(globalavgpool_dyn_test)
migraphx::make_op("pooling",
{{"mode", migraphx::op::pooling_mode::average}, {"dyn_global", true}}),
x);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> data{0.3, 0.2, 0.4, 0.1, 0.8, 0.5, 0.9, 0.1, 0.1, 0.7, 0.1, 0.6};
migraphx::shape input_fixed_shape{migraphx::shape::float_type, {1, 3, 2, 2}};
...
...
@@ -3067,7 +3067,7 @@ TEST_CASE(globallppool_test)
std::vector<float> data{0.3, 0.2, 0.4, 0.1, 0.8, 0.5, 0.9, 0.1, 0.1, 0.7, 0.1, 0.6};
auto l0 = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(op, l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
...
...
@@ -3087,7 +3087,7 @@ TEST_CASE(globallppool_dyn_test)
migraphx::make_op("pooling",
{{"mode", migraphx::op::pooling_mode::lpnorm}, {"dyn_global", true}}),
x);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> data{0.3, 0.2, 0.4, 0.1, 0.8, 0.5, 0.9, 0.1, 0.1, 0.7, 0.1, 0.6};
migraphx::shape input_fixed_shape{migraphx::shape::float_type, {1, 3, 2, 2}};
...
...
@@ -3112,7 +3112,7 @@ TEST_CASE(globalmaxpool_test)
std::vector<float> data{0.3, 0.2, 0.4, 0.1, 0.8, 0.5, 0.9, 0.1, 0.1, 0.7, 0.1, 0.6};
auto l0 = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(op, l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
...
...
@@ -3132,7 +3132,7 @@ TEST_CASE(globalmaxpool_dyn_test)
migraphx::make_op("pooling",
{{"mode", migraphx::op::pooling_mode::max}, {"dyn_global", true}}),
x);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> data{0.3, 0.2, 0.4, 0.1, 0.8, 0.5, 0.9, 0.1, 0.1, 0.7, 0.1, 0.6};
migraphx::shape input_fixed_shape{migraphx::shape::float_type, {1, 3, 2, 2}};
...
...
@@ -3162,7 +3162,7 @@ TEST_CASE(greater_brcst_test)
gr);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<bool> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -3186,7 +3186,7 @@ TEST_CASE(greater_test)
gr);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<bool> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -3208,7 +3208,7 @@ TEST_CASE(greater_dyn_test)
{{"target_type", migraphx::to_value(migraphx::shape::bool_type)}}),
gr);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> left_data{1.1, 1.5, 0.1, -1.1, -1.5, -0.6, 0.0, 2.0, -2.0};
std::vector<float> right_data{1.1, 1.6, -0.1, -1.2, -1.5, -0.7, 0.0, 2.3, -2.1};
...
...
@@ -3231,7 +3231,7 @@ TEST_CASE(identity_test)
std::vector<int> data{1, 2, 3, 4};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("identity"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int> results_vector(4);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -3245,7 +3245,7 @@ TEST_CASE(identity_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {{2, 4, 0}, {2, 4, 0}}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("identity"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<int> input_data{1, 2, 3, 4};
migraphx::parameter_map params0;
...
...
@@ -3286,7 +3286,7 @@ TEST_CASE(if_literal_test)
auto run_prog = [&](bool cond) {
auto p = create_program();
p.compile(migraphx::
ref::
target());
p.compile(migraphx::
make_
target(
"ref"
));
std::vector<char> c_data = {static_cast<char>(cond)};
migraphx::shape cs{migraphx::shape::bool_type};
migraphx::parameter_map m;
...
...
@@ -3349,7 +3349,7 @@ TEST_CASE(if_param_test)
auto run_prog = [&](bool cond) {
auto p = create_program();
p.compile(migraphx::
ref::
target());
p.compile(migraphx::
make_
target(
"ref"
));
std::vector<char> c_data = {static_cast<char>(cond)};
migraphx::shape cs{migraphx::shape::bool_type};
migraphx::parameter_map m;
...
...
@@ -3414,7 +3414,7 @@ TEST_CASE(if_pl_test)
auto run_prog = [&](bool cond) {
auto p = create_program();
p.compile(migraphx::
ref::
target());
p.compile(migraphx::
make_
target(
"ref"
));
std::vector<char> c_data = {static_cast<char>(cond)};
migraphx::shape cs{migraphx::shape::bool_type};
migraphx::parameter_map m;
...
...
@@ -3456,7 +3456,7 @@ TEST_CASE(isnan_test)
std::vector<float> data0 = {1.2, 5.2, nan_val, nan_val, 0., 100.};
auto l1 = mm->add_literal(migraphx::literal{s, data0});
mm->add_instruction(migraphx::make_op("isnan"), l1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -3475,7 +3475,7 @@ TEST_CASE(isnan_test)
std::vector<migraphx::half> data0 = {a, b, nan_val, nan_val, b, a};
auto l1 = mm->add_literal(migraphx::literal{s, data0});
mm->add_instruction(migraphx::make_op("isnan"), l1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -3492,7 +3492,7 @@ TEST_CASE(isnan_dyn_test)
auto input = mm->add_parameter("X", s);
auto nan_val = std::numeric_limits<float>::quiet_NaN();
mm->add_instruction(migraphx::make_op("isnan"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data = {1.2, 5.2, nan_val, nan_val, 0., 100.};
migraphx::parameter_map params0;
...
...
@@ -3529,7 +3529,7 @@ TEST_CASE(im2col_3x3_no_pad_identity_test)
{{"padding", padding}, {"stride", stride}, {"dilation", dilation}}),
l_image,
l_weights);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::size_t col_height = (size[0] - f[0] + 2 * padding[0]) / stride[0] + 1;
...
...
@@ -3563,7 +3563,7 @@ TEST_CASE(im2col_3x3_no_pad_test)
{{"padding", padding}, {"stride", stride}, {"dilation", dilation}}),
l_image,
l_weights);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int> correct = {0, 1, 2, 4, 5, 6, 8, 9, 10, 1, 2, 3, 5, 6, 7, 9, 10, 11,
...
...
@@ -3600,7 +3600,7 @@ TEST_CASE(im2col_3x3_stride_2_no_pad_test)
{{"padding", padding}, {"stride", stride}, {"dilation", dilation}}),
l_image,
l_weights);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int> correct = {0, 1, 2, 6, 7, 8, 12, 13, 14, 2, 3, 4,
...
...
@@ -3638,7 +3638,7 @@ TEST_CASE(im2col_3x3_with_channels_identity_test)
{{"padding", padding}, {"stride", stride}, {"dilation", dilation}}),
l_image,
l_weights);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::size_t col_height = (size[0] - f[0] + 2 * padding[0]) / stride[0] + 1;
...
...
@@ -3672,7 +3672,7 @@ TEST_CASE(im2col_3x3_with_padding_test)
{{"padding", padding}, {"stride", stride}, {"dilation", dilation}}),
l_image,
l_weights);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int> correct = {0, 0, 0, 0, 0, 1, 0, 2, 3, 0, 0, 0, 0, 1, 0, 2, 3, 0,
...
...
@@ -3714,7 +3714,7 @@ TEST_CASE(imagescaler_test)
auto bias_bcast = mm->add_instruction(
migraphx::make_op("broadcast", {{"axis", 1}, {"out_lens", s.lens()}}), bias_vals);
mm->add_instruction(migraphx::make_op("add"), img_scaled, bias_bcast);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(12);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -3742,7 +3742,7 @@ TEST_CASE(leaky_relu_test)
migraphx::shape s{migraphx::shape::float_type, {3}};
auto l = mm->add_literal(migraphx::literal{s, {-1.f, 0.f, 1.f}});
mm->add_instruction(migraphx::make_op("leaky_relu", {{"alpha", 0.01}}), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -3767,7 +3767,7 @@ TEST_CASE(less_brcst_test)
le);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<bool> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -3791,7 +3791,7 @@ TEST_CASE(less_test)
le);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<bool> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -3817,7 +3817,7 @@ TEST_CASE(less_dyn_test)
{{"target_type", migraphx::to_value(migraphx::shape::bool_type)}}),
le);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> left_data = {1.1, 1.5, 0.1, -1.1, -1.5, -0.6, 0.0, 2.0, -2.0};
std::vector<float> right_data = {1.1, 1.6, -0.1, -1.2, -1.5, -0.7, 0.0, 2.3, -2.1};
...
...
@@ -3845,7 +3845,7 @@ TEST_CASE(log_test)
std::vector<float> data = {1, 2, 3};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("log"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -3863,7 +3863,7 @@ TEST_CASE(log_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("log"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data = {1, 2, 3};
migraphx::parameter_map params0;
...
...
@@ -3888,7 +3888,7 @@ TEST_CASE(logical_and_test)
auto l1 = mm->add_literal(migraphx::literal{s, data1});
auto l2 = mm->add_literal(migraphx::literal{s, data2});
mm->add_instruction(migraphx::make_op("logical_and"), l1, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<char> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -3909,7 +3909,7 @@ TEST_CASE(logical_and_dyn_test)
auto left = mm->add_parameter("l", s);
auto right = mm->add_parameter("r", s);
mm->add_instruction(migraphx::make_op("logical_and"), left, right);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<char> left_data{1, 0, 1, 0};
std::vector<char> right_data{1, 1, 0, 0};
...
...
@@ -3939,7 +3939,7 @@ TEST_CASE(logical_or_test)
auto l1 = mm->add_literal(migraphx::literal{s, data1});
auto l2 = mm->add_literal(migraphx::literal{s, data2});
mm->add_instruction(migraphx::make_op("logical_or"), l1, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<char> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -3960,7 +3960,7 @@ TEST_CASE(logical_or_dyn_test)
auto left = mm->add_parameter("l", s);
auto right = mm->add_parameter("r", s);
mm->add_instruction(migraphx::make_op("logical_or"), left, right);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<char> left_data{1, 0, 1, 0};
std::vector<char> right_data{1, 1, 0, 0};
...
...
@@ -3990,7 +3990,7 @@ TEST_CASE(logical_xor_test)
auto l1 = mm->add_literal(migraphx::literal{s, data1});
auto l2 = mm->add_literal(migraphx::literal{s, data2});
mm->add_instruction(migraphx::make_op("logical_xor"), l1, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<char> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4011,7 +4011,7 @@ TEST_CASE(logical_xor_dyn_test)
auto left = mm->add_parameter("l", s);
auto right = mm->add_parameter("r", s);
mm->add_instruction(migraphx::make_op("logical_xor"), left, right);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<char> left_data{1, 0, 1, 0};
std::vector<char> right_data{1, 1, 0, 0};
...
...
@@ -4058,7 +4058,7 @@ TEST_CASE(logsoftmax_test_axis_0)
auto al = mm->add_literal(migraphx::literal{a_shape, a});
int axis = 0;
mm->add_instruction(migraphx::make_op("logsoftmax", {{"axis", axis}}), al);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4092,7 +4092,7 @@ TEST_CASE(logsoftmax_test_axis_1)
auto al = mm->add_literal(migraphx::literal{a_shape, a});
int axis = 1;
mm->add_instruction(migraphx::make_op("logsoftmax", {{"axis", axis}}), al);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4126,7 +4126,7 @@ TEST_CASE(logsoftmax_test_axis_2)
auto al = mm->add_literal(migraphx::literal{a_shape, a});
int axis = 2;
mm->add_instruction(migraphx::make_op("logsoftmax", {{"axis", axis}}), al);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4160,7 +4160,7 @@ TEST_CASE(logsoftmax_test_axis_3)
auto al = mm->add_literal(migraphx::literal{a_shape, a});
int axis = 3;
mm->add_instruction(migraphx::make_op("logsoftmax", {{"axis", axis}}), al);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4182,7 +4182,7 @@ TEST_CASE(lppool_l1_norm_test)
std::vector<float> data{0.3, 0.2, 0.4, 0.1, 0.8, 0.5, 0.9, 0.1, 0.1, 0.7, 0.1, 0.6};
auto l0 = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(op, l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
...
...
@@ -4206,7 +4206,7 @@ TEST_CASE(lppool_l2_norm_test)
std::vector<float> data{0.3, 0.2, 0.4, 0.1, 0.8, 0.5, 0.9, 0.1, 0.1, 0.7, 0.1, 0.6};
auto l0 = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(op, l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
...
...
@@ -4235,7 +4235,7 @@ TEST_CASE(lppool_dyn_test)
{"padding", {0}},
{"stride", {1}}}),
x);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> data{0.3, 0.2, 0.4, 0.1, 0.8, 0.5, 0.9, 0.1, 0.1, 0.7, 0.1, 0.6};
migraphx::shape input_fixed_shape{migraphx::shape::float_type, {1, 3, 4}};
...
...
@@ -4264,7 +4264,7 @@ TEST_CASE(lrn_test)
auto l = mm->add_literal(migraphx::literal{s, {-2.0f, 1.0f, 0.f, 1.0f, 2.0f}});
mm->add_instruction(
migraphx::make_op("lrn", {{"alpha", 0.0001}, {"beta", 0.75}, {"bias", 1}, {"size", 5}}), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(5);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4282,7 +4282,7 @@ TEST_CASE(max_test)
auto l2 = mm->add_literal(migraphx::literal{s, {7, 5, 9}});
auto curr_max = mm->add_instruction(migraphx::make_op("max"), l0, l1);
mm->add_instruction(migraphx::make_op("max"), curr_max, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(4);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4301,7 +4301,7 @@ TEST_CASE(max_dyn_test)
auto z = mm->add_parameter("z", s);
auto curr_max = mm->add_instruction(migraphx::make_op("max"), x, y);
mm->add_instruction(migraphx::make_op("max"), curr_max, z);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> x_data{1, 4, 3};
std::vector<float> y_data{2, 8, 6};
...
...
@@ -4368,7 +4368,7 @@ TEST_CASE(maxpool_test)
{"stride", {2, 2}},
{"lengths", {3, 2}}}),
al);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(36);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4389,7 +4389,7 @@ TEST_CASE(maxpool_rank3_test0)
std::vector<float> data{0.3, 0.2, 0.4, 0.1, 0.8, 0.5, 0.9, 0.1, 0.1, 0.7, 0.1, 0.6};
auto l0 = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(op, l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
...
...
@@ -4414,7 +4414,7 @@ TEST_CASE(maxpool_rank3_test1)
0.9907, 0.477, 1.5001, -1.1603, -1.361, 1.2556};
auto l0 = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(op, l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
...
...
@@ -4440,7 +4440,7 @@ TEST_CASE(maxpool_rank3_ceil_test)
0.9907, 0.477, 1.5001, -1.1603, -1.361, 1.2556};
auto l0 = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(op, l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
...
...
@@ -4485,7 +4485,7 @@ TEST_CASE(maxpool_rank5_test)
0.5041, 0.0647, 0.1941, -1.0819, -0.4629, -0.5107, 0.3612, -0.3583};
auto l0 = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(op, l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4505,7 +4505,7 @@ TEST_CASE(maxpool_dyn_test)
{"padding", {0}},
{"stride", {1}}}),
x);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> data{0.3, 0.2, 0.4, 0.1, 0.8, 0.5, 0.9, 0.1, 0.1, 0.7, 0.1, 0.6};
migraphx::shape input_fixed_shape{migraphx::shape::float_type, {1, 3, 4}};
...
...
@@ -4528,7 +4528,7 @@ TEST_CASE(min_test)
auto l2 = mm->add_literal(migraphx::literal{s, {7, 5, 9}});
auto curr_min = mm->add_instruction(migraphx::make_op("min"), l0, l1);
mm->add_instruction(migraphx::make_op("min"), curr_min, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(4);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4547,7 +4547,7 @@ TEST_CASE(min_dyn_test)
auto z = mm->add_parameter("z", s);
auto curr_min = mm->add_instruction(migraphx::make_op("min"), x, y);
mm->add_instruction(migraphx::make_op("min"), curr_min, z);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> x_data{1, 4, 3};
std::vector<float> y_data{2, 8, 6};
...
...
@@ -4574,7 +4574,7 @@ TEST_CASE(fmod_test)
auto l2 = mm->add_literal(migraphx::literal{s, {7, 5, 9}});
auto curr_mod = mm->add_instruction(migraphx::make_op("fmod"), l0, l1);
mm->add_instruction(migraphx::make_op("fmod"), curr_mod, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(4);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4593,7 +4593,7 @@ TEST_CASE(fmod_dyn_test)
auto z = mm->add_parameter("z", s);
auto curr_mod = mm->add_instruction(migraphx::make_op("fmod"), x, y);
mm->add_instruction(migraphx::make_op("fmod"), curr_mod, z);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> x_data{-7, 8, -3};
std::vector<float> y_data{2, 4, 6};
...
...
@@ -4621,7 +4621,7 @@ TEST_CASE(fmod_float_test)
auto curr_mod = mm->add_instruction(migraphx::make_op("fmod"), l0, l1);
mm->add_instruction(migraphx::make_op("fmod"), curr_mod, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(4);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4639,7 +4639,7 @@ TEST_CASE(mod_test)
auto l2 = mm->add_literal(migraphx::literal{s, {10, 2, 9}});
auto curr_mod = mm->add_instruction(migraphx::make_op("mod"), l0, l1);
mm->add_instruction(migraphx::make_op("mod"), curr_mod, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(4);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4658,7 +4658,7 @@ TEST_CASE(mod_dyn_test)
auto z = mm->add_parameter("z", s);
auto curr_mod = mm->add_instruction(migraphx::make_op("mod"), x, y);
mm->add_instruction(migraphx::make_op("mod"), curr_mod, z);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> x_data{-3, 8, -7};
std::vector<float> y_data{3, 3, 3};
...
...
@@ -4686,7 +4686,7 @@ TEST_CASE(mod_float_test)
auto curr_mod = mm->add_instruction(migraphx::make_op("mod"), l0, l1);
mm->add_instruction(migraphx::make_op("mod"), curr_mod, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(4);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4704,7 +4704,7 @@ TEST_CASE(mul_test)
auto l1 = mm->add_literal(migraphx::literal{s, {-1, 0, 1}});
auto l2 = mm->add_literal(migraphx::literal{s, {1, 2, 3}});
mm->add_instruction(migraphx::make_op("mul"), l1, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -4725,7 +4725,7 @@ TEST_CASE(mul_dyn_test)
auto x = mm->add_parameter("x", s);
auto y = mm->add_parameter("y", s);
mm->add_instruction(migraphx::make_op("mul"), x, y);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> x_data{-1, 0, 1};
std::vector<float> y_data{1, 2, 3};
...
...
@@ -4757,7 +4757,7 @@ TEST_CASE(multibroadcast_test)
auto l2 = mm->add_literal(migraphx::literal{b_shape, b_data});
mm->add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", l1->get_shape().lens()}}),
l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
auto output = result.get<int32_t>();
EXPECT(output(0, 0) == -2);
...
...
@@ -4777,7 +4777,7 @@ TEST_CASE(multibroadcast_2in_static_test)
auto l1 = mm->add_literal(migraphx::literal{a_shape, a_data});
auto l2 = mm->add_literal(migraphx::literal{b_shape, b_data});
mm->add_instruction(migraphx::make_op("multibroadcast"), l2, l1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
auto output = result.get<int32_t>();
EXPECT(output(0, 0) == -2);
...
...
@@ -4796,7 +4796,7 @@ TEST_CASE(multibroadcast_2in_dyn_test)
auto l1 = mm->add_parameter("a", a_shape);
auto l2 = mm->add_literal(migraphx::literal{b_shape, b_data});
mm->add_instruction(migraphx::make_op("multibroadcast"), l2, l1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<int32_t> a_data{0, 0, 0, 0};
migraphx::parameter_map params0;
...
...
@@ -4839,7 +4839,7 @@ TEST_CASE(multinomial_test)
migraphx::make_op("prefix_scan_sum", {{"axis", 1}, {"exclusive", false}}), cdf);
mm->add_instruction(migraphx::make_op("multinomial"), cdf, rs_lit);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int32_t> result_vec(sample_size);
result.visit([&](auto output) { result_vec.assign(output.begin(), output.end()); });
...
...
@@ -4869,7 +4869,7 @@ TEST_CASE(neg_test)
auto input = mm->add_literal(migraphx::literal(s, data));
auto ret = mm->add_instruction(migraphx::make_op("neg"), input);
mm->add_return({ret});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> result_vector;
result.visit([&](auto output) { result_vector.assign(output.begin(), output.end()); });
...
...
@@ -4886,7 +4886,7 @@ TEST_CASE(neg_dyn_test)
auto input = mm->add_parameter("X", s);
auto ret = mm->add_instruction(migraphx::make_op("neg"), input);
mm->add_return({ret});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> a = {1.0f, 1.3f, -1.2f, 0.0f, -100.f, 200.f};
migraphx::parameter_map params0;
...
...
@@ -4927,7 +4927,7 @@ TEST_CASE(nms_dyn_out_test)
score_threshold);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto output = p.eval({}).back();
std::vector<int64_t> result;
output.visit([&](auto out) { result.assign(out.begin(), out.end()); });
...
...
@@ -4959,7 +4959,7 @@ TEST_CASE(nms_dyn_batch_test)
score_threshold);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> boxes_vec = {0.5, 0.5, 1.0, 1.0, 0.5, 0.6, 1.0, 1.0, 0.5, 0.4, 1.0, 1.0,
0.5, 10.5, 1.0, 1.0, 0.5, 10.6, 1.0, 1.0, 0.5, 100.5, 1.0, 1.0,
...
...
@@ -5005,7 +5005,7 @@ TEST_CASE(nms_dyn_boxes_test)
score_threshold);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> boxes_vec = {0.5, 0.5, 1.0, 1.0, 0.5, 0.6, 1.0, 1.0, 0.5, 0.4, 1.0, 1.0,
0.5, 10.5, 1.0, 1.0, 0.5, 10.6, 1.0, 1.0, 0.5, 100.5, 1.0, 1.0};
...
...
@@ -5048,7 +5048,7 @@ TEST_CASE(nms_dyn_classes_test)
score_threshold);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> boxes_vec = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1,
0.0, -0.1, 1.0, 0.9, 0.0, 10.0, 1.0, 11.0,
...
...
@@ -5096,7 +5096,7 @@ TEST_CASE(nms_not_center_test)
score_threshold);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto output = p.eval({}).back();
std::vector<int64_t> result;
output.visit([&](auto out) { result.assign(out.begin(), out.end()); });
...
...
@@ -5130,7 +5130,7 @@ TEST_CASE(nms_test)
score_threshold);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto output = p.eval({}).back();
std::vector<int64_t> result;
output.visit([&](auto out) { result.assign(out.begin(), out.end()); });
...
...
@@ -5168,7 +5168,7 @@ TEST_CASE(nms_transpose1_test)
score_threshold);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto output = p.eval({}).back();
std::vector<int64_t> result;
output.visit([&](auto out) { result.assign(out.begin(), out.end()); });
...
...
@@ -5206,7 +5206,7 @@ TEST_CASE(nms_transpose2_test)
score_threshold);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto output = p.eval({}).back();
std::vector<int64_t> result;
output.visit([&](auto out) { result.assign(out.begin(), out.end()); });
...
...
@@ -5224,7 +5224,7 @@ TEST_CASE(nonzero_test)
auto input = mm->add_literal(migraphx::literal(s, data));
auto ret = mm->add_instruction(migraphx::make_op("nonzero"), input);
mm->add_return({ret});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int64_t> result_vector;
result.visit([&](auto output) { result_vector.assign(output.begin(), output.end()); });
...
...
@@ -5243,7 +5243,7 @@ TEST_CASE(not_test)
std::vector<float> data{0, 8, 1, -32};
auto l1 = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("not"), l1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<char> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5259,7 +5259,7 @@ TEST_CASE(not_test)
std::vector<bool> data{false, false, true, true};
auto l1 = mm->add_literal(migraphx::literal{s, {0, 0, 1, 1}});
mm->add_instruction(migraphx::make_op("not"), l1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<char> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5278,7 +5278,7 @@ TEST_CASE(not_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("not"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{0, 8, 1, -32};
migraphx::parameter_map params0;
...
...
@@ -5298,7 +5298,7 @@ TEST_CASE(pad_test)
migraphx::shape s{migraphx::shape::float_type, {2, 2}};
auto l0 = mm->add_literal(migraphx::literal{s, {1, 2, 3, 4}});
mm->add_instruction(migraphx::make_op("pad", {{"pads", {1, 1, 1, 1}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(16);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5313,7 +5313,7 @@ TEST_CASE(pad_test_asym)
migraphx::shape s{migraphx::shape::float_type, {2, 2}};
auto l0 = mm->add_literal(migraphx::literal{s, {1, 2, 3, 4}});
mm->add_instruction(migraphx::make_op("pad", {{"pads", {0, 0, 1, 1}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(9);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5331,7 +5331,7 @@ TEST_CASE(pad_test_highest_half)
migraphx::make_op("pad",
{{"pads", {1, 1, 1, 1}}, {"value", std::numeric_limits<float>::max()}}),
l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(16);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5350,7 +5350,7 @@ TEST_CASE(pad_test_lowest_half)
migraphx::make_op(
"pad", {{"pads", {1, 1, 1, 1}}, {"value", std::numeric_limits<float>::lowest()}}),
l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(16);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5366,7 +5366,7 @@ TEST_CASE(pad_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {{2, 4, 2}, {2, 4, 2}}};
auto x = mm->add_parameter("x", s);
mm->add_instruction(migraphx::make_op("pad", {{"pads", {1, 1, 1, 1}}}), x);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> data = {1, 2, 3, 4};
migraphx::parameter_map params;
...
...
@@ -5391,7 +5391,7 @@ TEST_CASE(pointwise_test)
auto x2 = pm->add_parameter("x2", {migraphx::shape::float_type});
pm->add_instruction(migraphx::make_op("add"), x1, x2);
mm->add_instruction(migraphx::make_op("pointwise"), {l1, l2}, {pm});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5408,7 +5408,7 @@ TEST_CASE(pow_test)
auto b = mm->add_literal(migraphx::literal{s, data});
auto e = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("pow"), b, e);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5426,7 +5426,7 @@ TEST_CASE(pow_dyn_test)
auto b = mm->add_parameter("b", s);
auto e = mm->add_parameter("e", s);
mm->add_instruction(migraphx::make_op("pow"), b, e);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> data = {1, 2, 3};
migraphx::parameter_map params0;
...
...
@@ -5451,7 +5451,7 @@ TEST_CASE(prefix_scan_sum_1d)
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("prefix_scan_sum", {{"axis", 0}, {"exclusive", false}}),
l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5469,7 +5469,7 @@ TEST_CASE(prefix_scan_sum_2d)
auto l0 = mm->add_literal(input);
mm->add_instruction(
migraphx::make_op("prefix_scan_sum", {{"axis", 0}, {"exclusive", false}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5485,7 +5485,7 @@ TEST_CASE(prefix_scan_sum_2d)
auto l0 = mm->add_literal(input);
mm->add_instruction(
migraphx::make_op("prefix_scan_sum", {{"axis", 1}, {"exclusive", false}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5504,7 +5504,7 @@ TEST_CASE(prefix_scan_sum_3d)
auto l0 = mm->add_literal(input);
mm->add_instruction(
migraphx::make_op("prefix_scan_sum", {{"axis", 0}, {"exclusive", false}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5537,7 +5537,7 @@ TEST_CASE(prefix_scan_sum_3d)
auto l0 = mm->add_literal(input);
mm->add_instruction(
migraphx::make_op("prefix_scan_sum", {{"axis", 1}, {"exclusive", false}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5570,7 +5570,7 @@ TEST_CASE(prefix_scan_sum_3d)
auto l0 = mm->add_literal(input);
mm->add_instruction(
migraphx::make_op("prefix_scan_sum", {{"axis", 2}, {"exclusive", false}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5606,7 +5606,7 @@ TEST_CASE(prefix_scan_sum_exclusive)
auto l0 = mm->add_literal(input);
mm->add_instruction(
migraphx::make_op("prefix_scan_sum", {{"axis", 0}, {"exclusive", true}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5622,7 +5622,7 @@ TEST_CASE(prefix_scan_sum_exclusive)
auto l0 = mm->add_literal(input);
mm->add_instruction(
migraphx::make_op("prefix_scan_sum", {{"axis", 1}, {"exclusive", true}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5658,7 +5658,7 @@ TEST_CASE(prefix_scan_sum_exclusive_reverse)
mm->add_instruction(
migraphx::make_op("prefix_scan_sum", {{"axis", 0}, {"exclusive", true}, {"reverse", true}}),
l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5676,7 +5676,7 @@ TEST_CASE(prefix_scan_sum_negative_axis)
auto l0 = mm->add_literal(input);
mm->add_instruction(
migraphx::make_op("prefix_scan_sum", {{"axis", -3}, {"exclusive", false}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5709,7 +5709,7 @@ TEST_CASE(prefix_scan_sum_negative_axis)
auto l0 = mm->add_literal(input);
mm->add_instruction(
migraphx::make_op("prefix_scan_sum", {{"axis", -2}, {"exclusive", false}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5742,7 +5742,7 @@ TEST_CASE(prefix_scan_sum_negative_axis)
auto l0 = mm->add_literal(input);
mm->add_instruction(
migraphx::make_op("prefix_scan_sum", {{"axis", -1}, {"exclusive", false}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5780,7 +5780,7 @@ TEST_CASE(prefix_scan_sum_reverse)
migraphx::make_op("prefix_scan_sum",
{{"axis", 0}, {"exclusive", false}, {"reverse", true}}),
l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5798,7 +5798,7 @@ TEST_CASE(prefix_scan_sum_reverse)
migraphx::make_op("prefix_scan_sum",
{{"axis", 0}, {"exclusive", false}, {"reverse", true}}),
l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5815,7 +5815,7 @@ TEST_CASE(prelu_test)
auto x = mm->add_literal(migraphx::literal{s, {-1, 0, 2}});
auto slope = mm->add_literal(migraphx::literal{s, {2, 1, 2}});
mm->add_instruction(migraphx::make_op("prelu"), x, slope);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5832,7 +5832,7 @@ TEST_CASE(prelu_dyn_test)
auto x = mm->add_parameter("x", s);
auto slope = mm->add_parameter("slope", s);
mm->add_instruction(migraphx::make_op("prelu"), x, slope);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> x_data{-1, 0, 2};
std::vector<float> slope_data{2, 1, 2};
...
...
@@ -5861,7 +5861,7 @@ TEST_CASE(quant_conv2d_padding_stride_test)
auto cl = mm->add_literal(migraphx::literal{c_shape, c});
mm->add_instruction(
migraphx::make_op("quant_convolution", {{"padding", {1, 1}}, {"stride", {2, 2}}}), al, cl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int32_t> s = {4521,
...
...
@@ -5899,7 +5899,7 @@ TEST_CASE(quant_conv2d_padding_test)
auto cl = mm->add_literal(migraphx::literal{c_shape, c});
mm->add_instruction(
migraphx::make_op("quant_convolution", {{"padding", {1, 1}}, {"stride", {1, 1}}}), al, cl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int32_t> s = {
4521, 6753, 7014, 4635, 6858, 10197, 10548, 6939, 7830, 11601, 11952, 7839, 5007,
...
...
@@ -5928,7 +5928,7 @@ TEST_CASE(quant_conv2d_test)
auto cl = mm->add_literal(migraphx::literal{c_shape, c});
mm->add_instruction(migraphx::make_op("quant_convolution"), al, cl);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int32_t> s = {10197,
...
...
@@ -5974,7 +5974,7 @@ TEST_CASE(quantizelinear)
};
migraphx::program p1 = create_program();
p1.compile(migraphx::
ref::
target
{}
);
p1.compile(migraphx::
make_
target
("ref")
);
auto result = p1.eval({}).back();
std::vector<float> results_vector(18);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -5999,7 +5999,7 @@ TEST_CASE(quantizelinear)
};
migraphx::program p1 = create_program();
p1.compile(migraphx::
ref::
target
{}
);
p1.compile(migraphx::
make_
target
("ref")
);
auto result = p1.eval({}).back();
std::vector<float> results_vector(18);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6016,7 +6016,7 @@ TEST_CASE(recip_test)
std::vector<float> data{-0.5f, 0.1f, 0.5f};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("recip"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6032,7 +6032,7 @@ TEST_CASE(recip_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("recip"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-0.5f, 0.1f, 0.5f};
migraphx::parameter_map params0;
...
...
@@ -6053,7 +6053,7 @@ TEST_CASE(reduce_max_axis0)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_max", {{"axes", {0}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6069,7 +6069,7 @@ TEST_CASE(reduce_max_dynamic_axis0)
auto input = mm->add_parameter("X", s);
auto reduce_max_op = migraphx::make_op("reduce_max", {{"axes", {0}}});
mm->add_instruction(reduce_max_op, input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::parameter_map params;
migraphx::shape input_fixed_shape{migraphx::shape::float_type, {2, 5}};
...
...
@@ -6090,7 +6090,7 @@ TEST_CASE(reduce_max_axis01)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_max", {{"axes", {0, 1}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6106,7 +6106,7 @@ TEST_CASE(reduce_max_axis02)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_max", {{"axes", {0, 2}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6122,7 +6122,7 @@ TEST_CASE(reduce_mean_axis02)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_mean", {{"axes", {0, 2}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6138,7 +6138,7 @@ TEST_CASE(reduce_mean_axis1)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_mean", {{"axes", {1}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6154,7 +6154,7 @@ TEST_CASE(reduce_mean_axis12)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_mean", {{"axes", {1, 2}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6170,7 +6170,7 @@ TEST_CASE(reduce_mean_axis2)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_mean", {{"axes", {2}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6186,7 +6186,7 @@ TEST_CASE(reduce_mean_int)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_mean", {{"axes", {1, 2}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<int> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6202,7 +6202,7 @@ TEST_CASE(reduce_min_axis02)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_min", {{"axes", {0, 2}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6218,7 +6218,7 @@ TEST_CASE(reduce_min_axis1)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_min", {{"axes", {1}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6234,7 +6234,7 @@ TEST_CASE(reduce_min_axis12)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_min", {{"axes", {1, 2}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6250,7 +6250,7 @@ TEST_CASE(reduce_prod_axis0)
auto input = migraphx::literal{s, {1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 3, 2, 3}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_prod", {{"axes", {0}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6266,7 +6266,7 @@ TEST_CASE(reduce_sum_axis0)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_sum", {{"axes", {0}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6282,7 +6282,7 @@ TEST_CASE(reduce_sum_axis02)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_sum", {{"axes", {0, 2}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6298,7 +6298,7 @@ TEST_CASE(reduce_sum_axis1)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_sum", {{"axes", {1}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6314,7 +6314,7 @@ TEST_CASE(reduce_sum_axis12)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_sum", {{"axes", {1, 2}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6330,7 +6330,7 @@ TEST_CASE(reduce_sum_axis2)
auto input = migraphx::literal{s, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}};
auto l0 = mm->add_literal(input);
mm->add_instruction(migraphx::make_op("reduce_sum", {{"axes", {2}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6345,7 +6345,7 @@ TEST_CASE(relu_test)
migraphx::shape s{migraphx::shape::float_type, {3}};
auto l = mm->add_literal(migraphx::literal{s, {-1.f, 0.f, 1.f}});
mm->add_instruction(migraphx::make_op("relu"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6361,7 +6361,7 @@ TEST_CASE(relu_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("relu"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-1.f, 0.f, 1.f};
migraphx::parameter_map params0;
...
...
@@ -6384,7 +6384,7 @@ TEST_CASE(reshape_test0)
auto l = mm->add_literal(migraphx::literal{a_shape, data});
std::vector<int64_t> new_shape = {8, 3, 1, 1};
mm->add_instruction(migraphx::make_op("reshape", {{"dims", new_shape}}), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector{};
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6401,7 +6401,7 @@ TEST_CASE(reshape_test1)
auto l = mm->add_literal(migraphx::literal{a_shape, data});
std::vector<int64_t> new_shape = {1, 3, 4, 2};
mm->add_instruction(migraphx::make_op("reshape", {{"dims", new_shape}}), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector{};
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6418,7 +6418,7 @@ TEST_CASE(reshape_test2)
auto l = mm->add_literal(migraphx::literal{a_shape, data});
std::vector<int64_t> new_shape = {1, 2, 3, 4};
mm->add_instruction(migraphx::make_op("reshape", {{"dims", new_shape}}), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector{};
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6433,7 +6433,7 @@ TEST_CASE(reshape_dyn_test)
std::vector<int64_t> new_shape = {0, 8, 3, 1};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("reshape", {{"dims", new_shape}}), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> data(48);
std::iota(data.begin(), data.end(), -3);
...
...
@@ -6456,7 +6456,7 @@ TEST_CASE(reverse_test_axis0)
auto l = mm->add_literal(migraphx::literal{in_shape, data});
std::vector<int> axes = {0};
mm->add_instruction(migraphx::make_op("reverse", {{"axes", axes}}), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6475,7 +6475,7 @@ TEST_CASE(reverse_test_axis1)
auto l = mm->add_literal(migraphx::literal{in_shape, data});
std::vector<int> axes = {1};
mm->add_instruction(migraphx::make_op("reverse", {{"axes", axes}}), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6495,7 +6495,7 @@ TEST_CASE(reverse_test_axis10)
auto l = mm->add_literal(migraphx::literal{in_shape, data});
std::vector<int> axes = {1, 0};
mm->add_instruction(migraphx::make_op("reverse", {{"axes", axes}}), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6549,7 +6549,7 @@ TEST_CASE(roialign_out_of_bound_test)
{
auto p = create_program("output_half_pixel");
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6606,7 +6606,7 @@ TEST_CASE(roialign_test)
{
auto p = create_program();
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6630,7 +6630,7 @@ TEST_CASE(roialign_test)
{
auto p = create_program("output_half_pixel");
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6651,7 +6651,7 @@ TEST_CASE(roialign_test)
{
auto p = create_program("output_half_pixel", migraphx::op::pooling_mode::max, 0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6679,7 +6679,7 @@ TEST_CASE(round_test)
auto l =
mm->add_literal(migraphx::literal{s, {1.1, 1.5, 1.6, -1.1, -1.5, -1.6, 0.0, 2.0, -2.0}});
mm->add_instruction(migraphx::make_op("round"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6695,7 +6695,7 @@ TEST_CASE(round_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("round"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{1.1, 1.5, 1.6, -1.1, -1.5, -1.6, 0.0, 2.0, -2.0};
migraphx::parameter_map params0;
...
...
@@ -6715,7 +6715,7 @@ TEST_CASE(rsqrt_test)
migraphx::shape s{migraphx::shape::float_type, {3}};
auto l = mm->add_literal(migraphx::literal{s, {4.0, 16.0, 64.0}});
mm->add_instruction(migraphx::make_op("rsqrt"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6731,7 +6731,7 @@ TEST_CASE(rsqrt_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("rsqrt"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{4.0, 16.0, 64.0};
migraphx::parameter_map params0;
...
...
@@ -6773,7 +6773,7 @@ TEST_CASE(scatter_ax0_test)
// which have their own test case
{
migraphx::program p = create_scatter_program("scatter_none", 0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6787,7 +6787,7 @@ TEST_CASE(scatter_ax_neg_test)
{
migraphx::program p = create_scatter_program("scatter_none", -2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6800,7 +6800,7 @@ TEST_CASE(scatter_ax1_test)
{
{
migraphx::program p = create_scatter_program("scatter_none", 1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6837,7 +6837,7 @@ TEST_CASE(scatter_reduction1_test)
// Test sub-ops for the three reduction values scatter_none, scatter_add, scatter_mul
migraphx::program p = create_scatter_program2("scatter_none", 1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6850,7 +6850,7 @@ TEST_CASE(scatter_reduction2_test)
{
{
migraphx::program p = create_scatter_program2("scatter_mul", 1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6863,7 +6863,7 @@ TEST_CASE(scatter_reduction3_test)
{
{
migraphx::program p = create_scatter_program2("scatter_add", 1);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6892,7 +6892,7 @@ TEST_CASE(scatter_reduction_3x3_test)
auto lu = mm->add_literal(migraphx::literal{su, vu});
auto r = mm->add_instruction(migraphx::make_op("scatter_add", {{"axis", 1}}), ld, li, lu);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6930,7 +6930,7 @@ TEST_CASE(scatter_reduction_3x3_xpose1_test)
// test on vertical (0) axis. su and si are transposed from previous case
{
migraphx::program p = create_scatter_program_3x3("scatter_none", 0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6944,7 +6944,7 @@ TEST_CASE(scatter_reduction_3x3_xpose2_test)
// test on vertical (0) axis.
{
migraphx::program p = create_scatter_program_3x3("scatter_add", 0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6958,7 +6958,7 @@ TEST_CASE(scatter_reduction_3x3_xpose3_test)
{
{
migraphx::program p = create_scatter_program_3x3("scatter_mul", 0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -6989,7 +6989,7 @@ TEST_CASE(scatternd_shapes_test)
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_none"), data, indices, updates);
mm->add_return({scatternd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7020,7 +7020,7 @@ TEST_CASE(scatternd_shapes_test)
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_none"), td, indices, updates);
mm->add_return({scatternd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7051,7 +7051,7 @@ TEST_CASE(scatternd_shapes_test)
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_none"), data, indices, tu);
mm->add_return({scatternd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7083,7 +7083,7 @@ TEST_CASE(scatternd_test)
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_none"), data, indices, updates);
mm->add_return({scatternd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7112,7 +7112,7 @@ TEST_CASE(scatternd_test)
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_none"), data, indices, updates);
mm->add_return({scatternd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7141,7 +7141,7 @@ TEST_CASE(scatternd_test)
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_none"), data, indices, updates);
mm->add_return({scatternd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7174,7 +7174,7 @@ TEST_CASE(scatternd_test)
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_none"), data, indices, updates);
mm->add_return({scatternd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7205,7 +7205,7 @@ TEST_CASE(scatternd_test)
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_none"), data, indices, updates);
mm->add_return({scatternd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7238,7 +7238,7 @@ TEST_CASE(scatternd_reduction_test)
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_add"), data, indices, updates);
mm->add_return({scatternd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7267,7 +7267,7 @@ TEST_CASE(scatternd_reduction_test)
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_mul"), data, indices, updates);
mm->add_return({scatternd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7311,7 +7311,7 @@ TEST_CASE(select_module_add_test)
{batch1, batch2, batch3, batch4});
auto ret = mm->add_instruction(migraphx::make_op("get_tuple_elem", {{"index", 0}}), sm_ins);
mm->add_return({ret});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-4, 8, -1, 4, -1, 8, 8, -4};
migraphx::parameter_map params;
...
...
@@ -7357,7 +7357,7 @@ TEST_CASE(select_module_reduce_test0)
{batch1, batch2, batch3, batch4});
auto ret = mm->add_instruction(migraphx::make_op("get_tuple_elem", {{"index", 0}}), sm_ins);
mm->add_return({ret});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-4, 8, -1, 4, -1, 8, 8, -4};
migraphx::parameter_map params;
...
...
@@ -7403,7 +7403,7 @@ TEST_CASE(select_module_reduce_test1)
{batch1, batch2, batch3, batch4});
auto ret = mm->add_instruction(migraphx::make_op("get_tuple_elem", {{"index", 0}}), sm_ins);
mm->add_return({ret});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-4, 8, -1, 4, -1, 8, 8, -4, -4, 8, -1, 4, -1, 8, 8, -4};
migraphx::parameter_map params;
...
...
@@ -7449,7 +7449,7 @@ TEST_CASE(select_module_not_found_error)
{batch1, batch2, batch3, batch4});
auto ret = mm->add_instruction(migraphx::make_op("get_tuple_elem", {{"index", 0}}), sm_ins);
mm->add_return({ret});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-4, 8, -1, 4, -1, 8, 8, -4, -4, 8,
-1, 4, -1, 8, 8, -4, -1, 8, 8, -4};
...
...
@@ -7478,7 +7478,7 @@ TEST_CASE(scatternd_reduction_dyn_test)
auto scatternd_add_op = migraphx::make_op("scatternd_add");
auto scatternd = mm->add_instruction(scatternd_add_op, xdata, xindex, xupdates);
mm->add_return({scatternd});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::parameter_map params;
migraphx::shape input_fixed_shape0{migraphx::shape::float_type, {4, 4, 4}}; // data
...
...
@@ -7511,7 +7511,7 @@ TEST_CASE(sigmoid_test)
migraphx::shape s{migraphx::shape::float_type, {2, 2}};
auto l = mm->add_literal(migraphx::literal{s, {-1, 2, -3, 4}});
mm->add_instruction(migraphx::make_op("sigmoid"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(4);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7526,7 +7526,7 @@ TEST_CASE(sigmoid_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {{2, 4, 0}, {2, 2, 0}}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("sigmoid"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{-1, 2, -3, 4};
migraphx::parameter_map params0;
...
...
@@ -7547,7 +7547,7 @@ TEST_CASE(sign_test)
auto l = mm->add_literal(
migraphx::literal{s, {1.02481645, 0.85643062, -0.03404123, -0.92791926, 0.0}});
mm->add_instruction(migraphx::make_op("sign"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7563,7 +7563,7 @@ TEST_CASE(sign_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("sign"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data{1.02481645, 0.85643062, -0.03404123, -0.92791926, 0.0};
migraphx::parameter_map params0;
...
...
@@ -7584,7 +7584,7 @@ TEST_CASE(sin_test)
std::vector<float> data = {-1, 0, 1};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("sin"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7602,7 +7602,7 @@ TEST_CASE(sin_dyn_test)
migraphx::shape s{migraphx::shape::float_type, {dd}};
auto input = mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("sin"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data = {-1, 0, 1};
migraphx::parameter_map params0;
...
...
@@ -7625,7 +7625,7 @@ TEST_CASE(sinh_test)
std::vector<float> data{-1.0, 2.0, -3.0, 4.0};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("sinh"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(4);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7643,7 +7643,7 @@ TEST_CASE(sinh_dynamic_test)
auto input = mm->add_parameter("X", s);
std::vector<float> input_data{-1.0, 2.0, -3.0, 4.0};
mm->add_instruction(migraphx::make_op("sinh"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::parameter_map params0;
migraphx::shape input_fixed_shape0{migraphx::shape::float_type, {4}};
...
...
@@ -7670,7 +7670,7 @@ TEST_CASE(slice_test)
migraphx::make_op("slice", {{"axes", {2}}, {"starts", {1}}, {"ends", {3}}}), l0);
migraphx::shape s2{migraphx::shape::int32_type, {2, 2, 2}, {6, 3, 1}};
EXPECT(p.get_output_shapes().back() == s2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::shape sresult{migraphx::shape::int32_type, {2, 2, 2}, {4, 2, 1}};
auto result = p.eval({}).back();
std::vector<int> gold = {1, 2, 4, 5, 7, 8, 10, 11};
...
...
@@ -7692,7 +7692,7 @@ TEST_CASE(slice_test)
l0);
migraphx::shape s2{migraphx::shape::int32_type, {2, 2, 2}, {6, 3, 1}};
EXPECT(p.get_output_shapes().back() == s2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::shape sresult{migraphx::shape::int32_type, {2, 2, 2}, {4, 2, 1}};
auto result = p.eval({}).back();
std::vector<int> gold = {0, 1, 3, 4, 6, 7, 9, 10};
...
...
@@ -7715,7 +7715,7 @@ TEST_CASE(slice_dyn_test0)
migraphx::make_op("slice", {{"axes", {1, 2}}, {"starts", {0, 1}}, {"ends", {1, 6}}}), x);
migraphx::shape s2{migraphx::shape::int32_type, {{2, 3, 0}, {1, 1, 0}, {2, 2, 0}}};
EXPECT(p.get_output_shapes().back() == s2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
// the strides of sresult are those of the original shape, not
// reduced to sliced size.
...
...
@@ -7749,7 +7749,7 @@ TEST_CASE(slice_dyn_test1)
migraphx::shape s2{migraphx::shape::int32_type, {{2, 2, 0}, {2, 2, 0}, {2, 2, 0}}};
EXPECT(p.get_output_shapes().back() == s2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::shape sresult{migraphx::shape::int32_type, {2, 2, 2}, {6, 3, 1}};
migraphx::shape input_fixed_shape{migraphx::shape::int32_type, {2, 2, 3}};
...
...
@@ -7775,7 +7775,7 @@ TEST_CASE(softmax_simple_test)
migraphx::shape a_shape{migraphx::shape::float_type, {1, 2}};
auto al = mm->add_literal(migraphx::literal{a_shape, a});
mm->add_instruction(migraphx::make_op("softmax", {{"axis", 1}}), al);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(2);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7835,7 +7835,7 @@ TEST_CASE(softmax_test)
migraphx::shape a_shape{migraphx::shape::float_type, {5, 3, 4, 2}};
auto al = mm->add_literal(migraphx::literal{a_shape, a});
mm->add_instruction(migraphx::make_op("softmax", {{"axis", 1}}), al);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(120);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7850,7 +7850,7 @@ TEST_CASE(softmax_dyn_test)
{{1, 10, 0}, {1, 3, 3}, {4, 4, 0}, {2, 2, 2}}};
auto al = mm->add_parameter("a", a_shape);
mm->add_instruction(migraphx::make_op("softmax", {{"axis", 1}}), al);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> a = {
-5.61869681e-01, 9.07827199e-01, 1.29255986e+00, 3.18533443e-02, -1.22183852e-03,
...
...
@@ -7913,7 +7913,7 @@ TEST_CASE(sqdiff_test)
auto l1 = mm->add_literal(migraphx::literal{s, {-1, 0, 1}});
auto l2 = mm->add_literal(migraphx::literal{s, {1, 2, 3}});
mm->add_instruction(migraphx::make_op("sqdiff"), l1, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7930,7 +7930,7 @@ TEST_CASE(sqdiff_dyn_test)
auto x = mm->add_parameter("x", s);
auto y = mm->add_parameter("y", s);
mm->add_instruction(migraphx::make_op("sqdiff"), x, y);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> x_data{-1, 0, 1};
std::vector<float> y_data{1, 2, 3};
...
...
@@ -7953,7 +7953,7 @@ TEST_CASE(sqrt_test)
std::vector<float> data{1.02481645, 0.85643062, 0.03404123, 0.92791926, 0.10569184};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("sqrt"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector;
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -7972,7 +7972,7 @@ TEST_CASE(sqrt_dynamic_test)
auto input = mm->add_parameter("X", s);
std::vector<float> input_data{1.02481645, 0.85643062, 0.03404123, 0.92791926, 0.10569184};
mm->add_instruction(migraphx::make_op("sqrt"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::parameter_map params0;
migraphx::shape input_fixed_shape0{migraphx::shape::float_type, {5}};
...
...
@@ -7996,7 +7996,7 @@ TEST_CASE(squeeze_test)
migraphx::shape s2{migraphx::shape::float_type, {4, 3, 1, 3}};
auto l0 = mm->add_literal(migraphx::literal{s1, data});
mm->add_instruction(migraphx::make_op("squeeze", {{"axes", {1}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
EXPECT(result.get_shape() == s2);
}
...
...
@@ -8008,7 +8008,7 @@ TEST_CASE(squeeze_test)
migraphx::shape s2{migraphx::shape::float_type, {4, 1, 3, 3}};
auto l0 = mm->add_literal(migraphx::literal{s1, data});
mm->add_instruction(migraphx::make_op("squeeze", {{"axes", {3}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
EXPECT(result.get_shape() == s2);
}
...
...
@@ -8021,7 +8021,7 @@ TEST_CASE(squeeze_test)
migraphx::shape s2{migraphx::shape::float_type, {4, 3, 3}};
auto l0 = mm->add_literal(migraphx::literal{s1, data});
mm->add_instruction(migraphx::make_op("squeeze"), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
EXPECT(result.get_shape() == s2);
}
...
...
@@ -8035,7 +8035,7 @@ TEST_CASE(squeeze_dyn_test)
{{1, 4, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}}};
auto p0 = mm->add_parameter("x", s1);
mm->add_instruction(migraphx::make_op("squeeze", {{"axes", {1}}}), p0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data(4 * 3 * 3);
migraphx::parameter_map params0;
...
...
@@ -8058,7 +8058,7 @@ TEST_CASE(step_test)
auto r = mm->add_instruction(
migraphx::make_op("step", {{"axes", {0, 2, 3}}, {"steps", {2, 2, 3}}}), l0);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
migraphx::shape s2{migraphx::shape::float_type, {1, 1, 2, 2}};
EXPECT(result.get_shape() == s2);
...
...
@@ -8076,7 +8076,7 @@ TEST_CASE(step_test)
auto r = mm->add_instruction(
migraphx::make_op("step", {{"axes", {0, 1, 2}}, {"steps", {2, 2, 3}}}), tl);
mm->add_return({r});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
migraphx::shape s2{migraphx::shape::float_type, {1, 2, 2, 1}};
EXPECT(result.get_shape() == s2);
...
...
@@ -8091,7 +8091,7 @@ TEST_CASE(sub_test)
auto l1 = mm->add_literal(migraphx::literal{s, {-1, 0, 1}});
auto l2 = mm->add_literal(migraphx::literal{s, {1, 2, 3}});
mm->add_instruction(migraphx::make_op("sub"), l1, l2);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -8108,7 +8108,7 @@ TEST_CASE(sub_dyn_test)
auto x = mm->add_parameter("x", s);
auto y = mm->add_parameter("y", s);
mm->add_instruction(migraphx::make_op("sub"), x, y);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> x_data{-1, 0, 1};
std::vector<float> y_data{1, 2, 3};
...
...
@@ -8131,7 +8131,7 @@ TEST_CASE(tan_test)
std::vector<float> data{-1, 0, 1};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("tan"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -8150,7 +8150,7 @@ TEST_CASE(tan_dynamic_test)
auto input = mm->add_parameter("X", s);
std::vector<float> input_data{-1, 0, 1};
mm->add_instruction(migraphx::make_op("tan"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::parameter_map params0;
migraphx::shape input_fixed_shape0{migraphx::shape::float_type, {3}};
...
...
@@ -8172,7 +8172,7 @@ TEST_CASE(tanh_test)
std::vector<float> data{-1.0, 2.0, -3.0, 4.0};
auto l = mm->add_literal(migraphx::literal{s, data});
mm->add_instruction(migraphx::make_op("tanh"), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> results_vector(4);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
...
...
@@ -8191,7 +8191,7 @@ TEST_CASE(tanh_dynamic_test)
auto input = mm->add_parameter("X", s);
std::vector<float> input_data{-1.0, 2.0, -3.0, 4.0};
mm->add_instruction(migraphx::make_op("tanh"), input);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
migraphx::parameter_map params0;
migraphx::shape input_fixed_shape0{migraphx::shape::float_type, {4}};
...
...
@@ -8223,7 +8223,7 @@ TEST_CASE(topk_test)
auto run_program = [&](int64_t k, int64_t axis, int largest) {
auto p = create_program(k, axis, largest);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> data = {
2.1, 2.3, 2.0, 2.5, 1.9, 3.3, 0.2, 4.5, 0.1, 0.8, 1.0, 4.5, 2.1, 0.8, 1.5};
migraphx::shape s{migraphx::shape::float_type, {3, 5}};
...
...
@@ -8269,7 +8269,7 @@ TEST_CASE(transpose_test)
auto l = mm->add_literal(migraphx::literal{a_shape, data});
std::vector<int64_t> perm = {0, 3, 1, 2};
mm->add_instruction(migraphx::make_op("transpose", {{"permutation", perm}}), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
}
{
...
...
@@ -8280,7 +8280,7 @@ TEST_CASE(transpose_test)
auto result =
mm->add_instruction(migraphx::make_op("transpose", {{"permutation", perm}}), l);
mm->add_instruction(migraphx::make_op("contiguous"), result);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result2 = p.eval({}).back();
std::vector<float> results_vector(12);
...
...
@@ -8298,7 +8298,7 @@ TEST_CASE(transpose_dyn_test)
auto l = mm->add_parameter("X", s);
std::vector<int64_t> perm = {0, 3, 1, 2};
mm->add_instruction(migraphx::make_op("transpose", {{"permutation", perm}}), l);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> data(12);
std::iota(data.begin(), data.end(), 0);
...
...
@@ -8326,7 +8326,7 @@ TEST_CASE(unsqueeze_test)
migraphx::shape s2{migraphx::shape::float_type, {4, 1, 3, 3}};
auto l0 = mm->add_literal(migraphx::literal{s1, data});
mm->add_instruction(migraphx::make_op("unsqueeze", {{"axes", {1}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
EXPECT(result.get_shape() == s2);
}
...
...
@@ -8338,7 +8338,7 @@ TEST_CASE(unsqueeze_test)
migraphx::shape s2{migraphx::shape::float_type, {4, 3, 1, 3}};
auto l0 = mm->add_literal(migraphx::literal{s1, data});
mm->add_instruction(migraphx::make_op("unsqueeze", {{"axes", {2}}}), l0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
EXPECT(result.get_shape() == s2);
}
...
...
@@ -8352,7 +8352,7 @@ TEST_CASE(unsqueeze_dyn_test)
migraphx::shape s1{migraphx::shape::float_type, {{1, 4, 0}, {3, 3, 0}, {3, 3, 0}}};
auto p0 = mm->add_parameter("x", s1);
mm->add_instruction(migraphx::make_op("unsqueeze", {{"axes", {1}}}), p0);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<float> input_data(4 * 3 * 3);
migraphx::parameter_map params0;
...
...
@@ -8379,7 +8379,7 @@ TEST_CASE(where_test)
auto ly = mm->add_literal(migraphx::literal{sx, y});
auto w = mm->add_instruction(migraphx::make_op("where"), lb, lx, ly);
mm->add_return({w});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> result_vec;
result.visit([&](auto output) { result_vec.assign(output.begin(), output.end()); });
...
...
@@ -8401,7 +8401,7 @@ TEST_CASE(where_dyn_test)
auto lx = mm->add_parameter("X", sx);
auto ly = mm->add_parameter("Y", sx);
mm->add_instruction(migraphx::make_op("where"), lb, lx, ly);
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
std::vector<char> b{1, 1, 1, 0, 0, 0, 1, 0, 1};
std::vector<float> x(9, 1.0);
...
...
@@ -8436,7 +8436,7 @@ TEST_CASE(where_broadcasted_inputs_test)
auto mby = mm->add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", {3, 3}}}), ly);
auto w = mm->add_instruction(migraphx::make_op("where"), lb, mbx, mby);
mm->add_return({w});
p.compile(migraphx::
ref::
target
{}
);
p.compile(migraphx::
make_
target
("ref")
);
auto result = p.eval({}).back();
std::vector<float> result_vec;
result.visit([&](auto output) { result_vec.assign(output.begin(), output.end()); });
...
...
Prev
1
2
3
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