49bool same(
float a,
float b) {
return fabs(a - b) < 1e-5; }
60#define CHECK_OR_FALSE(condition) \
69 _ifm = loco::must_cast<luci::CircleNode *>(_sqrt->x());
74 switch (_div->dtype())
76 case loco::DataType::S16:
83 _div_const->quantparam()->scale.at(0)));
104 FuseRsqrt(
const RsqrtPattern *p) : _p(p) {}
113 const RsqrtPattern *_p =
nullptr;
122 rsqrt->name(_p->_div->name() +
"_rsqrt");
129void FuseRsqrt::apply()
131 auto graph = _p->_div->graph();
133 auto rsqrt = create_rsqrt(graph);
136 std::vector<std::shared_ptr<luci::CircleNodeOrigin>> origin_vec{
137 luci::get_origin(_p->_sqrt), luci::get_origin(_p->_div), luci::get_origin(_p->_div_const)};
153 RsqrtPattern pattern(div);
154 if (pattern.matched())
156 FuseRsqrt fuse(&pattern);
171 bool changed =
false;
void with(Node *into) const
Class to build tensor data.
loco::Node * x(void) const
#define CHECK_OR_FALSE(condition)
ShapeInferenceSession apply(ShapeInferenceRule *r)
std::set< loco::Node * > active_nodes(const std::vector< loco::Node * > &roots)
Enumerate all the nodes required to compute "roots".
std::vector< Node * > output_nodes(Graph *)
Subst< SubstQualifier::Default > replace(Node *node)
void copy_quantparam(const luci::CircleNode *src, luci::CircleNode *dst)
copy CircleQuantParam of src to dst
std::shared_ptr< CircleNodeOrigin > composite_origin(const std::initializer_list< std::shared_ptr< CircleNodeOrigin > > origins)
NodeFiller< ARG_TYPE_1, ARG_TYPE_2 > fill(ARG_TYPE_1 **arg_1, ARG_TYPE_2 **arg_2)
bool run(loco::Graph *g) final
Run the pass.