Commit a2f3bd24 authored by Paul's avatar Paul
Browse files

Formatting

parent e59e3058
...@@ -46,10 +46,7 @@ struct onnx_parser ...@@ -46,10 +46,7 @@ struct onnx_parser
std::unordered_map<std::string, rtg::instruction*> instructions; std::unordered_map<std::string, rtg::instruction*> instructions;
rtg::program prog = rtg::program(); rtg::program prog = rtg::program();
std::unordered_map< std::unordered_map<std::string, op_func> ops;
std::string,
op_func>
ops;
onnx_parser() onnx_parser()
{ {
......
...@@ -12,19 +12,17 @@ struct program_impl ...@@ -12,19 +12,17 @@ struct program_impl
std::list<instruction> instructions; std::list<instruction> instructions;
}; };
program::program() program::program() : impl(std::make_unique<program_impl>()) {}
: impl(std::make_unique<program_impl>())
{}
program::program(program&&) noexcept = default; program::program(program&&) noexcept = default;
program& program::operator=(program&&) = default; program& program::operator=(program&&) = default;
program::~program() = default; program::~program() = default;
instruction* program::add_instruction(operation op, std::vector<instruction*> args) instruction* program::add_instruction(operation op, std::vector<instruction*> args)
{ {
assert(std::all_of( assert(
args.begin(), args.end(), [&](instruction* x) { return has_instruction(x); }) && std::all_of(args.begin(), args.end(), [&](instruction* x) { return has_instruction(x); }) &&
"Argument is not an exisiting instruction"); "Argument is not an exisiting instruction");
std::vector<shape> shapes(args.size()); std::vector<shape> shapes(args.size());
std::transform( std::transform(
args.begin(), args.end(), shapes.begin(), [](instruction* ins) { return ins->result; }); args.begin(), args.end(), shapes.begin(), [](instruction* ins) { return ins->result; });
...@@ -48,9 +46,10 @@ instruction* program::add_parameter(std::string name, shape s) ...@@ -48,9 +46,10 @@ instruction* program::add_parameter(std::string name, shape s)
bool program::has_instruction(const instruction* ins) const bool program::has_instruction(const instruction* ins) const
{ {
return std::find_if(impl->instructions.begin(), impl->instructions.end(), [&](const instruction& x) { return std::find_if(impl->instructions.begin(),
return ins == std::addressof(x); impl->instructions.end(),
}) != impl->instructions.end(); [&](const instruction& x) { return ins == std::addressof(x); }) !=
impl->instructions.end();
} }
literal program::eval(std::unordered_map<std::string, argument> params) const literal program::eval(std::unordered_map<std::string, argument> params) const
......
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