9 #include "ngraph/node.hpp"
10 #include "ngraph/runtime/tensor.hpp"
11 #include "ngraph/type/element_type.hpp"
12 #include "ngraph/type/element_type_traits.hpp"
31 const std::string& name =
"");
34 const std::string& name =
"");
37 const std::string& name =
"");
40 explicit HostTensor(
const std::shared_ptr<op::v0::Constant>& constant);
43 void initialize(
const std::shared_ptr<op::v0::Constant>& constant);
46 const void* get_data_ptr()
const;
51 return static_cast<T*
>(get_data_ptr());
55 const T* get_data_ptr()
const
57 return static_cast<T*
>(get_data_ptr());
60 template <element::Type_t ET>
63 NGRAPH_CHECK(ET == get_element_type(),
64 "get_data_ptr() called for incorrect element type.");
68 template <element::Type_t ET>
71 NGRAPH_CHECK(ET == get_element_type(),
72 "get_data_ptr() called for incorrect element type.");
79 void write(
const void* p,
size_t n)
override;
84 void read(
void* p,
size_t n)
const override;
86 bool get_is_allocated()
const;
101 const HostTensorPtr& arg0,
102 const HostTensorPtr& arg1);
109 const HostTensorPtr& arg0,
110 const HostTensorPtr& arg1,
114 void allocate_buffer();
119 void* m_memory_pointer{
nullptr};
120 void* m_allocated_buffer_pool{
nullptr};
121 void* m_aligned_buffer_pool{
nullptr};
122 size_t m_buffer_size;
A handle for one of a node's outputs.
Definition: node_output.hpp:33
Class representing a shape that may be partially or totally dynamic.
Definition: partial_shape.hpp:34
Shape for a tensor.
Definition: shape.hpp:19
Definition: element_type.hpp:51
Definition: host_tensor.hpp:26
void set_shape(const Shape &shape)
Set the actual shape of the tensor compatibly with the partial shape.
void write(const void *p, size_t n) override
Write bytes directly into the tensor.
void read(void *p, size_t n) const override
Read bytes directly from the tensor.
void set_element_type(const element::Type &element_type)
Set the element type. Must be compatible with the current element type.
void set_unary(const HostTensorPtr &arg)
Set the shape of a node from an input.
void set_broadcast(const op::AutoBroadcastSpec &autob, const HostTensorPtr &arg0, const HostTensorPtr &arg1)
Set the shape of the tensor using broadcast rules.
void set_broadcast(const op::AutoBroadcastSpec &autob, const HostTensorPtr &arg0, const HostTensorPtr &arg1, const element::Type &element_type)
Set the shape of the tensor using broadcast rules.
Definition: tensor.hpp:20
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16
Definition: element_type_traits.hpp:13
Implicit broadcast specification.
Definition: attr_types.hpp:311