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
7064962b
Commit
7064962b
authored
Dec 06, 2022
by
charlie
Browse files
Tidy fix and api test fix
parent
ba40f978
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
test/api/test_cpu.cpp
test/api/test_cpu.cpp
+2
-2
test/onnx/verify_onnx.cpp
test/onnx/verify_onnx.cpp
+18
-18
No files found.
test/api/test_cpu.cpp
View file @
7064962b
...
@@ -66,7 +66,7 @@ TEST_CASE(load_and_run_init_list)
...
@@ -66,7 +66,7 @@ TEST_CASE(load_and_run_init_list)
TEST_CASE
(
quantize_fp16
)
TEST_CASE
(
quantize_fp16
)
{
{
auto
p1
=
migraphx
::
parse_onnx
(
"gemm_
ex_
test.onnx"
);
auto
p1
=
migraphx
::
parse_onnx
(
"gemm_test.onnx"
);
const
auto
&
p2
=
p1
;
const
auto
&
p2
=
p1
;
const
auto
&
p3
=
p1
;
const
auto
&
p3
=
p1
;
migraphx
::
quantize_fp16
(
p1
);
migraphx
::
quantize_fp16
(
p1
);
...
@@ -82,7 +82,7 @@ TEST_CASE(quantize_fp16)
...
@@ -82,7 +82,7 @@ TEST_CASE(quantize_fp16)
TEST_CASE
(
quantize_int8
)
TEST_CASE
(
quantize_int8
)
{
{
auto
p1
=
migraphx
::
parse_onnx
(
"gemm_
ex_
test.onnx"
);
auto
p1
=
migraphx
::
parse_onnx
(
"gemm_test.onnx"
);
const
auto
&
p2
=
p1
;
const
auto
&
p2
=
p1
;
auto
t
=
migraphx
::
target
(
"ref"
);
auto
t
=
migraphx
::
target
(
"ref"
);
migraphx
::
quantize_int8_options
options
;
migraphx
::
quantize_int8_options
options
;
...
...
test/onnx/verify_onnx.cpp
View file @
7064962b
...
@@ -456,30 +456,30 @@ TEST_CASE(gemm_test)
...
@@ -456,30 +456,30 @@ TEST_CASE(gemm_test)
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"gemm_brcst_C_test.onnx"
);
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"gemm_brcst_C_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{});
p
.
compile
(
migraphx
::
ref
::
target
{});
migraphx
::
shape
A
_shape
{
migraphx
::
shape
::
float_type
,
{
5
,
6
}};
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
,
std
::
vector
<
float
>
a
_data
=
{
0.26472837
,
0.8525864
,
0.41929847
,
0.14151508
,
0.43216065
,
0.67468566
,
0.42488748
,
0.82021785
,
0.9782456
,
0.5794279
,
0.67468566
,
0.42488748
,
0.82021785
,
0.9782456
,
0.5794279
,
0.6627283
,
0.4790396
,
0.9237051
,
0.7340607
,
0.67379653
,
0.6627283
,
0.4790396
,
0.9237051
,
0.7340607
,
0.67379653
,
0.87168175
,
0.37324256
,
0.33278653
,
0.42736676
,
0.024699844
,
0.87168175
,
0.37324256
,
0.33278653
,
0.42736676
,
0.024699844
,
0.75851107
,
0.48719302
,
0.5834426
,
0.6938476
,
0.43747696
,
0.75851107
,
0.48719302
,
0.5834426
,
0.6938476
,
0.43747696
,
0.24054702
,
0.26912406
,
0.6760658
,
0.5419149
,
0.89949054
};
0.24054702
,
0.26912406
,
0.6760658
,
0.5419149
,
0.89949054
};
migraphx
::
shape
B
_shape
{
migraphx
::
shape
::
float_type
,
{
5
,
7
}};
migraphx
::
shape
b
_shape
{
migraphx
::
shape
::
float_type
,
{
5
,
7
}};
std
::
vector
<
float
>
B
_data
=
{
std
::
vector
<
float
>
b
_data
=
{
0.65727437
,
0.54262096
,
0.14126152
,
0.8994123
,
0.21831702
,
0.81191784
,
0.9371278
,
0.65727437
,
0.54262096
,
0.14126152
,
0.8994123
,
0.21831702
,
0.81191784
,
0.9371278
,
0.3438551
,
0.7121373
,
0.90316695
,
0.26614252
,
0.80144906
,
0.80301756
,
0.49930334
,
0.3438551
,
0.7121373
,
0.90316695
,
0.26614252
,
0.80144906
,
0.80301756
,
0.49930334
,
0.0719704
,
0.63484156
,
0.7343097
,
0.32130218
,
0.7094916
,
0.6116475
,
0.74144083
,
0.0719704
,
0.63484156
,
0.7343097
,
0.32130218
,
0.7094916
,
0.6116475
,
0.74144083
,
0.021210382
,
0.38724765
,
0.44830495
,
0.62347615
,
0.022489505
,
0.23316588
,
0.76540905
,
0.021210382
,
0.38724765
,
0.44830495
,
0.62347615
,
0.022489505
,
0.23316588
,
0.76540905
,
0.895689
,
0.81540287
,
0.223875
,
0.9275573
,
0.4621397
,
0.70785195
,
0.5658555
};
0.895689
,
0.81540287
,
0.223875
,
0.9275573
,
0.4621397
,
0.70785195
,
0.5658555
};
migraphx
::
shape
C
_shape
{
migraphx
::
shape
::
float_type
,
{
6
,
1
}};
migraphx
::
shape
c
_shape
{
migraphx
::
shape
::
float_type
,
{
6
,
1
}};
std
::
vector
<
float
>
C
_data
=
{
std
::
vector
<
float
>
c
_data
=
{
0.07358502
,
0.13792239
,
0.8574055
,
0.40553397
,
0.38205826
,
0.62062204
};
0.07358502
,
0.13792239
,
0.8574055
,
0.40553397
,
0.38205826
,
0.62062204
};
migraphx
::
parameter_map
params
;
migraphx
::
parameter_map
params
;
params
[
"A"
]
=
migraphx
::
argument
(
A
_shape
,
A
_data
.
data
());
params
[
"A"
]
=
migraphx
::
argument
(
a
_shape
,
a
_data
.
data
());
params
[
"B"
]
=
migraphx
::
argument
(
B
_shape
,
B
_data
.
data
());
params
[
"B"
]
=
migraphx
::
argument
(
b
_shape
,
b
_data
.
data
());
params
[
"C"
]
=
migraphx
::
argument
(
C
_shape
,
C
_data
.
data
());
params
[
"C"
]
=
migraphx
::
argument
(
c
_shape
,
c
_data
.
data
());
auto
result
=
p
.
eval
(
params
).
back
();
auto
result
=
p
.
eval
(
params
).
back
();
std
::
vector
<
float
>
result_vector
;
std
::
vector
<
float
>
result_vector
;
...
@@ -500,32 +500,32 @@ TEST_CASE(gemm_half_test)
...
@@ -500,32 +500,32 @@ TEST_CASE(gemm_half_test)
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"gemm_half_test.onnx"
);
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"gemm_half_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{});
p
.
compile
(
migraphx
::
ref
::
target
{});
migraphx
::
shape
A
_shape
{
migraphx
::
shape
::
half_type
,
{
8
,
6
}};
migraphx
::
shape
a
_shape
{
migraphx
::
shape
::
half_type
,
{
8
,
6
}};
std
::
vector
tmp
=
{
0.2646
,
0.8525
,
0.4192
,
0.1415
,
0.4321
,
0.675
,
0.4248
,
0.8203
,
std
::
vector
tmp
=
{
0.2646
,
0.8525
,
0.4192
,
0.1415
,
0.4321
,
0.675
,
0.4248
,
0.8203
,
0.978
,
0.5796
,
0.6626
,
0.479
,
0.924
,
0.734
,
0.674
,
0.8716
,
0.978
,
0.5796
,
0.6626
,
0.479
,
0.924
,
0.734
,
0.674
,
0.8716
,
0.3733
,
0.3328
,
0.4272
,
0.0247
,
0.7583
,
0.4873
,
0.5835
,
0.694
,
0.3733
,
0.3328
,
0.4272
,
0.0247
,
0.7583
,
0.4873
,
0.5835
,
0.694
,
0.4375
,
0.2406
,
0.269
,
0.6763
,
0.542
,
0.8994
,
0.657
,
0.5425
,
0.4375
,
0.2406
,
0.269
,
0.6763
,
0.542
,
0.8994
,
0.657
,
0.5425
,
0.1412
,
0.8994
,
0.2183
,
0.812
,
0.937
,
0.3438
,
0.712
,
0.9033
,
0.1412
,
0.8994
,
0.2183
,
0.812
,
0.937
,
0.3438
,
0.712
,
0.9033
,
0.266
,
0.8013
,
0.803
,
0.4993
,
0.07196
,
0.635
,
0.7344
,
0.3213
};
0.266
,
0.8013
,
0.803
,
0.4993
,
0.07196
,
0.635
,
0.7344
,
0.3213
};
std
::
vector
<
migraphx
::
half
>
A
_data
{
tmp
.
cbegin
(),
tmp
.
cend
()};
std
::
vector
<
migraphx
::
half
>
a
_data
{
tmp
.
cbegin
(),
tmp
.
cend
()};
migraphx
::
shape
B
_shape
{
migraphx
::
shape
::
half_type
,
{
8
,
7
}};
migraphx
::
shape
b
_shape
{
migraphx
::
shape
::
half_type
,
{
8
,
7
}};
tmp
=
{
0.7095
,
0.612
,
0.741
,
0.02121
,
0.3872
,
0.4482
,
0.6235
,
0.02249
,
0.2332
,
0.7656
,
tmp
=
{
0.7095
,
0.612
,
0.741
,
0.02121
,
0.3872
,
0.4482
,
0.6235
,
0.02249
,
0.2332
,
0.7656
,
0.8955
,
0.8154
,
0.2239
,
0.9277
,
0.4622
,
0.708
,
0.566
,
0.0736
,
0.138
,
0.8574
,
0.8955
,
0.8154
,
0.2239
,
0.9277
,
0.4622
,
0.708
,
0.566
,
0.0736
,
0.138
,
0.8574
,
0.4055
,
0.382
,
0.6206
,
0.424
,
0.3674
,
0.435
,
0.998
,
0.3594
,
0.701
,
0.6216
,
0.4055
,
0.382
,
0.6206
,
0.424
,
0.3674
,
0.435
,
0.998
,
0.3594
,
0.701
,
0.6216
,
0.01826
,
0.6313
,
0.514
,
0.1095
,
0.3203
,
0.01636
,
0.537
,
0.01952
,
0.4502
,
0.8965
,
0.01826
,
0.6313
,
0.514
,
0.1095
,
0.3203
,
0.01636
,
0.537
,
0.01952
,
0.4502
,
0.8965
,
0.5415
,
0.7456
,
0.793
,
0.756
,
0.9
,
0.5264
,
0.05368
,
0.4214
,
0.276
,
0.1517
,
0.5415
,
0.7456
,
0.793
,
0.756
,
0.9
,
0.5264
,
0.05368
,
0.4214
,
0.276
,
0.1517
,
0.08453
,
0.83
,
0.417
,
0.1682
,
0.845
,
0.1729
};
0.08453
,
0.83
,
0.417
,
0.1682
,
0.845
,
0.1729
};
std
::
vector
<
migraphx
::
half
>
B
_data
{
tmp
.
cbegin
(),
tmp
.
cend
()};
std
::
vector
<
migraphx
::
half
>
b
_data
{
tmp
.
cbegin
(),
tmp
.
cend
()};
migraphx
::
shape
C
_shape
{
migraphx
::
shape
::
half_type
,
{
6
,
1
}};
migraphx
::
shape
c
_shape
{
migraphx
::
shape
::
half_type
,
{
6
,
1
}};
tmp
=
{
0.10846
,
0.672
,
0.527
,
0.94
,
0.429
,
0.2291
};
tmp
=
{
0.10846
,
0.672
,
0.527
,
0.94
,
0.429
,
0.2291
};
std
::
vector
<
migraphx
::
half
>
C
_data
{
tmp
.
cbegin
(),
tmp
.
cend
()};
std
::
vector
<
migraphx
::
half
>
c
_data
{
tmp
.
cbegin
(),
tmp
.
cend
()};
migraphx
::
parameter_map
params
;
migraphx
::
parameter_map
params
;
params
[
"A"
]
=
migraphx
::
argument
(
A
_shape
,
A
_data
.
data
());
params
[
"A"
]
=
migraphx
::
argument
(
a
_shape
,
a
_data
.
data
());
params
[
"B"
]
=
migraphx
::
argument
(
B
_shape
,
B
_data
.
data
());
params
[
"B"
]
=
migraphx
::
argument
(
b
_shape
,
b
_data
.
data
());
params
[
"C"
]
=
migraphx
::
argument
(
C
_shape
,
C
_data
.
data
());
params
[
"C"
]
=
migraphx
::
argument
(
c
_shape
,
c
_data
.
data
());
auto
result
=
p
.
eval
(
params
).
back
();
auto
result
=
p
.
eval
(
params
).
back
();
std
::
vector
<
migraphx
::
half
>
result_vector
;
std
::
vector
<
migraphx
::
half
>
result_vector
;
...
...
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