ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Verifier.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_IR_VERIFIER_H__
18#define __LOCO_IR_VERIFIER_H__
19
20#include "loco/IR/Graph.h"
21
22#include <memory>
23
24namespace loco
25{
26
34enum class ErrorCategory
35{
37 /* TO BE ADDED */
38};
39
43template <ErrorCategory Code> class ErrorDetail;
44
49{
50public:
51 ErrorDetail(loco::Node *node, uint32_t index) : _node{node}, _index{index}
52 {
53 // DO NOTHING
54 }
55
56public:
58 loco::Node *node(void) const { return _node; }
60 uint32_t index(void) const { return _index; }
61
62private:
63 loco::Node *_node;
64 uint32_t _index;
65};
66
73{
74 virtual ~IErrorListener() = default;
75
77};
78
83{
84 virtual ~ErrorListener() = default;
85
86 void notify(const ErrorDetail<ErrorCategory::MissingArgument> &) override { return; }
87};
88
96bool valid(Graph *g, std::unique_ptr<ErrorListener> &&l = nullptr);
97
98} // namespace loco
99
100#endif // __LOCO_IR_VERIFIER_H__
ErrorDetail(loco::Node *node, uint32_t index)
Definition Verifier.h:51
loco::Node * node(void) const
The node with missing arguments.
Definition Verifier.h:58
uint32_t index(void) const
The missing argument index.
Definition Verifier.h:60
The details of each error.
Definition Verifier.h:43
Logical unit of computation.
Definition Node.h:54
ErrorCategory
Possible error categories.
Definition Verifier.h:35
bool valid(Graph *g, std::unique_ptr< ErrorListener > &&l=nullptr)
Validate a loco graph.
Definition Verifier.cpp:100
Error listener (with default implementation)
Definition Verifier.h:83
virtual ~ErrorListener()=default
void notify(const ErrorDetail< ErrorCategory::MissingArgument > &) override
Definition Verifier.h:86
Error listener interface.
Definition Verifier.h:73
virtual ~IErrorListener()=default
virtual void notify(const ErrorDetail< ErrorCategory::MissingArgument > &)=0