Commit 211892db authored by Paul's avatar Paul
Browse files

Formatting

parent 0083b90b
...@@ -39,10 +39,7 @@ struct batch_norm_inference ...@@ -39,10 +39,7 @@ struct batch_norm_inference
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(
f(self.epsilon, "epsilon"), f(self.epsilon, "epsilon"), f(self.momentum, "momentum"), f(self.bn_mode, "bn_mode"));
f(self.momentum, "momentum"),
f(self.bn_mode, "bn_mode")
);
} }
shape compute_shape(std::vector<shape> inputs) const shape compute_shape(std::vector<shape> inputs) const
...@@ -68,12 +65,10 @@ struct convolution ...@@ -68,12 +65,10 @@ struct convolution
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(f(self.padding, "padding"),
f(self.padding, "padding"), f(self.stride, "stride"),
f(self.stride, "stride"), f(self.dilation, "dilation"),
f(self.dilation, "dilation"), f(self.padding_mode, "padding_mode"));
f(self.padding_mode, "padding_mode")
);
} }
std::string name() const { return "convolution"; } std::string name() const { return "convolution"; }
...@@ -148,12 +143,10 @@ struct im2col ...@@ -148,12 +143,10 @@ struct im2col
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(f(self.padding, "padding"),
f(self.padding, "padding"), f(self.stride, "stride"),
f(self.stride, "stride"), f(self.dilation, "dilation"),
f(self.dilation, "dilation"), f(self.padding_mode, "padding_mode"));
f(self.padding_mode, "padding_mode")
);
} }
std::string name() const { return "im2col"; } std::string name() const { return "im2col"; }
...@@ -194,12 +187,10 @@ struct pooling ...@@ -194,12 +187,10 @@ struct pooling
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(f(self.mode, "mode"),
f(self.mode, "mode"), f(self.padding, "padding"),
f(self.padding, "padding"), f(self.stride, "stride"),
f(self.stride, "stride"), f(self.lengths, "lengths"));
f(self.lengths, "lengths")
);
} }
std::string name() const { return "pooling"; } std::string name() const { return "pooling"; }
...@@ -255,9 +246,7 @@ struct transpose ...@@ -255,9 +246,7 @@ struct transpose
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(f(self.dims, "dims"));
f(self.dims, "dims")
);
} }
std::string name() const { return "transpose"; } std::string name() const { return "transpose"; }
...@@ -318,11 +307,7 @@ struct slice ...@@ -318,11 +307,7 @@ struct slice
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(f(self.axes, "axes"), f(self.starts, "starts"), f(self.ends, "ends"));
f(self.axes, "axes"),
f(self.starts, "starts"),
f(self.ends, "ends")
);
} }
std::string name() const { return "slice"; } std::string name() const { return "slice"; }
...@@ -401,9 +386,7 @@ struct squeeze ...@@ -401,9 +386,7 @@ struct squeeze
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(f(self.axes, "axes"));
f(self.axes, "axes")
);
} }
std::string name() const { return "squeeze"; } std::string name() const { return "squeeze"; }
...@@ -450,9 +433,7 @@ struct unsqueeze ...@@ -450,9 +433,7 @@ struct unsqueeze
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(f(self.axes, "axes"));
f(self.axes, "axes")
);
} }
std::string name() const { return "unsqueeze"; } std::string name() const { return "unsqueeze"; }
...@@ -490,9 +471,7 @@ struct reshape ...@@ -490,9 +471,7 @@ struct reshape
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(f(self.dims, "dims"));
f(self.dims, "dims")
);
} }
std::string name() const { return "reshape"; } std::string name() const { return "reshape"; }
...@@ -544,10 +523,7 @@ struct gemm ...@@ -544,10 +523,7 @@ struct gemm
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(f(self.alpha, "alpha"), f(self.beta, "beta"));
f(self.alpha, "alpha"),
f(self.beta, "beta")
);
} }
std::string name() const { return "gemm"; } std::string name() const { return "gemm"; }
...@@ -651,9 +627,7 @@ struct flatten ...@@ -651,9 +627,7 @@ struct flatten
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(f(self.axis, "axis"));
f(self.axis, "axis")
);
} }
std::string name() const { return "flatten"; } std::string name() const { return "flatten"; }
...@@ -684,9 +658,7 @@ struct broadcast ...@@ -684,9 +658,7 @@ struct broadcast
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(f(self.axis, "axis"));
f(self.axis, "axis")
);
} }
shape broadcast_shape; shape broadcast_shape;
...@@ -759,10 +731,7 @@ struct load ...@@ -759,10 +731,7 @@ struct load
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(f(self.s, "shape"), f(self.offset, "offset"));
f(self.s, "shape"),
f(self.offset, "offset")
);
} }
std::string name() const { return "load"; } std::string name() const { return "load"; }
...@@ -784,9 +753,7 @@ struct outline ...@@ -784,9 +753,7 @@ struct outline
template <class Self, class F> template <class Self, class F>
static auto reflect(Self& self, F f) static auto reflect(Self& self, F f)
{ {
return pack( return pack(f(self.s, "shape"));
f(self.s, "shape")
);
} }
std::string name() const { return "outline"; } std::string name() const { return "outline"; }
......
...@@ -34,20 +34,21 @@ inline stream_range_container<Range> stream_range(const Range& r) ...@@ -34,20 +34,21 @@ inline stream_range_container<Range> stream_range(const Range& r)
namespace detail { namespace detail {
template<class Range> template <class Range>
auto stream_write_value_impl(rank<1>, std::ostream& os, const Range& r) -> decltype(r.begin(), r.end(), void()) auto stream_write_value_impl(rank<1>, std::ostream& os, const Range& r)
-> decltype(r.begin(), r.end(), void())
{ {
os << stream_range(r); os << stream_range(r);
} }
template<class T> template <class T>
void stream_write_value_impl(rank<0>, std::ostream& os, const T& x) void stream_write_value_impl(rank<0>, std::ostream& os, const T& x)
{ {
os << x; os << x;
} }
} // namespace detail } // namespace detail
template<class T> template <class T>
void stream_write_value(std::ostream& os, const T& x) void stream_write_value(std::ostream& os, const T& x)
{ {
detail::stream_write_value_impl(rank<1>{}, os, x); detail::stream_write_value_impl(rank<1>{}, os, x);
......
...@@ -54,8 +54,8 @@ void pytorch_conv_bn_relu_maxpool() ...@@ -54,8 +54,8 @@ void pytorch_conv_bn_relu_maxpool()
auto l3 = p.add_instruction(migraph::op::convolution{}, l0, l1); auto l3 = p.add_instruction(migraph::op::convolution{}, l0, l1);
auto l4 = p.add_instruction(migraph::op::broadcast{axis, l3->get_shape()}, l2); auto l4 = p.add_instruction(migraph::op::broadcast{axis, l3->get_shape()}, l2);
auto l5 = p.add_instruction(migraph::op::add{}, l3, l4); auto l5 = p.add_instruction(migraph::op::add{}, l3, l4);
auto l6 = p.add_instruction(migraph::op::batch_norm_inference{1.0e-5f}, l5, p3, p4, p5, p6); auto l6 = p.add_instruction(migraph::op::batch_norm_inference{1.0e-5f}, l5, p3, p4, p5, p6);
auto l7 = p.add_instruction(migraph::op::activation{"relu"}, l6); auto l7 = p.add_instruction(migraph::op::activation{"relu"}, l6);
p.add_instruction(migraph::op::pooling{"max", {{0, 0}}, {{2, 2}}, {{2, 2}}}, l7); p.add_instruction(migraph::op::pooling{"max", {{0, 0}}, {{2, 2}}, {{2, 2}}}, l7);
auto prog = migraph::parse_onnx("conv_bn_relu_maxpool.onnx"); auto prog = migraph::parse_onnx("conv_bn_relu_maxpool.onnx");
......
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