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
b43f4184
Commit
b43f4184
authored
Apr 04, 2022
by
Shucai Xiao
Browse files
add dynamic dimension in the shape class
parent
8e4d622f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
src/include/migraphx/shape.hpp
src/include/migraphx/shape.hpp
+17
-0
src/shape.cpp
src/shape.cpp
+1
-0
No files found.
src/include/migraphx/shape.hpp
View file @
b43f4184
...
...
@@ -54,6 +54,20 @@ struct shape
MIGRAPHX_SHAPE_VISIT_TYPES
(
MIGRAPHX_SHAPE_GENERATE_GET_TYPE
)
#undef MIGRAPHX_SHAPE_GENERATE_GET_TYPE
// dynamic dimension to support dynamic shape
struct
dynamic_dimension
{
std
::
size_t
min
=
0
;
std
::
size_t
max
=
0
;
std
::
size_t
opt
=
0
;
// is the dimension fixed
bool
is_fixed
()
const
;
// does the dimension have an optimal size
bool
has_optimal
()
const
;
};
template
<
class
T
>
struct
get_type
<
const
T
>
:
get_type
<
T
>
{
...
...
@@ -84,6 +98,9 @@ struct shape
shape
(
const
std
::
vector
<
shape
>&
subs
);
// constructor for dynamic shape
shape
(
type_t
t
,
std
::
vector
<
dynamic_dimension
>
dims
);
static
shape
from_permutation
(
type_t
t
,
const
std
::
vector
<
std
::
size_t
>&
l
,
const
std
::
vector
<
int64_t
>&
perm
);
type_t
type
()
const
;
...
...
src/shape.cpp
View file @
b43f4184
...
...
@@ -50,6 +50,7 @@ struct shape_impl
std
::
vector
<
std
::
size_t
>
m_strides
=
{};
std
::
vector
<
shape
>
m_shapes
=
{};
bool
m_standard
=
false
;
std
::
vector
<
shape
::
dynamic_dimension
>
dynamic_dims
=
{};
void
calculate_strides
()
{
...
...
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