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
0ff0839d
You need to sign in or sign up before continuing.
Commit
0ff0839d
authored
Nov 01, 2022
by
charlie
Browse files
Merge branch 'dyn_broadcast' of github.com:ROCmSoftwarePlatform/AMDMIGraphX into dyn_unsqueeze
parents
e026d93c
ab812826
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
6 deletions
+7
-6
src/api/include/migraphx/migraphx.hpp
src/api/include/migraphx/migraphx.hpp
+1
-0
src/include/migraphx/op/broadcast.hpp
src/include/migraphx/op/broadcast.hpp
+2
-2
src/onnx/parse_binary_op.cpp
src/onnx/parse_binary_op.cpp
+2
-2
test/shape_test.cpp
test/shape_test.cpp
+2
-2
No files found.
src/api/include/migraphx/migraphx.hpp
View file @
0ff0839d
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include <memory>
#include <memory>
#include <numeric>
#include <numeric>
#include <exception>
#include <exception>
#include <array>
#include <vector>
#include <vector>
#include <cassert>
#include <cassert>
#include <iostream>
#include <iostream>
...
...
src/include/migraphx/op/broadcast.hpp
View file @
0ff0839d
...
@@ -128,8 +128,8 @@ struct broadcast
...
@@ -128,8 +128,8 @@ struct broadcast
{
{
MIGRAPHX_THROW
(
"BROADCAST_2in: s0 length doesn't match with static s1 axis "
MIGRAPHX_THROW
(
"BROADCAST_2in: s0 length doesn't match with static s1 axis "
"dimension length ("
+
"dimension length ("
+
migraphx
::
to_string
(
s0
.
dyn_dim
s
()[
0
])
+
migraphx
::
to_string
(
s0
.
len
s
()[
0
])
+
" != "
+
migraphx
::
to_string
(
s1
.
dyn_dim
s
()[
axis
])
+
")"
);
" != "
+
migraphx
::
to_string
(
s1
.
len
s
()[
axis
])
+
")"
);
}
}
std
::
vector
<
size_t
>
bcast_strides
(
s1
.
ndim
(),
0
);
std
::
vector
<
size_t
>
bcast_strides
(
s1
.
ndim
(),
0
);
std
::
copy
(
s0
.
strides
().
begin
(),
s0
.
strides
().
end
(),
bcast_strides
.
begin
()
+
axis
);
std
::
copy
(
s0
.
strides
().
begin
(),
s0
.
strides
().
end
(),
bcast_strides
.
begin
()
+
axis
);
...
...
src/onnx/parse_binary_op.cpp
View file @
0ff0839d
...
@@ -58,10 +58,10 @@ struct parse_binary_op : op_parser<parse_binary_op>
...
@@ -58,10 +58,10 @@ struct parse_binary_op : op_parser<parse_binary_op>
if
(
broadcasted
!=
0
)
if
(
broadcasted
!=
0
)
{
{
if
(
std
::
any_of
(
if
(
std
::
any_of
(
args
.
cbegin
(),
args
.
cend
(),
[](
auto
a
)
{
a
->
get_shape
().
dynamic
();
}))
args
.
cbegin
(),
args
.
cend
(),
[](
auto
a
)
{
return
a
->
get_shape
().
dynamic
();
}))
{
{
MIGRAPHX_THROW
(
MIGRAPHX_THROW
(
"
b
inary op broadcast attribute not supported for dynamic input shapes"
);
"
B
inary op broadcast attribute not supported for dynamic input shapes"
);
}
}
uint64_t
axis
=
parser
.
parse_value
(
info
.
attributes
.
at
(
"axis"
)).
at
<
uint64_t
>
();
uint64_t
axis
=
parser
.
parse_value
(
info
.
attributes
.
at
(
"axis"
)).
at
<
uint64_t
>
();
auto
l
=
info
.
add_instruction
(
auto
l
=
info
.
add_instruction
(
...
...
test/shape_test.cpp
View file @
0ff0839d
...
@@ -194,7 +194,7 @@ TEST_CASE(test_shape_ndim_static)
...
@@ -194,7 +194,7 @@ TEST_CASE(test_shape_ndim_static)
EXPECT
(
s1
.
ndim
()
==
4
);
EXPECT
(
s1
.
ndim
()
==
4
);
migraphx
::
shape
s2
{
migraphx
::
shape
::
float_type
,
{
2
,
4
,
4
,
1
,
3
}};
migraphx
::
shape
s2
{
migraphx
::
shape
::
float_type
,
{
2
,
4
,
4
,
1
,
3
}};
EXPECT
(
s
1
.
ndim
()
==
5
);
EXPECT
(
s
2
.
ndim
()
==
5
);
}
}
TEST_CASE
(
test_shape_ndim_dyn
)
TEST_CASE
(
test_shape_ndim_dyn
)
...
@@ -207,7 +207,7 @@ TEST_CASE(test_shape_ndim_dyn)
...
@@ -207,7 +207,7 @@ TEST_CASE(test_shape_ndim_dyn)
migraphx
::
shape
s2
{
migraphx
::
shape
::
float_type
,
migraphx
::
shape
s2
{
migraphx
::
shape
::
float_type
,
{{
1
,
1
,
0
},
{
2
,
4
,
0
},
{
2
,
4
,
0
},
{
1
,
1
,
1
},
{
3
,
3
,
0
}}};
{{
1
,
1
,
0
},
{
2
,
4
,
0
},
{
2
,
4
,
0
},
{
1
,
1
,
1
},
{
3
,
3
,
0
}}};
EXPECT
(
s
1
.
ndim
()
==
5
);
EXPECT
(
s
2
.
ndim
()
==
5
);
}
}
TEST_CASE
(
test_shape_non_packed_single_dim
)
TEST_CASE
(
test_shape_non_packed_single_dim
)
...
...
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