ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Overlay.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 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 __NNCC_CORE_ADT_FEATURE_OVERLAY_H__
18#define __NNCC_CORE_ADT_FEATURE_OVERLAY_H__
19
21
22#include <vector>
23
24namespace nncc
25{
26namespace core
27{
28namespace ADT
29{
30namespace feature
31{
32
33template <typename T> class Overlay final : public View<T>
34{
35public:
36 explicit Overlay(const Shape &shape, const Layout &layout, T *base)
37 : View<T>{shape, layout}, _base{base}
38 {
39 // DO NOTHING
40 }
41
42public:
43 virtual T *base(void) { return _base; }
44 virtual const T *base(void) const { return _base; }
45
46private:
47 T *const _base;
48};
49
50template <typename T, typename LayoutImpl> Overlay<T> make_overlay(const Shape &shape, T *base)
51{
52 return Overlay<T>{shape, LayoutImpl{}, base};
53}
54
55} // namespace feature
56} // namespace ADT
57} // namespace core
58} // namespace nncc
59
60#endif // __NNCC_CORE_ADT_FEATURE_OVERLAY_H__
virtual const T * base(void) const
Definition Overlay.h:44
Overlay(const Shape &shape, const Layout &layout, T *base)
Definition Overlay.h:36
const Shape & shape(void) const
Definition View.h:59
Overlay< T > make_overlay(const Shape &shape, T *base)
Definition Overlay.h:50