Commit 219ba9b8 authored by Paul's avatar Paul
Browse files

Formatting

parent 6fe85d43
...@@ -68,7 +68,7 @@ struct literal : raw_data<literal> ...@@ -68,7 +68,7 @@ struct literal : raw_data<literal>
template <class Iterator> template <class Iterator>
void fill(Iterator start, Iterator end) 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())); }); m_shape.visit_type([&](auto as) { std::copy(start, end, as.from(buffer.data())); });
} }
...@@ -82,12 +82,12 @@ struct literal : raw_data<literal> ...@@ -82,12 +82,12 @@ struct literal : raw_data<literal>
output(idx.begin(), idx.end()) = *it; output(idx.begin(), idx.end()) = *it;
}); });
}); });
// visit_all(*this)([&](auto output) { // visit_all(*this)([&](auto output) {
// shape_for_each(output.get_shape(), [&](const auto& idx) { // shape_for_each(output.get_shape(), [&](const auto& idx) {
// it++; // it++;
// output(idx.begin(), idx.end()) = *it; // output(idx.begin(), idx.end()) = *it;
// }); // });
// }); // });
} }
} }
}; };
......
...@@ -126,10 +126,7 @@ bool program::has_instruction(instruction_ref ins) const ...@@ -126,10 +126,7 @@ bool program::has_instruction(instruction_ref ins) const
instruction_ref program::begin() { return impl->instructions.begin(); } instruction_ref program::begin() { return impl->instructions.begin(); }
instruction_ref program::end() { return impl->instructions.end(); } instruction_ref program::end() { return impl->instructions.end(); }
shape program::get_shape() const shape program::get_shape() const { return impl->instructions.back().result; }
{
return impl->instructions.back().result;
}
instruction_ref program::validate() const instruction_ref program::validate() const
{ {
......
...@@ -22,7 +22,8 @@ shape::shape(type_t t, std::vector<std::size_t> l, std::vector<std::size_t> s) ...@@ -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(m_lens.size() == m_strides.size());
assert(std::any_of(m_strides.begin(), m_strides.end(), [](auto x) { return x > 0; }) and assert(std::any_of(m_strides.begin(), m_strides.end(), [](auto x) { return x > 0; }) and
"At least one stride must be non-zero"); "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() void shape::calculate_strides()
......
...@@ -29,6 +29,4 @@ void after_literal_transpose() ...@@ -29,6 +29,4 @@ void after_literal_transpose()
EXPECT(p.get_shape().packed()); EXPECT(p.get_shape().packed());
} }
int main() { int main() { after_literal_transpose(); }
after_literal_transpose();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment