ONE - On-device Neural Engine
Loading...
Searching...
No Matches
ShapeInferencePass.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17#include "ShapeInferencePass.h"
18
19#include <moco/IR/TFDialect.h>
20
22
23#include <loco.h>
24
26
31
32#include <locoex/COpDialect.h>
34
35namespace moco
36{
37namespace tf
38{
39
41{
44 locoex::COpShapeInferenceRule cop_rule; // rule for custop op
45
47
48 rules.bind(loco::CanonicalDialect::get(), &canonical_rule)
49 .bind(TFDialect::get(), &tf_rule)
50 .bind(locoex::COpDialect::get(), &cop_rule);
51
52 return loco::apply(&rules).to(graph);
53}
54
55} // namespace tf
56} // namespace moco
static Dialect * get(void)
A neural network graph.
Definition Graph.h:161
Shape inference rule for multiple dialects.
MultiDialectShapeInferenceRule & bind(const Dialect *d, const ShapeInferenceRule *rule)
Bind a specific rule to a Dialect.
static loco::Dialect * get(void)
static loco::Dialect * get(void)
Definition TFDialect.cpp:84
bool run(loco::Graph *graph) override
Run the pass.
ShapeInferenceSession apply(ShapeInferenceRule *r)
Definition Log.h:23
Shape inference rule for canonical dialect.
Shape inference rule for COpDialect.
Shape inference rule for TensorFlow dialect.