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
40fbef9b
Unverified
Commit
40fbef9b
authored
Aug 05, 2023
by
Ted Themistokleous
Committed by
GitHub
Aug 05, 2023
Browse files
Merge branch 'develop' into threaded_nms
parents
d164b151
aeb9f78c
Changes
440
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
672 additions
and
17 deletions
+672
-17
test/validate.cpp
test/validate.cpp
+5
-4
test/verify/CMakeLists.txt
test/verify/CMakeLists.txt
+1
-1
test/verify/gemm_add_broadcast_half.cpp
test/verify/gemm_add_broadcast_half.cpp
+49
-0
test/verify/gemm_add_half.cpp
test/verify/gemm_add_half.cpp
+47
-0
test/verify/main.cpp
test/verify/main.cpp
+3
-1
test/verify/run_verify.cpp
test/verify/run_verify.cpp
+24
-3
test/verify/test_add_nhwc.cpp
test/verify/test_add_nhwc.cpp
+44
-0
test/verify/test_avg_pooling_pad.cpp
test/verify/test_avg_pooling_pad.cpp
+43
-0
test/verify/test_convolution_backwards.cpp
test/verify/test_convolution_backwards.cpp
+2
-2
test/verify/test_convolution_backwards_1d.cpp
test/verify/test_convolution_backwards_1d.cpp
+2
-2
test/verify/test_convolution_backwards_2d_alt.cpp
test/verify/test_convolution_backwards_2d_alt.cpp
+47
-0
test/verify/test_convolution_backwards_2x3.cpp
test/verify/test_convolution_backwards_2x3.cpp
+2
-2
test/verify/test_convolution_backwards_3d.cpp
test/verify/test_convolution_backwards_3d.cpp
+2
-2
test/verify/test_dot_mul_a.cpp
test/verify/test_dot_mul_a.cpp
+50
-0
test/verify/test_dot_mul_b.cpp
test/verify/test_dot_mul_b.cpp
+50
-0
test/verify/test_instancenorm.cpp
test/verify/test_instancenorm.cpp
+97
-0
test/verify/test_literal_limits.cpp
test/verify/test_literal_limits.cpp
+54
-0
test/verify/test_min_max.cpp
test/verify/test_min_max.cpp
+52
-0
test/verify/test_mul_dot_a.cpp
test/verify/test_mul_dot_a.cpp
+49
-0
test/verify/test_mul_dot_b.cpp
test/verify/test_mul_dot_b.cpp
+49
-0
No files found.
test/validate.cpp
View file @
40fbef9b
...
...
@@ -23,6 +23,7 @@
*/
#include <migraphx/program.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/make_op.hpp>
#include <basic_ops.hpp>
#include <test.hpp>
#include <rob.hpp>
...
...
@@ -33,7 +34,7 @@ TEST_CASE(simple_test)
auto
*
mm
=
p
.
get_main_module
();
auto
one
=
mm
->
add_literal
(
1
);
auto
two
=
mm
->
add_literal
(
2
);
mm
->
add_instruction
(
sum_op
{}
,
one
,
two
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
)
,
one
,
two
);
EXPECT
(
bool
{
mm
->
validate
()
==
mm
->
end
()});
auto
result
=
p
.
eval
({});
EXPECT
(
result
.
back
()
==
migraphx
::
literal
{
3
});
...
...
@@ -46,7 +47,7 @@ TEST_CASE(out_of_order)
auto
*
mm
=
p
.
get_main_module
();
auto
one
=
mm
->
add_literal
(
1
);
auto
two
=
mm
->
add_literal
(
2
);
auto
ins
=
mm
->
add_instruction
(
sum_op
{}
,
one
,
two
);
auto
ins
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
)
,
one
,
two
);
mm
->
move_instruction
(
two
,
mm
->
end
());
EXPECT
(
bool
{
p
.
validate
()
==
ins
});
}
...
...
@@ -57,7 +58,7 @@ TEST_CASE(incomplete_args)
auto
*
mm
=
p
.
get_main_module
();
auto
one
=
mm
->
add_literal
(
1
);
auto
two
=
mm
->
add_literal
(
2
);
auto
ins
=
mm
->
add_instruction
(
sum_op
{}
,
one
,
two
);
auto
ins
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
)
,
one
,
two
);
ins
->
clear_arguments
();
EXPECT
(
bool
{
p
.
validate
()
==
ins
});
}
...
...
@@ -73,7 +74,7 @@ TEST_CASE(invalid_args)
auto
*
mm
=
p
.
get_main_module
();
auto
one
=
mm
->
add_literal
(
1
);
auto
two
=
mm
->
add_literal
(
2
);
auto
ins
=
mm
->
add_instruction
(
sum_op
{}
,
one
,
two
);
auto
ins
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
)
,
one
,
two
);
access_ins_arguments
(
*
ins
).
clear
();
EXPECT
(
bool
{
mm
->
validate
()
==
mm
->
begin
()});
}
...
...
test/verify/CMakeLists.txt
View file @
40fbef9b
...
...
@@ -22,7 +22,7 @@
# THE SOFTWARE.
#####################################################################################
file
(
GLOB VERIFY_TESTS
${
CONFIGURE_DEPENDS
}
*.cpp
)
file
(
GLOB VERIFY_TESTS CONFIGURE_DEPENDS *.cpp
)
add_executable
(
test_verify
${
VERIFY_TESTS
}
)
add_dependencies
(
tests test_verify
)
...
...
test/verify/gemm_add_broadcast_half.cpp
0 → 100644
View file @
40fbef9b
/*
* 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.hpp>
struct
gemm_add_broadcast_half
:
verify_program
<
gemm_add_broadcast_half
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
half_type
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
half_type
,
{
1
,
3
,
4
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
half_type
,
{
1
,
1
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
auto
l3_b
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
1
,
2
,
4
}}}),
l3
);
auto
dot
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
l1
,
l2
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
dot
,
l3_b
);
return
p
;
}
};
test/verify/gemm_add_half.cpp
0 → 100644
View file @
40fbef9b
/*
* 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.hpp>
struct
gemm_add_half
:
verify_program
<
gemm_add_half
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
half_type
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
half_type
,
{
1
,
3
,
4
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
half_type
,
{
1
,
2
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
auto
dot
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
l1
,
l2
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
dot
,
l3
);
return
p
;
}
};
test/verify/main.cpp
View file @
40fbef9b
...
...
@@ -74,7 +74,9 @@ int main(int argc, const char* argv[])
"test_select_module_add"
,
"test_select_module_reduce"
,
"test_select_module_conv"
,
"test_split_single_dyn_dim"
});
"test_split_single_dyn_dim"
,
"test_instancenorm_large_3d<migraphx::shape::float_type>"
,
"test_instancenorm_large_3d<migraphx::shape::half_type>"
});
rv
.
disable_test_for
(
"gpu"
,
{
"test_conv_bn_add"
});
rv
.
run
(
argc
,
argv
);
}
test/verify/run_verify.cpp
View file @
40fbef9b
...
...
@@ -49,7 +49,7 @@ std::future<typename std::result_of<Function()>::type> detach_async(Function&& f
{
if
(
parallel
)
{
using
result_type
=
typename
std
::
result
_of
<
Function
()
>::
type
;
using
result_type
=
typename
std
::
invoke_
result
<
Function
>::
type
;
std
::
packaged_task
<
result_type
()
>
task
(
std
::
forward
<
Function
>
(
f
));
auto
fut
=
task
.
get_future
();
std
::
thread
(
std
::
move
(
task
)).
detach
();
...
...
@@ -88,10 +88,31 @@ inline void compile_check(migraphx::program& p,
auto
num
=
shapes
.
size
();
for
(
std
::
size_t
i
=
0
;
i
<
num
;
++
i
)
{
if
(
p
.
get_output_shapes
()[
i
].
lens
()
!=
shapes
[
i
].
lens
())
auto
output_shape
=
p
.
get_output_shapes
()[
i
];
if
(
output_shape
.
dynamic
()
and
shapes
[
i
].
dynamic
())
{
if
(
output_shape
.
dyn_dims
()
!=
shapes
[
i
].
dyn_dims
())
{
std
::
cout
<<
ss
.
str
()
<<
std
::
endl
;
throw
std
::
runtime_error
(
"Compiling program with "
+
name
+
" alters its dynamic output dimensions"
);
}
}
else
if
(
not
(
output_shape
.
dynamic
()
or
shapes
[
i
].
dynamic
()))
{
if
(
output_shape
.
lens
()
!=
shapes
[
i
].
lens
())
{
std
::
cout
<<
ss
.
str
()
<<
std
::
endl
;
throw
std
::
runtime_error
(
"Compiling program with "
+
name
+
" alters its static output dimensions"
);
}
}
else
{
std
::
cout
<<
ss
.
str
()
<<
std
::
endl
;
throw
std
::
runtime_error
(
"Compiling program with "
+
name
+
" alters its shape"
);
throw
std
::
runtime_error
(
"Compiling program with "
+
name
+
" alters its output dimensions (static shape vs dynamic shape)"
);
}
}
if
(
t
.
name
()
!=
"ref"
)
...
...
test/verify/test_add_nhwc.cpp
0 → 100644
View file @
40fbef9b
/*
* 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_add_nhwc
:
verify_program
<
test_add_nhwc
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
s
=
migraphx
::
shape
::
from_permutation
(
migraphx
::
shape
::
float_type
,
{
4
,
3
,
8
,
8
},
{
0
,
2
,
3
,
1
});
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
y
=
mm
->
add_parameter
(
"y"
,
s
);
auto
add
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
y
);
mm
->
add_return
({
add
});
return
p
;
}
};
test/verify/test_avg_pooling_pad.cpp
0 → 100644
View file @
40fbef9b
/*
* The MIT License (MIT)
*
* Copyright (c) 2023 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/op/pooling.hpp>
struct
test_avg_pooling_pad
:
verify_program
<
test_avg_pooling_pad
>
{
migraphx
::
program
create_program
()
const
{
// pooling test with nonzero padding
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
input
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
7
}});
auto
op
=
migraphx
::
op
::
pooling
{
migraphx
::
op
::
pooling_mode
::
average
,
{
2
},
{
1
},
{
3
}};
mm
->
add_instruction
(
op
,
input
);
return
p
;
}
};
test/verify/test_
de
conv.cpp
→
test/verify/test_conv
olution_backwards
.cpp
View file @
40fbef9b
...
...
@@ -27,7 +27,7 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_
de
conv
:
verify_program
<
test_
de
conv
>
struct
test_conv
olution_backwards
:
verify_program
<
test_conv
olution_backwards
>
{
migraphx
::
program
create_program
()
const
{
...
...
@@ -37,7 +37,7 @@ struct test_deconv : verify_program<test_deconv>
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
3
,
3
}});
auto
weights
=
mm
->
add_parameter
(
"w"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
3
,
3
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"
de
convolution"
),
input
,
weights
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"convolution
_backwards
"
),
input
,
weights
);
return
p
;
}
};
test/verify/test_
de
conv_1d.cpp
→
test/verify/test_conv
olution_backwards
_1d.cpp
View file @
40fbef9b
...
...
@@ -27,7 +27,7 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_
de
conv_1d
:
verify_program
<
test_
de
conv_1d
>
struct
test_conv
olution_backwards
_1d
:
verify_program
<
test_conv
olution_backwards
_1d
>
{
migraphx
::
program
create_program
()
const
{
...
...
@@ -38,7 +38,7 @@ struct test_deconv_1d : verify_program<test_deconv_1d>
auto
weights
=
mm
->
add_parameter
(
"w"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
3
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"
de
convolution"
,
migraphx
::
make_op
(
"convolution
_backwards
"
,
{{
"padding"
,
{
0
}},
{
"stride"
,
{
1
}},
{
"dilation"
,
{
1
}}}),
input
,
weights
);
...
...
test/verify/test_convolution_backwards_2d_alt.cpp
0 → 100644
View file @
40fbef9b
/*
* 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_convolution_backwards_2d_alt
:
verify_program
<
test_convolution_backwards_2d_alt
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
input
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
10
,
10
}});
auto
weights
=
mm
->
add_parameter
(
"w"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
3
,
3
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"convolution_backwards"
,
{{
"padding"
,
{
2
,
2
}},
{
"stride"
,
{
2
,
2
}},
{
"dilation"
,
{
2
,
2
}}}),
input
,
weights
);
return
p
;
}
};
test/verify/test_
de
conv_2x3.cpp
→
test/verify/test_conv
olution_backwards
_2x3.cpp
View file @
40fbef9b
...
...
@@ -27,7 +27,7 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_
de
conv_2x3
:
verify_program
<
test_
de
conv_2x3
>
struct
test_conv
olution_backwards
_2x3
:
verify_program
<
test_conv
olution_backwards
_2x3
>
{
migraphx
::
program
create_program
()
const
{
...
...
@@ -38,7 +38,7 @@ struct test_deconv_2x3 : verify_program<test_deconv_2x3>
auto
weights
=
mm
->
add_parameter
(
"w"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
3
,
3
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"
de
convolution"
,
migraphx
::
make_op
(
"convolution
_backwards
"
,
{{
"padding"
,
{
1
,
1
}},
{
"stride"
,
{
2
,
3
}},
{
"dilation"
,
{
1
,
1
}}}),
input
,
weights
);
...
...
test/verify/test_
de
conv_3d.cpp
→
test/verify/test_conv
olution_backwards
_3d.cpp
View file @
40fbef9b
...
...
@@ -27,7 +27,7 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_
de
conv_3d
:
verify_program
<
test_
de
conv_3d
>
struct
test_conv
olution_backwards
_3d
:
verify_program
<
test_conv
olution_backwards
_3d
>
{
migraphx
::
program
create_program
()
const
{
...
...
@@ -39,7 +39,7 @@ struct test_deconv_3d : verify_program<test_deconv_3d>
mm
->
add_parameter
(
"w"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
3
,
3
,
3
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"
de
convolution"
,
"convolution
_backwards
"
,
{{
"padding"
,
{
0
,
0
,
0
}},
{
"stride"
,
{
1
,
1
,
1
}},
{
"dilation"
,
{
1
,
1
,
1
}}}),
input
,
weights
);
...
...
test/verify/test_dot_mul_a.cpp
0 → 100644
View file @
40fbef9b
/*
* 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/instruction.hpp>
struct
test_dot_mul_a
:
verify_program
<
test_dot_mul_a
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
as
{
migraphx
::
shape
::
float_type
,
{
2
,
256
,
32
}};
migraphx
::
shape
bs
{
migraphx
::
shape
::
float_type
,
{
2
,
32
,
128
}};
auto
a
=
mm
->
add_parameter
(
"input"
,
as
);
auto
b
=
mm
->
add_literal
(
migraphx
::
generate_literal
(
bs
));
auto
dot
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
a
,
b
);
auto
lit
=
mm
->
add_literal
(
migraphx
::
generate_literal
({
migraphx
::
shape
::
float_type
,
{
1
,
1
,
128
}}));
auto
litb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
dot
->
get_shape
().
lens
()}}),
lit
);
auto
mul
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
dot
,
litb
);
mm
->
add_return
({
mul
});
return
p
;
}
};
test/verify/test_dot_mul_b.cpp
0 → 100644
View file @
40fbef9b
/*
* 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/instruction.hpp>
struct
test_dot_mul_b
:
verify_program
<
test_dot_mul_b
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
as
{
migraphx
::
shape
::
float_type
,
{
2
,
256
,
32
}};
migraphx
::
shape
bs
{
migraphx
::
shape
::
float_type
,
{
2
,
32
,
128
}};
auto
a
=
mm
->
add_literal
(
migraphx
::
generate_literal
(
as
));
auto
b
=
mm
->
add_parameter
(
"input"
,
bs
);
auto
dot
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
a
,
b
);
auto
lit
=
mm
->
add_literal
(
migraphx
::
generate_literal
({
migraphx
::
shape
::
float_type
,
{
1
,
256
,
1
}}));
auto
litb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
dot
->
get_shape
().
lens
()}}),
lit
);
auto
mul
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
dot
,
litb
);
mm
->
add_return
({
mul
});
return
p
;
}
};
test/verify/test_instancenorm.cpp
0 → 100644
View file @
40fbef9b
/*
* 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/common.hpp>
#include <migraphx/make_op.hpp>
migraphx
::
instruction_ref
add_instancenorm
(
migraphx
::
module
&
m
,
migraphx
::
instruction_ref
x
,
const
std
::
vector
<
size_t
>&
dims
,
float
eps
=
1e-5
f
)
{
auto
mgx_type
=
x
->
get_shape
().
type
();
auto
x_lens
=
x
->
get_shape
().
lens
();
std
::
vector
<
size_t
>
axes
(
x_lens
.
size
()
-
2
);
std
::
iota
(
axes
.
begin
(),
axes
.
end
(),
2
);
auto
scale
=
m
.
add_parameter
(
"scale"
,
migraphx
::
shape
{
mgx_type
,
dims
});
auto
bias
=
m
.
add_parameter
(
"bias"
,
migraphx
::
shape
{
mgx_type
,
dims
});
auto
epsilon
=
m
.
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
mgx_type
},
{
eps
}});
auto
mean
=
m
.
add_instruction
(
migraphx
::
make_op
(
"reduce_mean"
,
{{
"axes"
,
axes
}}),
x
);
auto
mean_mbcast
=
m
.
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
x_lens
}}),
mean
);
auto
sub
=
m
.
add_instruction
(
migraphx
::
make_op
(
"sub"
),
x
,
mean_mbcast
);
auto
l0
=
m
.
add_instruction
(
migraphx
::
make_op
(
"sqdiff"
),
{
x
,
mean_mbcast
});
auto
var
=
m
.
add_instruction
(
migraphx
::
make_op
(
"reduce_mean"
,
{{
"axes"
,
axes
}}),
{
l0
});
auto
epsilon_mbcast
=
m
.
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
x_lens
}}),
epsilon
);
auto
var_mbcast
=
m
.
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
x_lens
}}),
var
);
auto
add_epsilon
=
m
.
add_instruction
(
migraphx
::
make_op
(
"add"
),
var_mbcast
,
epsilon_mbcast
);
auto
rsqrt
=
m
.
add_instruction
(
migraphx
::
make_op
(
"rsqrt"
),
add_epsilon
);
auto
l1
=
m
.
add_instruction
(
migraphx
::
make_op
(
"mul"
),
{
sub
,
rsqrt
});
auto
scale_mbcast
=
m
.
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
x_lens
}}),
scale
);
auto
mul
=
m
.
add_instruction
(
migraphx
::
make_op
(
"mul"
),
scale_mbcast
,
l1
);
auto
bias_mbcast
=
m
.
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
x_lens
}}),
bias
);
return
m
.
add_instruction
(
migraphx
::
make_op
(
"add"
),
mul
,
bias_mbcast
);
}
template
<
migraphx
::
shape
::
type_t
TYPE
>
struct
test_instancenorm
:
verify_program
<
test_instancenorm
<
TYPE
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
std
::
vector
<
size_t
>
dims
=
{
1
,
2
,
5
,
5
};
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
TYPE
,
dims
});
add_instancenorm
(
*
mm
,
x
,
{
1
,
2
,
1
,
1
});
return
p
;
}
};
template
struct
test_instancenorm
<
migraphx
::
shape
::
float_type
>;
template
struct
test_instancenorm
<
migraphx
::
shape
::
half_type
>;
template
<
migraphx
::
shape
::
type_t
TYPE
>
struct
test_instancenorm_large_3d
:
verify_program
<
test_instancenorm_large_3d
<
TYPE
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
std
::
vector
<
size_t
>
dims
=
{
1
,
32
,
64
,
64
,
64
};
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
TYPE
,
dims
});
add_instancenorm
(
*
mm
,
x
,
{
1
,
32
,
1
,
1
,
1
});
return
p
;
}
};
template
struct
test_instancenorm_large_3d
<
migraphx
::
shape
::
float_type
>;
template
struct
test_instancenorm_large_3d
<
migraphx
::
shape
::
half_type
>;
test/verify/test_literal_limits.cpp
0 → 100644
View file @
40fbef9b
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/make_op.hpp>
#include <limits>
template
<
migraphx
::
shape
::
type_t
Q
,
typename
T
>
struct
test_literal_limits
:
verify_program
<
test_literal_limits
<
Q
,
T
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
input_s
=
migraphx
::
shape
(
Q
,
{
3
,
1
});
auto
infinity_val
=
std
::
numeric_limits
<
T
>::
infinity
();
std
::
vector
<
T
>
s_data
{
infinity_val
,
static_cast
<
T
>
(
-
infinity_val
),
std
::
numeric_limits
<
T
>::
quiet_NaN
()};
auto
input_param
=
mm
->
add_parameter
(
"test_input"
,
input_s
);
auto
input
=
mm
->
add_literal
(
migraphx
::
literal
{
input_s
,
s_data
});
auto
o1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
input
,
input_param
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"isnan"
),
o1
);
return
p
;
}
};
template
struct
test_literal_limits
<
migraphx
::
shape
::
float_type
,
float
>;
template
struct
test_literal_limits
<
migraphx
::
shape
::
double_type
,
double
>;
template
struct
test_literal_limits
<
migraphx
::
shape
::
half_type
,
migraphx
::
half
>;
template
struct
test_literal_limits
<
migraphx
::
shape
::
int32_type
,
int32_t
>;
template
struct
test_literal_limits
<
migraphx
::
shape
::
int8_type
,
int8_t
>;
test/verify/test_min_max.cpp
0 → 100644
View file @
40fbef9b
/*
* 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/op/max.hpp>
#include <migraphx/op/min.hpp>
template
<
class
Op
,
migraphx
::
shape
::
type_t
T
>
struct
test_min_max
:
verify_program
<
test_min_max
<
Op
,
T
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
T
,
{
128
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
y
=
mm
->
add_parameter
(
"y"
,
s
);
mm
->
add_instruction
(
Op
{},
x
,
y
);
return
p
;
}
};
template
struct
test_min_max
<
migraphx
::
op
::
max
,
migraphx
::
shape
::
float_type
>;
template
struct
test_min_max
<
migraphx
::
op
::
max
,
migraphx
::
shape
::
half_type
>;
template
struct
test_min_max
<
migraphx
::
op
::
max
,
migraphx
::
shape
::
double_type
>;
template
struct
test_min_max
<
migraphx
::
op
::
min
,
migraphx
::
shape
::
float_type
>;
template
struct
test_min_max
<
migraphx
::
op
::
min
,
migraphx
::
shape
::
half_type
>;
template
struct
test_min_max
<
migraphx
::
op
::
min
,
migraphx
::
shape
::
double_type
>;
test/verify/test_mul_dot_a.cpp
0 → 100644
View file @
40fbef9b
/*
* 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_mul_dot_a
:
verify_program
<
test_mul_dot_a
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
as
{
migraphx
::
shape
::
float_type
,
{
2
,
256
,
32
}};
migraphx
::
shape
bs
{
migraphx
::
shape
::
float_type
,
{
2
,
32
,
128
}};
auto
a
=
mm
->
add_parameter
(
"input"
,
as
);
auto
lit
=
mm
->
add_literal
(
migraphx
::
generate_literal
({
migraphx
::
shape
::
float_type
,
{
1
,
1
,
32
}}));
auto
litb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
as
.
lens
()}}),
lit
);
auto
mul
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
a
,
litb
);
auto
b
=
mm
->
add_literal
(
migraphx
::
generate_literal
(
bs
));
auto
dot
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
mul
,
b
);
mm
->
add_return
({
dot
});
return
p
;
}
};
test/verify/test_mul_dot_b.cpp
0 → 100644
View file @
40fbef9b
/*
* 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_mul_dot_b
:
verify_program
<
test_mul_dot_b
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
as
{
migraphx
::
shape
::
float_type
,
{
2
,
256
,
32
}};
migraphx
::
shape
bs
{
migraphx
::
shape
::
float_type
,
{
2
,
32
,
128
}};
auto
b
=
mm
->
add_parameter
(
"input"
,
bs
);
auto
lit
=
mm
->
add_literal
(
migraphx
::
generate_literal
({
migraphx
::
shape
::
float_type
,
{
1
,
32
,
1
}}));
auto
litb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
bs
.
lens
()}}),
lit
);
auto
mul
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
b
,
litb
);
auto
a
=
mm
->
add_literal
(
migraphx
::
generate_literal
(
as
));
auto
dot
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
a
,
mul
);
mm
->
add_return
({
dot
});
return
p
;
}
};
Prev
1
…
17
18
19
20
21
22
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