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
"src/include/blockwise_4d_tensor_op.hpp" did not exist on "5ce19234a4538d52e18837a84ebe7c1fef224c71"
Commit
97d5b3ca
authored
Jun 19, 2018
by
Paul
Browse files
Formatting
parent
86576438
Changes
4
Hide 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 @@
...
@@ -5,10 +5,10 @@
namespace
rtg
{
namespace
rtg
{
template
<
bool
...
Bs
>
template
<
bool
...
Bs
>
struct
and_
struct
and_
:
std
::
is_same
<
and_
<
Bs
...
>
,
and_
<
(
Bs
||
true
)...
>>
:
std
::
is_same
<
and_
<
Bs
...
>
,
and_
<
(
Bs
||
true
)...
>>
{
{
};
};
#define RTG_REQUIRES(...) class = typename std::enable_if<and_<__VA_ARGS__, true>{}>::type
#define RTG_REQUIRES(...) class = typename std::enable_if<and_<__VA_ARGS__, true>{}>::type
...
...
src/include/rtg/shape.hpp
View file @
97d5b3ca
...
@@ -61,8 +61,8 @@ struct shape
...
@@ -61,8 +61,8 @@ struct shape
std
::
size_t
index
(
std
::
initializer_list
<
std
::
size_t
>
l
)
const
;
std
::
size_t
index
(
std
::
initializer_list
<
std
::
size_t
>
l
)
const
;
std
::
size_t
index
(
const
std
::
vector
<
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
std
::
size_t
index
(
Iterator
start
,
Iterator
last
)
const
{
{
assert
(
std
::
distance
(
start
,
last
)
<=
this
->
lens
().
size
());
assert
(
std
::
distance
(
start
,
last
)
<=
this
->
lens
().
size
());
...
...
src/include/rtg/shape_for_each.hpp
View file @
97d5b3ca
...
@@ -6,23 +6,23 @@
...
@@ -6,23 +6,23 @@
namespace
rtg
{
namespace
rtg
{
template
<
class
F
>
template
<
class
F
>
void
shape_for_each
(
const
rtg
::
shape
&
s
,
F
f
)
void
shape_for_each
(
const
rtg
::
shape
&
s
,
F
f
)
{
{
// Ensure calls to f use const ref to vector
// Ensure calls to f use const ref to vector
auto
call
=
[
&
f
](
const
std
::
vector
<
std
::
size_t
>&
i
)
{
f
(
i
);
};
auto
call
=
[
&
f
](
const
std
::
vector
<
std
::
size_t
>&
i
)
{
f
(
i
);
};
std
::
vector
<
std
::
size_t
>
indices
(
s
.
lens
().
size
());
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
(),
std
::
transform
(
s
.
strides
().
begin
(),
s
.
strides
().
end
(),
s
.
strides
().
end
(),
s
.
lens
().
begin
(),
s
.
lens
().
begin
(),
indices
.
begin
(),
indices
.
begin
(),
[
&
](
std
::
size_t
stride
,
std
::
size_t
len
)
{
return
(
i
/
stride
)
%
len
;
});
[
&
](
std
::
size_t
stride
,
std
::
size_t
len
)
{
return
(
i
/
stride
)
%
len
;
});
call
(
indices
);
call
(
indices
);
}
}
}
}
}
// namespace rtg
}
// namespace rtg
#endif
#endif
src/shape.cpp
View file @
97d5b3ca
...
@@ -63,14 +63,16 @@ std::size_t shape::index(const std::vector<std::size_t>& l) const
...
@@ -63,14 +63,16 @@ std::size_t shape::index(const std::vector<std::size_t>& l) const
std
::
size_t
shape
::
index
(
std
::
size_t
i
)
const
std
::
size_t
shape
::
index
(
std
::
size_t
i
)
const
{
{
assert
(
this
->
lens
().
size
()
==
this
->
strides
().
size
());
assert
(
this
->
lens
().
size
()
==
this
->
strides
().
size
());
if
(
this
->
packed
())
return
i
;
if
(
this
->
packed
())
else
return
std
::
inner_product
(
return
i
;
this
->
lens
().
begin
(),
else
this
->
lens
().
end
(),
return
std
::
inner_product
(
this
->
strides
().
begin
(),
this
->
lens
().
begin
(),
std
::
size_t
{
0
},
this
->
lens
().
end
(),
std
::
plus
<
std
::
size_t
>
{},
this
->
strides
().
begin
(),
[
&
](
std
::
size_t
len
,
std
::
size_t
stride
)
{
return
((
i
/
stride
)
%
len
)
*
stride
;
});
std
::
size_t
{
0
},
std
::
plus
<
std
::
size_t
>
{},
[
&
](
std
::
size_t
len
,
std
::
size_t
stride
)
{
return
((
i
/
stride
)
%
len
)
*
stride
;
});
}
}
bool
shape
::
packed
()
const
{
return
this
->
m_packed
;
}
bool
shape
::
packed
()
const
{
return
this
->
m_packed
;
}
std
::
size_t
shape
::
element_space
()
const
std
::
size_t
shape
::
element_space
()
const
...
...
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