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
9aa3f5d3
Commit
9aa3f5d3
authored
Apr 28, 2023
by
Paul
Browse files
Add dim state
parent
665455e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
src/common_dims.cpp
src/common_dims.cpp
+27
-0
No files found.
src/common_dims.cpp
View file @
9aa3f5d3
...
...
@@ -31,6 +31,33 @@ static auto elements(const Range& r)
return
elements
(
r
.
begin
(),
r
.
end
());
}
struct
common_dim_state
{
common_dim_state
(
const
std
::
vector
<
std
::
size_t
>&
pdims
)
:
dims
(
&
pdims
),
it
(
dims
->
begin
())
{}
const
std
::
vector
<
std
::
size_t
>*
dims
;
std
::
vector
<
std
::
size_t
>::
const_iterator
it
;
std
::
size_t
rem
=
1
;
std
::
size_t
get
()
const
{
return
*
it
;
}
bool
is_end
()
const
{
return
it
==
dims
->
end
();
}
void
next
(
std
::
size_t
i
=
1
)
{
it
+=
i
;
}
auto
dims_for
(
std
::
size_t
d
)
const
{
auto
dim_end
=
compute_end_dim
(
it
,
dims
->
end
(),
d
);
return
range
(
it
,
dim_end
);
}
}
common_dims
common_dims
::
compute
(
const
std
::
vector
<
std
::
size_t
>&
dims1
,
const
std
::
vector
<
std
::
size_t
>&
dims2
)
{
...
...
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