clDNN
data.hpp
1 /*
2 // Copyright (c) 2016 Intel Corporation
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 
18 #pragma once
19 #include "../C/data.h"
20 #include "primitive.hpp"
21 #include "memory.hpp"
22 
23 namespace cldnn
24 {
31 
36 struct data : public primitive_base<data, CLDNN_PRIMITIVE_DESC(data)>
37 {
38  CLDNN_DECLATE_PRIMITIVE(data)
39 
40 
41  data(const primitive_id& id, const memory& mem)
45  :primitive_base(id, {}, padding())
46  , mem(mem)
47  {}
48 
50  explicit data(const dto* dto)
52  , mem(dto->mem)
53  {
54  mem.retain();
55  }
56 
60 
61 protected:
62  void update_dto(dto& dto) const override
63  {
64  dto.mem = mem.get();
65  }
66 };
70 }
cldnn_memory get() const
C API memory handle.
Definition: memory.hpp:139
Represents data padding information.
Definition: layout.hpp:125
Provides input data to topology.
Definition: data.hpp:36
cldnn_memory mem
Memory object which contains data.
Definition: data.h:41
memory mem
memory object which contains data.
Definition: data.hpp:59
data(const dto *dto)
Constructs a copy from C API cldnn_data_desc.
Definition: data.hpp:50
std::string primitive_id
Unique id of a primitive within a topology.
Definition: primitive.hpp:42
Provides input data to topology.
Definition: data.h:37
Represents buffer with particular layout.
Definition: memory.hpp:42
base class for all primitives implementations.
Definition: primitive.hpp:190
data(const primitive_id &id, const memory &mem)
Constructs data primitive.
Definition: data.hpp:44