2 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "luci/Pass/ShapeInferencePass.h"
19 #include <luci/IR/CircleDialect.h>
20 #include <luci/Service/CircleShapeInferenceRule.h>
23 #include <loco/IR/CanonicalDialect.h>
24 #include <loco/Service/CanonicalShapeInferenceRule.h>
25 #include <loco/Service/ShapeInference.h>
26 #include <loco/Service/MultiDialectShapeInferenceRule.h>
31 bool ShapeInferencePass::run(luci::Module *m)
35 for (size_t g = 0; g < m->size(); ++g)
44 bool ShapeInferencePass::run(loco::Graph *g)
46 loco::CanonicalShapeInferenceRule canonical_rule;
47 luci::CircleShapeInferenceRule circle_rule;
49 loco::MultiDialectShapeInferenceRule rules;
51 rules.bind(loco::CanonicalDialect::get(), &canonical_rule)
52 .bind(luci::CircleDialect::get(), &circle_rule);
54 return loco::apply(&rules).to(g);