Commit bc12dc60 authored by Paul's avatar Paul
Browse files

Formatting

parent 9a3fc32d
......@@ -28,7 +28,8 @@ struct argument : raw_data<argument>
argument(shape s, std::function<char*()> d) : data(std::move(d)), m_shape(std::move(s)) {}
template <class T>
argument(shape s, T* d) : data([d] { return reinterpret_cast<char*>(d); }), m_shape(std::move(s))
argument(shape s, T* d)
: data([d] { return reinterpret_cast<char*>(d); }), m_shape(std::move(s))
{
}
......
......@@ -13,7 +13,10 @@ struct literal
{
std::string name() const { return "@literal"; }
shape compute_shape(const std::vector<shape>&) const { MIGRAPH_THROW("builtin"); }
argument compute(context&, const shape&, const std::vector<argument>&) const { MIGRAPH_THROW("builtin"); }
argument compute(context&, const shape&, const std::vector<argument>&) const
{
MIGRAPH_THROW("builtin");
}
};
struct outline
......@@ -21,7 +24,10 @@ struct outline
shape s;
std::string name() const { return "@outline"; }
shape compute_shape(const std::vector<shape>&) const { return s; }
argument compute(context&, const shape&, const std::vector<argument>&) const { MIGRAPH_THROW("builtin"); }
argument compute(context&, const shape&, const std::vector<argument>&) const
{
MIGRAPH_THROW("builtin");
}
};
struct param
......@@ -29,7 +35,10 @@ struct param
std::string parameter;
std::string name() const { return "@param"; }
shape compute_shape(const std::vector<shape>&) const { MIGRAPH_THROW("builtin"); }
argument compute(context&, const shape&, const std::vector<argument>&) const { MIGRAPH_THROW("builtin"); }
argument compute(context&, const shape&, const std::vector<argument>&) const
{
MIGRAPH_THROW("builtin");
}
friend std::ostream& operator<<(std::ostream& os, const param& op)
{
os << op.name() << ":" << op.parameter;
......
......@@ -543,7 +543,10 @@ struct outline
check_shapes{inputs, *this}.has(0);
return s;
}
argument compute(context&, const shape&, const std::vector<argument>&) const { return {s, nullptr}; }
argument compute(context&, const shape&, const std::vector<argument>&) const
{
return {s, nullptr};
}
};
} // namespace migraph
......
......@@ -49,8 +49,9 @@ struct program
{
return replace_instruction(ins, op, {args...});
}
instruction_ref
replace_instruction(instruction_ref ins, const operation& op, std::vector<instruction_ref> args);
instruction_ref replace_instruction(instruction_ref ins,
const operation& op,
std::vector<instruction_ref> args);
instruction_ref replace_instruction(instruction_ref ins, instruction_ref rep);
......
......@@ -20,7 +20,8 @@ auto reverse_int(unsigned int i)
(static_cast<unsigned int>(c3) << 8u) + c4;
};
std::vector<float> read_mnist_images(const std::string& full_path, int& number_of_images, int& image_size)
std::vector<float>
read_mnist_images(const std::string& full_path, int& number_of_images, int& image_size)
{
using uchar = unsigned char;
......
......@@ -129,8 +129,9 @@ struct onnx_parser
return prog.add_instruction(op, args);
}
instruction_ref
parse_pooling(const std::string& name, attribute_map attributes, std::vector<instruction_ref> args)
instruction_ref parse_pooling(const std::string& name,
attribute_map attributes,
std::vector<instruction_ref> args)
{
pooling op{name == "MaxPool" ? "max" : "average"};
if(contains(attributes, "pads"))
......@@ -176,8 +177,9 @@ struct onnx_parser
return prog.add_instruction(flatten{axis}, args[0]);
}
instruction_ref
parse_constant(const std::string&, attribute_map attributes, const std::vector<instruction_ref>&)
instruction_ref parse_constant(const std::string&,
attribute_map attributes,
const std::vector<instruction_ref>&)
{
literal v = parse_value(attributes.at("value"));
return prog.add_literal(v);
......
......@@ -81,8 +81,9 @@ instruction_ref program::add_instruction(const operation& op, std::vector<instru
{
return insert_instruction(impl->instructions.end(), op, std::move(args));
}
instruction_ref
program::insert_instruction(instruction_ref ins, const operation& op, std::vector<instruction_ref> args)
instruction_ref program::insert_instruction(instruction_ref ins,
const operation& op,
std::vector<instruction_ref> args)
{
assert(std::all_of(
args.begin(), args.end(), [&](instruction_ref x) { return has_instruction(x); }) &&
......@@ -97,8 +98,9 @@ program::insert_instruction(instruction_ref ins, const operation& op, std::vecto
return result;
}
instruction_ref
program::replace_instruction(instruction_ref ins, const operation& op, std::vector<instruction_ref> args)
instruction_ref program::replace_instruction(instruction_ref ins,
const operation& op,
std::vector<instruction_ref> args)
{
assert(std::all_of(
args.begin(), args.end(), [&](instruction_ref x) { return has_instruction(x); }) &&
......@@ -318,7 +320,8 @@ argument generic_eval(const program& p,
argument program::eval(std::unordered_map<std::string, argument> params) const
{
return generic_eval(*this, this->impl->ctx, std::move(params), [](auto&, auto f) { return f(); });
return generic_eval(
*this, this->impl->ctx, std::move(params), [](auto&, auto f) { return f(); });
}
double common_average(const std::vector<double>& v)
......
......@@ -30,7 +30,8 @@ struct miopen_batch_norm_inference
{inputs.at(0), inputs.at(1), inputs.at(2), inputs.at(3), inputs.at(4)});
}
argument compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const
argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const
{
auto x_desc = make_tensor(args[0].get_shape());
auto y_desc = make_tensor(output_shape);
......@@ -69,7 +70,8 @@ struct miopen_convolution
check_shapes{inputs, *this}.has(4).standard();
return op.compute_shape({inputs.at(0), inputs.at(1)});
}
argument compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const
argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const
{
auto x_desc = make_tensor(args[0].get_shape());
auto w_desc = make_tensor(args[1].get_shape());
......@@ -142,7 +144,8 @@ struct miopen_pooling
check_shapes{inputs, *this}.has(2).standard();
return op.compute_shape({inputs.at(0)});
}
argument compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const
argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const
{
auto x_desc = make_tensor(args[0].get_shape());
auto y_desc = make_tensor(output_shape);
......@@ -174,7 +177,8 @@ struct miopen_add
return inputs.at(0);
}
argument compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const
argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const
{
if(args[1].get_shape().broadcasted())
{
......@@ -220,7 +224,8 @@ struct miopen_gemm
check_shapes{inputs, *this}.has(3);
return op.compute_shape({inputs.at(0), inputs.at(1)});
}
argument compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const
argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const
{
float alpha = 1.0f;
float beta = 0.0f;
......@@ -276,7 +281,8 @@ struct miopen_relu
return inputs.at(1);
}
argument compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const
argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const
{
float alpha = 1, beta = 0;
auto x_desc = make_tensor(args[0].get_shape());
......
......@@ -56,7 +56,8 @@ auto operator<<(std::ostream& os, const T& x) -> decltype(os << x.name())
} // namespace operation_stream
template <class T>
argument compute_op(const T& x, context& ctx, const shape& output_shape, const std::vector<argument>& input)
argument
compute_op(const T& x, context& ctx, const shape& output_shape, const std::vector<argument>& input)
{
return x.compute(auto_any_cast(ctx), output_shape, input);
}
......
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