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
composable_kernel
Commits
2fb0521d
Commit
2fb0521d
authored
May 23, 2023
by
Adam Osewski
Browse files
Add some utilities.
parent
5d7fb2a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
library/include/ck/library/utility/fill.hpp
library/include/ck/library/utility/fill.hpp
+9
-0
library/include/ck/library/utility/host_tensor.hpp
library/include/ck/library/utility/host_tensor.hpp
+4
-1
No files found.
library/include/ck/library/utility/fill.hpp
View file @
2fb0521d
...
...
@@ -112,6 +112,15 @@ struct FillConstant
{
std
::
fill
(
first
,
last
,
value_
);
}
template
<
typename
ForwardRange
>
auto
operator
()(
ForwardRange
&&
range
)
const
->
std
::
void_t
<
decltype
(
std
::
declval
<
const
FillConstant
&>
()(
std
::
begin
(
std
::
forward
<
ForwardRange
>
(
range
)),
std
::
end
(
std
::
forward
<
ForwardRange
>
(
range
))))
>
{
(
*
this
)(
std
::
begin
(
std
::
forward
<
ForwardRange
>
(
range
)),
std
::
end
(
std
::
forward
<
ForwardRange
>
(
range
)));
}
};
}
// namespace utils
...
...
library/include/ck/library/utility/host_tensor.hpp
View file @
2fb0521d
...
...
@@ -33,9 +33,10 @@ std::ostream& LogRange(std::ostream& os, Range&& range, std::string delim)
}
template
<
typename
T
,
typename
Range
>
std
::
ostream
&
LogRangeAsType
(
std
::
ostream
&
os
,
Range
&&
range
,
std
::
string
delim
)
std
::
ostream
&
LogRangeAsType
(
std
::
ostream
&
os
,
Range
&&
range
,
std
::
string
delim
,
int
row_size
=
16
)
{
bool
first
=
true
;
int
col
=
0
;
for
(
auto
&&
v
:
range
)
{
if
(
first
)
...
...
@@ -43,6 +44,8 @@ std::ostream& LogRangeAsType(std::ostream& os, Range&& range, std::string delim)
else
os
<<
delim
;
os
<<
static_cast
<
T
>
(
v
);
if
((
++
col
%
row_size
)
==
0
)
os
<<
"
\n
"
;
}
return
os
;
}
...
...
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