20 #include "cldnn_defs.h" 21 #include "compounds.h" 22 #include "primitive.hpp" 41 template<
class ...Args>
45 add<Args...>(args...);
57 if (_impl == other._impl)
return *
this;
70 friend bool operator==(
const topology& lhs,
const topology& rhs) {
return lhs._impl == rhs._impl; }
71 friend bool operator!=(
const topology& lhs,
const topology& rhs) {
return !(lhs == rhs); }
75 void add(PType
const& desc)
77 check_status<void>(
"primitive add failed", [&](status_t* status) {
cldnn_add_primitive(_impl, desc.get_dto(), status); });
81 template<
class PType,
class ...Args>
82 void add(PType
const& desc, Args
const&... args)
84 check_status<void>(
"primitive add failed", [&](status_t* status) {
cldnn_add_primitive(_impl, desc.get_dto(), status); });
85 add<Args...>(args...);
91 const std::vector<primitive_id> get_primitive_ids()
const 94 status_t err_invalid_arg = CLDNN_SUCCESS;
96 assert(err_invalid_arg == CLDNN_INVALID_ARG);
98 std::vector<char> names_buf(size_ret);
100 check_status<void>(
"get topology ids failed", [&](status_t* status)
104 assert(names_buf.size() == size_ret);
106 std::vector<primitive_id> result;
107 for (
auto buf_ptr = names_buf.data(); *buf_ptr != 0; buf_ptr += result.back().size() + 1)
109 result.emplace_back(buf_ptr);
115 friend struct engine;
116 friend struct network;
121 if (_impl ==
nullptr)
throw std::invalid_argument(
"implementation pointer should not be null");
126 check_status<void>(
"retain topology failed", [=](status_t* status) {
cldnn_retain_topology(_impl, status); });
130 check_status<void>(
"retain topology failed", [=](status_t* status) {
cldnn_release_topology(_impl, status); });
134 CLDNN_API_CLASS(topology)
~topology()
Releases wrapped C API cldnn_topology.
void add(PType const &desc, Args const &... args)
Adds primitives to topology.
CLDNN_API void cldnn_retain_topology(cldnn_topology topology, cldnn_status *status)
Increment reference counter for the topology object.
CLDNN_API void cldnn_add_primitive(cldnn_topology topology, const struct cldnn_primitive_desc *dto, cldnn_status *status)
Add new primitive to the topology.
CLDNN_API void cldnn_release_topology(cldnn_topology topology, cldnn_status *status)
Decrement reference counter for the topology object. Deletes object when counter becomes zero...
struct cldnn_topology_impl * cldnn_topology
Network topology to be defined by user.
Network topology to be defined by user.
topology & operator=(const topology &other)
Copy assignment.
void add(PType const &desc)
Adds a primitive to topology.
CLDNN_API cldnn_topology cldnn_create_topology(cldnn_status *status)
Create empty network topology.
topology(const topology &other)
Copy construction.
topology(const Args &... args)
Constructs topology containing primitives provided in argument(s).
CLDNN_API void cldnn_get_primitive_ids(cldnn_topology topology, char *ids, size_t size, size_t *size_ret, cldnn_status *status)
Return all primitives id from topology.
topology()
Constructs empty network topology.