Skip to content

Commit

Permalink
fix: 修正一些积累的问题
Browse files Browse the repository at this point in the history
Signed-off-by: YdrMaster <ydrml@hotmail.com>
  • Loading branch information
YdrMaster committed Dec 1, 2023
1 parent 3dbd464 commit 0f5d274
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/01graph_topo/include/graph_topo/linked_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ namespace refactor::graph_topo {
TN const &info() const;
std::vector<Rc<Edge>> const &inputs() const;
std::vector<Rc<Edge>> const &outputs() const;
std::unordered_set<Rc<Node>> const &predecessors() const;
std::unordered_set<Rc<Node>> const &successors() const;
std::unordered_set<Rc<Node>> predecessors() const;
std::unordered_set<Rc<Node>> successors() const;
void connect(count_t, Rc<Edge>);
void disconnect(count_t);
void reconnect(Rc<Edge>, Rc<Edge>);
Expand Down Expand Up @@ -253,7 +253,7 @@ namespace refactor::graph_topo {
return _outputs;
}

LINKED_GRAPH_FN Node::predecessors() const->std::unordered_set<Rc<Node>> const & {
LINKED_GRAPH_FN Node::predecessors() const->std::unordered_set<Rc<Node>> {
std::unordered_set<Rc<Node>> ans;
for (auto const &e : _inputs) {
if (e->_source) {
Expand All @@ -263,7 +263,7 @@ namespace refactor::graph_topo {
return ans;
}

LINKED_GRAPH_FN Node::successors() const->std::unordered_set<Rc<Node>> const & {
LINKED_GRAPH_FN Node::successors() const->std::unordered_set<Rc<Node>> {
std::unordered_set<Rc<Node>> ans;
for (auto const &e : _outputs) {
for (auto const &[n, _] : e->_targets) {
Expand Down
10 changes: 7 additions & 3 deletions src/07onnx/src/operators/clip.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "clip.hh"
#include "common.h"
#include "computation/operators/clip.h"
#include "computation/operators/identity.h"

namespace refactor::onnx {
using Op = Clip;
Expand Down Expand Up @@ -33,9 +34,12 @@ namespace refactor::onnx {
return Ok(Tensors{Tensor::share(input.dataType, input.shape, extractDependency(inputs))});
}

auto Op::lower(TensorRefs) const -> computation::OpBox {
using Op_ = computation::Clip;
return std::make_unique<Op_>();
auto Op::lower(TensorRefs inputs) const -> computation::OpBox {
if (inputs.size() > 1) {
return std::make_unique<computation::Clip>();
} else {
return std::make_unique<computation::Identity>();
}
}

}// namespace refactor::onnx

0 comments on commit 0f5d274

Please sign in to comment.