Commit c9cd5e1f authored by Paul's avatar Paul
Browse files

Formatting

parent 11c7cee5
......@@ -61,16 +61,19 @@ struct shape
shape(type_t t);
shape(type_t t, std::vector<std::size_t> l);
shape(type_t t, std::vector<std::size_t> l, std::vector<std::size_t> s);
template<class Range>
shape(type_t t, const Range& l)
: shape(t, std::vector<std::size_t>(l.begin(), l.end()))
{}
template<class Range1, class Range2>
template <class Range>
shape(type_t t, const Range& l) : shape(t, std::vector<std::size_t>(l.begin(), l.end()))
{
}
template <class Range1, class Range2>
shape(type_t t, const Range1& l, const Range2& s)
: shape(t, std::vector<std::size_t>(l.begin(), l.end()), std::vector<std::size_t>(s.begin(), s.end()))
{}
: shape(t,
std::vector<std::size_t>(l.begin(), l.end()),
std::vector<std::size_t>(s.begin(), s.end()))
{
}
type_t type() const;
const std::vector<std::size_t>& lens() const;
......@@ -152,10 +155,7 @@ struct shape
return reinterpret_cast<const T*>(buffer) + n;
}
type_t type_enum() const
{
return get_type<T>{};
}
type_t type_enum() const { return get_type<T>{}; }
};
template <class Visitor>
......@@ -174,8 +174,7 @@ struct shape
template <class Visitor>
static void visit_types(Visitor v)
{
#define MIGRAPHX_SHAPE_GENERATE_VISITOR_ALL(x, t) \
v(as<t>());
#define MIGRAPHX_SHAPE_GENERATE_VISITOR_ALL(x, t) v(as<t>());
MIGRAPHX_SHAPE_VISIT_TYPES(MIGRAPHX_SHAPE_GENERATE_VISITOR_ALL)
#undef MIGRAPHX_SHAPE_GENERATE_VISITOR_ALL
}
......
......@@ -41,8 +41,7 @@ struct skip_half
f(a);
}
void operator()(migraphx::shape::as<migraphx::half>) const
{}
void operator()(migraphx::shape::as<migraphx::half>) const {}
};
template <class F>
......@@ -77,7 +76,7 @@ migraphx::shape to_shape(const py::buffer_info& info)
{
migraphx::shape::type_t t;
visit_types([&](auto as) {
if (info.format == py::format_descriptor<decltype(as())>::format())
if(info.format == py::format_descriptor<decltype(as())>::format())
t = as.type_enum();
});
return migraphx::shape{t, info.shape, info.strides};
......@@ -104,7 +103,7 @@ PYBIND11_MODULE(migraphx, m)
.def_buffer([](migraphx::argument& x) -> py::buffer_info { return to_buffer_info(x); })
.def("__init__", [](migraphx::argument& x, py::buffer b) {
py::buffer_info info = b.request();
new (&x) migraphx::argument(to_shape(info), info.ptr);
new(&x) migraphx::argument(to_shape(info), info.ptr);
});
py::class_<migraphx::target>(m, "target");
......
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