ONE - On-device Neural Engine
Loading...
Searching...
No Matches
ShapeInference.h
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#ifndef __LOCO_SERVICE_SHAPE_INFERENCE_H__
18#define __LOCO_SERVICE_SHAPE_INFERENCE_H__
19
21#include "loco/IR/Graph.h"
22
33namespace loco
34{
35
37{
38public:
39 ShapeInferenceSession(const ShapeInferenceRule *rule) : _rule{rule}
40 {
41 // DO NOTHING
42 }
43
44public:
45 bool to(Graph *g) const;
46
47private:
48 const ShapeInferenceRule *_rule;
49};
50
52
54{
55 static bool known(const Node *);
56 static NodeShape get(const Node *);
57 static void erase(Node *);
58};
59
60inline bool shape_known(const Node *node) { return ShapeInference::known(node); }
61inline NodeShape shape_get(const Node *node) { return ShapeInference::get(node); }
62inline void shape_erase(Node *node) { ShapeInference::erase(node); }
63
64} // namespace loco
65
66#endif // __LOCO_SERVICE_SHAPE_INFERENCE_H__
A neural network graph.
Definition Graph.h:161
Logical unit of computation.
Definition Node.h:54
ShapeInferenceSession(const ShapeInferenceRule *rule)
void shape_erase(Node *node)
ShapeInferenceSession apply(ShapeInferenceRule *r)
bool shape_known(const Node *node)
NodeShape shape_get(const Node *node)
static NodeShape get(const Node *)
static void erase(Node *)
static bool known(const Node *)