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
caf2b2ed
Commit
caf2b2ed
authored
Aug 01, 2022
by
Anthony Chang
Browse files
host tensor gen: diagonal pattern in lowest two-dimensions only
parent
b790e44b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
library/include/ck/library/utility/host_tensor_generator.hpp
library/include/ck/library/utility/host_tensor_generator.hpp
+4
-3
No files found.
library/include/ck/library/utility/host_tensor_generator.hpp
View file @
caf2b2ed
...
...
@@ -152,7 +152,7 @@ struct GeneratorTensor_Sequential
}
};
template
<
typename
T
>
template
<
typename
T
,
size_t
NumEffectiveDim
=
2
>
struct
GeneratorTensor_Diagonal
{
T
value
{
1
};
...
...
@@ -161,9 +161,10 @@ struct GeneratorTensor_Diagonal
T
operator
()(
Ts
...
Xs
)
const
{
std
::
array
<
ck
::
index_t
,
sizeof
...(
Ts
)
>
dims
=
{{
static_cast
<
ck
::
index_t
>
(
Xs
)...}};
size_t
start_dim
=
dims
.
size
()
-
NumEffectiveDim
;
bool
pred
=
true
;
for
(
size_t
i
=
1
;
i
<
dims
.
size
();
i
++
)
{
pred
&=
(
dims
[
0
]
==
dims
[
i
]);
for
(
size_t
i
=
start_dim
+
1
;
i
<
dims
.
size
();
i
++
)
{
pred
&=
(
dims
[
start_dim
]
==
dims
[
i
]);
}
return
pred
?
value
:
T
{
0
};
}
...
...
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