21 #include "ngraph/node.hpp"
22 #include "ngraph/runtime/tensor.hpp"
23 #include "ngraph/type/element_type.hpp"
24 #include "ngraph/type/element_type_traits.hpp"
43 const std::string& name =
"");
46 const std::string& name =
"");
49 const std::string& name =
"");
52 explicit HostTensor(
const std::shared_ptr<op::v0::Constant>& constant);
55 void initialize(
const std::shared_ptr<op::v0::Constant>& constant);
58 const void* get_data_ptr()
const;
63 return static_cast<T*
>(get_data_ptr());
67 const T* get_data_ptr()
const
69 return static_cast<T*
>(get_data_ptr());
72 template <element::Type_t ET>
75 NGRAPH_CHECK(ET == get_element_type(),
76 "get_data_ptr() called for incorrect element type.");
80 template <element::Type_t ET>
83 NGRAPH_CHECK(ET == get_element_type(),
84 "get_data_ptr() called for incorrect element type.");
91 void write(
const void* p,
size_t n)
override;
96 void read(
void* p,
size_t n)
const override;
98 bool get_is_allocated()
const;
113 const HostTensorPtr& arg0,
114 const HostTensorPtr& arg1);
121 const HostTensorPtr& arg0,
122 const HostTensorPtr& arg1,
126 void allocate_buffer();
131 void* m_memory_pointer{
nullptr};
132 void* m_allocated_buffer_pool{
nullptr};
133 void* m_aligned_buffer_pool{
nullptr};
134 size_t m_buffer_size;
A handle for one of a node's outputs.
Definition: node_output.hpp:42
Class representing a shape that may be partially or totally dynamic.
Definition: partial_shape.hpp:46
Shape for a tensor.
Definition: shape.hpp:31
Definition: element_type.hpp:61
Definition: host_tensor.hpp:38
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:32
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
Definition: element_type_traits.hpp:25
Implicit broadcast specification.
Definition: attr_types.hpp:323