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_TENSOR_OVERLAY_H__
18#define __NNCC_CORE_ADT_TENSOR_OVERLAY_H__
19
21
22namespace nncc
23{
24namespace core
25{
26namespace ADT
27{
28namespace tensor
29{
30
31template <typename T> class Overlay final : public View<T>
32{
33public:
34 explicit Overlay(const Shape &shape, const Layout &layout, T *base)
35 : View<T>{shape, layout}, _base{base}
36 {
37 // DO NOTHING
38 }
39
40public:
41 T *base(void) override { return _base; }
42 const T *base(void) const override { return _base; }
43
44private:
45 T *const _base;
46};
47
48template <typename T, typename LayoutImpl> Overlay<T> make_overlay(const Shape &shape, T *base)
49{
50 return Overlay<T>{shape, LayoutImpl{}, base};
51}
52
53} // namespace tensor
54} // namespace ADT
55} // namespace core
56} // namespace nncc
57
58#endif // __NNCC_CORE_ADT_TENSOR_OVERLAY_H__
const T * base(void) const override
Definition Overlay.h:42
T * base(void) override
Definition Overlay.h:41
Overlay(const Shape &shape, const Layout &layout, T *base)
Definition Overlay.h:34
const Shape & shape(void) const
Definition View.h:58
Overlay< T > make_overlay(const Shape &shape, T *base)
Definition Overlay.h:48