Skip to content

Commit

Permalink
need to implement the query_keys and query_values in query_set.h
Browse files Browse the repository at this point in the history
  • Loading branch information
lambda7xx committed Jul 15, 2023
1 parent 6691b9e commit fe7d467
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
12 changes: 6 additions & 6 deletions lib/utils/include/utils/graph/query_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ namespace FlexFlow {
template <typename T>
struct query_set {
query_set() = delete;
query_set(T const &) {
NOT_IMPLEMENTED();
query_set(T const & query) : query({query}) {
std::cout<<"1"<<std::endl;
}
query_set(std::unordered_set<T> const &query) : query(query) {}

query_set(optional<std::unordered_set<T>> const &) {
NOT_IMPLEMENTED();
}
query_set(optional<std::unordered_set<T>> const & query): query(query) {}

friend bool operator==(query_set const &lhs, query_set const &rhs) {
return lhs.value == rhs.value;
Expand Down Expand Up @@ -72,13 +70,15 @@ template <typename C,
typename K = typename C::key_type,
typename V = typename C::mapped_type>
std::unordered_map<K, V> query_keys(query_set<K> const &q, C const &m) {
std::cout<<"3"<<std::endl;
NOT_IMPLEMENTED();
}
}//TODO

template <typename C,
typename K = typename C::key_type,
typename V = typename C::mapped_type>
std::unordered_map<K, V> query_values(query_set<V> const &q, C const &m) {
std::cout<<"4"<<std::endl;
NOT_IMPLEMENTED();
}

Expand Down
24 changes: 12 additions & 12 deletions lib/utils/src/graph/multidigraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ MultiDiOutput get_output(MultiDiEdge const &e) {
MultiDiEdgeQuery
MultiDiEdgeQuery::with_src_nodes(query_set<Node> const &nodes) const {
MultiDiEdgeQuery e = *this;
if (is_matchall(e.srcs)) {
throw mk_runtime_error("Expected matchall previous value");
}
// if (is_matchall(e.srcs)) {
// throw mk_runtime_error("Expected matchall previous value");
// }
e.srcs = nodes;
return e;
}
Expand All @@ -32,9 +32,9 @@ MultiDiEdgeQuery MultiDiEdgeQuery::with_src_node(Node const &n) const {
MultiDiEdgeQuery
MultiDiEdgeQuery::with_dst_nodes(query_set<Node> const &nodes) const {
MultiDiEdgeQuery e = *this;
if (is_matchall(e.dsts)) {
throw mk_runtime_error("Expected matchall previous value");
}
// if (is_matchall(e.dsts)) {
// throw mk_runtime_error("Expected matchall previous value");
// }
e.dsts = nodes;
return e;
}
Expand Down Expand Up @@ -76,19 +76,19 @@ MultiDiEdgeQuery MultiDiEdgeQuery::with_dst_idx(NodePort const &p) const {
MultiDiEdgeQuery
MultiDiEdgeQuery::with_src_idxs(query_set<NodePort> const &idxs) const {
MultiDiEdgeQuery e{*this};
if (is_matchall(e.srcIdxs)) {
throw mk_runtime_error("Expected matchall previous value");
}
// if (is_matchall(e.srcIdxs)) {
// throw mk_runtime_error("Expected matchall previous value");
// }
e.srcIdxs = idxs;
return e;
}

MultiDiEdgeQuery
MultiDiEdgeQuery::with_dst_idxs(query_set<NodePort> const &idxs) const {
MultiDiEdgeQuery e = *this;
if (is_matchall(e.dstIdxs)) {
throw mk_runtime_error("Expected matchall previous value");
}
// if (is_matchall(e.dstIdxs)) {
// throw mk_runtime_error("Expected matchall previous value");
// }
e.dstIdxs = idxs;
return e;
}
Expand Down
1 change: 1 addition & 0 deletions lib/utils/src/graph/views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ std::unordered_set<MultiDiEdge> ViewOpenMultiDiGraphAsMultiDiGraph::query_edges(
// }

// return result;
std::cout<<"5"<<std::endl;
NOT_IMPLEMENTED();
}

Expand Down

0 comments on commit fe7d467

Please sign in to comment.