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
97d5b3ca
Commit
97d5b3ca
authored
Jun 19, 2018
by
Paul
Browse files
Formatting
parent
86576438
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
21 deletions
+23
-21
src/include/rtg/requires.hpp
src/include/rtg/requires.hpp
+4
-4
src/include/rtg/shape.hpp
src/include/rtg/shape.hpp
+2
-2
src/include/rtg/shape_for_each.hpp
src/include/rtg/shape_for_each.hpp
+7
-7
src/shape.cpp
src/shape.cpp
+10
-8
No files found.
src/include/rtg/requires.hpp
View file @
97d5b3ca
...
...
@@ -5,10 +5,10 @@
namespace
rtg
{
template
<
bool
...
Bs
>
struct
and_
:
std
::
is_same
<
and_
<
Bs
...
>
,
and_
<
(
Bs
||
true
)...
>>
{
};
template
<
bool
...
Bs
>
struct
and_
:
std
::
is_same
<
and_
<
Bs
...
>
,
and_
<
(
Bs
||
true
)...
>>
{
};
#define RTG_REQUIRES(...) class = typename std::enable_if<and_<__VA_ARGS__, true>{}>::type
...
...
src/include/rtg/shape.hpp
View file @
97d5b3ca
...
...
@@ -62,7 +62,7 @@ struct shape
std
::
size_t
index
(
std
::
initializer_list
<
std
::
size_t
>
l
)
const
;
std
::
size_t
index
(
const
std
::
vector
<
std
::
size_t
>&
l
)
const
;
template
<
class
Iterator
>
template
<
class
Iterator
>
std
::
size_t
index
(
Iterator
start
,
Iterator
last
)
const
{
assert
(
std
::
distance
(
start
,
last
)
<=
this
->
lens
().
size
());
...
...
src/include/rtg/shape_for_each.hpp
View file @
97d5b3ca
...
...
@@ -6,13 +6,14 @@
namespace
rtg
{
template
<
class
F
>
template
<
class
F
>
void
shape_for_each
(
const
rtg
::
shape
&
s
,
F
f
)
{
// Ensure calls to f use const ref to vector
auto
call
=
[
&
f
](
const
std
::
vector
<
std
::
size_t
>&
i
)
{
f
(
i
);
};
std
::
vector
<
std
::
size_t
>
indices
(
s
.
lens
().
size
());
for
(
std
::
size_t
i
=
0
;
i
<
s
.
elements
();
i
++
)
{
for
(
std
::
size_t
i
=
0
;
i
<
s
.
elements
();
i
++
)
{
std
::
transform
(
s
.
strides
().
begin
(),
s
.
strides
().
end
(),
s
.
lens
().
begin
(),
...
...
@@ -22,7 +23,6 @@ void shape_for_each(const rtg::shape& s, F f)
}
}
}
// namespace rtg
#endif
src/shape.cpp
View file @
97d5b3ca
...
...
@@ -63,8 +63,10 @@ std::size_t shape::index(const std::vector<std::size_t>& l) const
std
::
size_t
shape
::
index
(
std
::
size_t
i
)
const
{
assert
(
this
->
lens
().
size
()
==
this
->
strides
().
size
());
if
(
this
->
packed
())
return
i
;
else
return
std
::
inner_product
(
if
(
this
->
packed
())
return
i
;
else
return
std
::
inner_product
(
this
->
lens
().
begin
(),
this
->
lens
().
end
(),
this
->
strides
().
begin
(),
...
...
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