Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
renames
Browse files Browse the repository at this point in the history
  • Loading branch information
raggledodo committed Jan 29, 2019
1 parent 50a8ed6 commit 2aca005
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 57 deletions.
2 changes: 1 addition & 1 deletion llo/opt/derive.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "llo/opt/plugin_opt.hpp"
#include "llo/opt/multi_opt.hpp"

#include "llo/generated/grader.hpp"

Expand Down
26 changes: 26 additions & 0 deletions llo/opt/multi_opt.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "opt/graph_edit.hpp"

#include "llo/opt/const_merge.hpp"
#include "llo/opt/ops_merge.hpp"
#include "llo/opt/one_prune.hpp"
#include "llo/opt/zero_prune.hpp"

#include "llo/variable.hpp"

#ifndef LLO_MULTI_OPT_HPP
#define LLO_MULTI_OPT_HPP

namespace llo
{

ade::TensptrT multi_optimize (ade::TensptrT root,
std::vector<opt::EditFuncT> edits = {
const_merge_edit,
zero_prune_edit,
one_prune_edit,
ops_merge_edit,
});

}

#endif // LLO_MULTI_OPT_HPP
13 changes: 0 additions & 13 deletions llo/opt/plugin_opt.hpp

This file was deleted.

4 changes: 3 additions & 1 deletion llo/python/llo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

#include "ade/ade.hpp"

#include "llo/opt/derive.hpp"

#include "llo/constant.hpp"
#include "llo/variable.hpp"
#include "llo/eval.hpp"
#include "llo/opt/derive.hpp"

namespace py = pybind11;

Expand Down
2 changes: 1 addition & 1 deletion llo/src/derive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ade::TensptrT derive (ade::TensptrT root, ade::iTensor* target)
root->accept(grader);
auto it = grader.derivatives_.find(root.get());
assert(grader.derivatives_.end() != it);
return plugin_optimize(it->second);
return multi_optimize(it->second);
}

}
Expand Down
26 changes: 26 additions & 0 deletions llo/src/multi_opt.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "llo/opt/multi_opt.hpp"

#ifdef LLO_MULTI_OPT_HPP

namespace llo
{

ade::TensptrT multi_optimize (ade::TensptrT root,
std::vector<opt::EditFuncT> edits)
{
return opt::graph_edit(root,
[&edits](ade::Opcode opcode, ade::ArgsT args)
{
ade::TensptrT out;
for (auto it = edits.begin(), et = edits.end();
it != et && nullptr == out; ++it)
{
out = (*it)(opcode, args);
}
return out;
});
}

}

#endif
40 changes: 0 additions & 40 deletions llo/src/plugin_opt.cpp

This file was deleted.

3 changes: 2 additions & 1 deletion llo/test/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@

#define EXPECT_FATAL(EVENT, MSG) try { EVENT; FAIL() << \
"did not expect " << #EVENT << " to succeed"; } \
catch (std::runtime_error& e) { EXPECT_STREQ(MSG, e.what()); }
catch (std::runtime_error& e) { EXPECT_STREQ(MSG, e.what()); }\
catch (std::exception& e) { FAIL() << "unexpected throw " << e.what(); }

0 comments on commit 2aca005

Please sign in to comment.