"vscode:/vscode.git/clone" did not exist on "8390b3622284499df8f94f12ce27564b92c9c7c0"
Commit 8f76125c authored by charlie's avatar charlie
Browse files

formatting

parent c497c12d
......@@ -176,7 +176,8 @@ struct shape
std::vector<std::size_t> multi(std::size_t i) const;
void multi_copy(std::size_t i, std::size_t* start, const std::size_t* end) const;
/// Returns true if the shape is packed (number of elements and buffer size the same) with no padding
/// Returns true if the shape is packed (number of elements and buffer size the same) with no
/// padding
bool packed() const;
/// Returns true is the shape has been transposed. That is the strides are not in descending
......
......@@ -78,12 +78,7 @@ struct shape_impl
if(not m_dyn_dims.empty())
{
auto maxes = max_lens();
return std::accumulate(
maxes.begin(),
maxes.end(),
std::size_t{1},
std::multiplies<>()
);
return std::accumulate(maxes.begin(), maxes.end(), std::size_t{1}, std::multiplies<>());
}
assert(m_lens.size() == m_strides.size());
......@@ -115,45 +110,30 @@ struct shape_impl
std::vector<std::size_t> min_lens() const
{
std::vector<std::size_t> ret(m_dyn_dims.size());
std::transform(
m_dyn_dims.cbegin(),
m_dyn_dims.cend(),
ret.begin(),
[](shape::dynamic_dimension x)
{
return x.min;
}
);
std::transform(m_dyn_dims.cbegin(),
m_dyn_dims.cend(),
ret.begin(),
[](shape::dynamic_dimension x) { return x.min; });
return ret;
}
std::vector<std::size_t> max_lens() const
{
std::vector<std::size_t> ret(m_dyn_dims.size());
std::transform(
m_dyn_dims.cbegin(),
m_dyn_dims.cend(),
ret.begin(),
[](shape::dynamic_dimension x)
{
return x.max;
}
);
std::transform(m_dyn_dims.cbegin(),
m_dyn_dims.cend(),
ret.begin(),
[](shape::dynamic_dimension x) { return x.max; });
return ret;
}
std::vector<std::size_t> opt_lens() const
{
std::vector<std::size_t> ret(m_dyn_dims.size());
std::transform(
m_dyn_dims.cbegin(),
m_dyn_dims.cend(),
ret.begin(),
[](shape::dynamic_dimension x)
{
return x.opt;
}
);
std::transform(m_dyn_dims.cbegin(),
m_dyn_dims.cend(),
ret.begin(),
[](shape::dynamic_dimension x) { return x.opt; });
return ret;
}
......@@ -439,29 +419,32 @@ const std::vector<shape::dynamic_dimension>& shape::dyn_dims() const { return im
std::vector<std::size_t> shape::min_lens() const
{
if (not this->dynamic())
if(not this->dynamic())
{
return this->lens();
}
return impl->min_lens();;
return impl->min_lens();
;
}
std::vector<std::size_t> shape::max_lens() const
{
if (not this->dynamic())
if(not this->dynamic())
{
return this->lens();
}
return impl->max_lens();;
return impl->max_lens();
;
}
std::vector<std::size_t> shape::opt_lens() const
{
if (not this->dynamic())
if(not this->dynamic())
{
return this->lens();
}
return impl->opt_lens();;
return impl->opt_lens();
;
}
bool operator==(const shape& x, const shape& y)
......@@ -520,11 +503,11 @@ void migraphx_to_value(value& v, const shape& s)
result["type"] = migraphx::to_value(s.type_string());
if(s.dynamic())
{
result["dynamic"] = migraphx::to_value(s.dynamic());
result["min_lens"] = migraphx::to_value(s.min_lens());
result["max_lens"] = migraphx::to_value(s.max_lens());
result["opt_lens"] = migraphx::to_value(s.opt_lens());
result["sub_shapes"] = migraphx::to_value(s.sub_shapes());
result["dynamic"] = migraphx::to_value(s.dynamic());
result["min_lens"] = migraphx::to_value(s.min_lens());
result["max_lens"] = migraphx::to_value(s.max_lens());
result["opt_lens"] = migraphx::to_value(s.opt_lens());
result["sub_shapes"] = migraphx::to_value(s.sub_shapes());
}
else
{
......
......@@ -91,10 +91,7 @@ TEST_CASE(test_shape_dynamic_compares)
EXPECT(s0 != s3);
}
TEST_CASE(test_shape_dynamic_bytes)
{
}
TEST_CASE(test_shape_dynamic_bytes) {}
TEST_CASE(test_shape_dynamic_errors)
{
......
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