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
10b99e51
Commit
10b99e51
authored
Sep 14, 2022
by
Po-Yen, Chen
Browse files
Declare variable right before first use
parent
78f72412
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
example/37_permute/common.hpp
example/37_permute/common.hpp
+15
-15
No files found.
example/37_permute/common.hpp
View file @
10b99e51
...
@@ -261,8 +261,8 @@ inline auto copy(InputRange&& range, OutputIterator iter)
...
@@ -261,8 +261,8 @@ inline auto copy(InputRange&& range, OutputIterator iter)
}
// namespace ranges
}
// namespace ranges
template
<
typename
Axes
>
template
<
typename
Axes
>
inline
std
::
enable_if_t
<
detail
::
is_random_access_range_v
<
Axes
>
,
bool
>
inline
auto
is_valid_axes
(
const
Axes
&
axes
)
is_valid_axes
(
const
Axes
&
axes
)
->
std
::
enable_if_t
<
detail
::
is_random_access_range_v
<
Axes
>
,
bool
>
{
{
using
std
::
empty
;
using
std
::
empty
;
if
(
empty
(
axes
))
if
(
empty
(
axes
))
...
@@ -281,7 +281,7 @@ is_valid_axes(const Axes& axes)
...
@@ -281,7 +281,7 @@ is_valid_axes(const Axes& axes)
}
}
template
<
typename
Shape
>
template
<
typename
Shape
>
inline
std
::
enable_if_t
<
detail
::
is_range_v
<
Shape
>
,
bool
>
is_valid_shape
(
const
Shape
&
shape
)
inline
auto
is_valid_shape
(
const
Shape
&
shape
)
->
std
::
enable_if_t
<
detail
::
is_range_v
<
Shape
>
,
bool
>
{
{
using
std
::
begin
,
std
::
end
;
using
std
::
begin
,
std
::
end
;
using
std
::
empty
;
using
std
::
empty
;
...
@@ -289,8 +289,8 @@ inline std::enable_if_t<detail::is_range_v<Shape>, bool> is_valid_shape(const Sh
...
@@ -289,8 +289,8 @@ inline std::enable_if_t<detail::is_range_v<Shape>, bool> is_valid_shape(const Sh
}
}
template
<
typename
Shape
,
typename
Indices
>
template
<
typename
Shape
,
typename
Indices
>
inline
std
::
enable_if_t
<
detail
::
is_sized_range_v
<
Shape
>
&&
detail
::
is_sized_range_v
<
Indices
>
,
bool
>
inline
auto
is_valid_indices
(
const
Shape
&
shape
,
const
Indices
&
indices
)
is_valid_indices
(
const
Shape
&
shape
,
const
Indices
&
indices
)
->
std
::
enable_if_t
<
detail
::
is_sized_range_v
<
Shape
>
&&
detail
::
is_sized_range_v
<
Indices
>
,
bool
>
{
{
if
(
!
is_valid_shape
(
shape
))
if
(
!
is_valid_shape
(
shape
))
{
{
...
@@ -365,10 +365,10 @@ auto extend_axes(const Problem::Axes& axes)
...
@@ -365,10 +365,10 @@ auto extend_axes(const Problem::Axes& axes)
}
}
template
<
typename
Shape
,
typename
Indices
>
template
<
typename
Shape
,
typename
Indices
>
std
::
enable_if_t
<
detail
::
is_bidirectional_range_v
<
Shape
>
&&
detail
::
is_sized_range_v
<
Shape
>
&&
auto
advance_indices
(
const
Shape
&
shape
,
Indices
&
indices
)
->
std
::
enable_if_t
<
detail
::
is_bidirectional_range_v
<
Shape
>
&&
detail
::
is_sized_range_v
<
Shape
>
&&
detail
::
is_bidirectional_range_v
<
Indices
>
&&
detail
::
is_sized_range_v
<
Indices
>
,
detail
::
is_bidirectional_range_v
<
Indices
>
&&
detail
::
is_sized_range_v
<
Indices
>
,
bool
>
bool
>
advance_indices
(
const
Shape
&
shape
,
Indices
&
indices
)
{
{
using
std
::
size
;
using
std
::
size
;
if
(
!
(
is_valid_shape
(
shape
)
&&
is_valid_indices
(
shape
,
indices
)
&&
size
(
shape
)
==
size
(
indices
)))
if
(
!
(
is_valid_shape
(
shape
)
&&
is_valid_indices
(
shape
,
indices
)
&&
size
(
shape
)
==
size
(
indices
)))
...
@@ -393,12 +393,12 @@ advance_indices(const Shape& shape, Indices& indices)
...
@@ -393,12 +393,12 @@ advance_indices(const Shape& shape, Indices& indices)
}
}
template
<
typename
Src
,
typename
Axes
,
typename
Functor
,
typename
Dest
>
template
<
typename
Src
,
typename
Axes
,
typename
Functor
,
typename
Dest
>
std
::
enable_if_t
<
detail
::
is_random_access_range_v
<
Axes
>
&&
detail
::
is_sized_range_v
<
Axes
>
&&
auto
host_permute
(
const
Tensor
<
Src
>&
src
,
const
Axes
&
axes
,
Functor
functor
,
Tensor
<
Dest
>&
dest
)
->
std
::
enable_if_t
<
detail
::
is_random_access_range_v
<
Axes
>
&&
detail
::
is_sized_range_v
<
Axes
>
&&
std
::
is_invocable_v
<
Functor
,
std
::
is_invocable_v
<
Functor
,
std
::
add_lvalue_reference_t
<
Dest
>
,
std
::
add_lvalue_reference_t
<
Dest
>
,
std
::
add_lvalue_reference_t
<
Src
>>
,
std
::
add_lvalue_reference_t
<
Src
>>
,
bool
>
bool
>
host_permute
(
const
Tensor
<
Src
>&
src
,
const
Axes
&
axes
,
Functor
functor
,
Tensor
<
Dest
>&
dest
)
{
{
const
auto
&
shape
=
src
.
mDesc
.
GetLengths
();
const
auto
&
shape
=
src
.
mDesc
.
GetLengths
();
const
auto
&
transposed_shape
=
dest
.
mDesc
.
GetLengths
();
const
auto
&
transposed_shape
=
dest
.
mDesc
.
GetLengths
();
...
...
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