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
219ba9b8
Commit
219ba9b8
authored
Aug 01, 2018
by
Paul
Browse files
Formatting
parent
6fe85d43
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
15 deletions
+11
-15
src/include/migraph/literal.hpp
src/include/migraph/literal.hpp
+7
-7
src/program.cpp
src/program.cpp
+1
-4
src/shape.cpp
src/shape.cpp
+2
-1
test/auto_contiguous_test.cpp
test/auto_contiguous_test.cpp
+1
-3
No files found.
src/include/migraph/literal.hpp
View file @
219ba9b8
...
...
@@ -68,7 +68,7 @@ struct literal : raw_data<literal>
template
<
class
Iterator
>
void
fill
(
Iterator
start
,
Iterator
end
)
{
if
(
m_shape
.
packed
())
if
(
m_shape
.
packed
())
{
m_shape
.
visit_type
([
&
](
auto
as
)
{
std
::
copy
(
start
,
end
,
as
.
from
(
buffer
.
data
()));
});
}
...
...
@@ -82,12 +82,12 @@ struct literal : raw_data<literal>
output
(
idx
.
begin
(),
idx
.
end
())
=
*
it
;
});
});
// visit_all(*this)([&](auto output) {
// shape_for_each(output.get_shape(), [&](const auto& idx) {
// it++;
// output(idx.begin(), idx.end()) = *it;
// });
// });
// visit_all(*this)([&](auto output) {
// shape_for_each(output.get_shape(), [&](const auto& idx) {
// it++;
// output(idx.begin(), idx.end()) = *it;
// });
// });
}
}
};
...
...
src/program.cpp
View file @
219ba9b8
...
...
@@ -126,10 +126,7 @@ bool program::has_instruction(instruction_ref ins) const
instruction_ref
program
::
begin
()
{
return
impl
->
instructions
.
begin
();
}
instruction_ref
program
::
end
()
{
return
impl
->
instructions
.
end
();
}
shape
program
::
get_shape
()
const
{
return
impl
->
instructions
.
back
().
result
;
}
shape
program
::
get_shape
()
const
{
return
impl
->
instructions
.
back
().
result
;
}
instruction_ref
program
::
validate
()
const
{
...
...
src/shape.cpp
View file @
219ba9b8
...
...
@@ -22,7 +22,8 @@ shape::shape(type_t t, std::vector<std::size_t> l, std::vector<std::size_t> s)
assert
(
m_lens
.
size
()
==
m_strides
.
size
());
assert
(
std
::
any_of
(
m_strides
.
begin
(),
m_strides
.
end
(),
[](
auto
x
)
{
return
x
>
0
;
})
and
"At least one stride must be non-zero"
);
m_packed
=
this
->
elements
()
==
this
->
element_space
()
and
std
::
is_sorted
(
m_strides
.
rbegin
(),
m_strides
.
rend
());
m_packed
=
this
->
elements
()
==
this
->
element_space
()
and
std
::
is_sorted
(
m_strides
.
rbegin
(),
m_strides
.
rend
());
}
void
shape
::
calculate_strides
()
...
...
test/auto_contiguous_test.cpp
View file @
219ba9b8
...
...
@@ -29,6 +29,4 @@ void after_literal_transpose()
EXPECT
(
p
.
get_shape
().
packed
());
}
int
main
()
{
after_literal_transpose
();
}
int
main
()
{
after_literal_transpose
();
}
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