[GPU] primitive serialization (#17670)
* primitive serialization * updated primitive::desc() to use impl_param instead of program_node * added hash caching unit tests * added missed calls to save and load of parent * updated copyright year
This commit is contained in:
parent
eeb552cc93
commit
ef041565a8
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (C) 2023 Intel Corporation
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
#include "buffer.hpp"
|
||||||
|
#include "helpers.hpp"
|
||||||
|
|
||||||
|
namespace cldnn {
|
||||||
|
enum class activation_func;
|
||||||
|
|
||||||
|
template <typename BufferType>
|
||||||
|
class Serializer<BufferType, activation_func, typename std::enable_if<std::is_base_of<OutputBuffer<BufferType>, BufferType>::value>::type> {
|
||||||
|
public:
|
||||||
|
static void save(BufferType& buffer, const activation_func& activation) {
|
||||||
|
buffer << make_data(&activation, sizeof(activation_func));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename BufferType>
|
||||||
|
class Serializer<BufferType, activation_func, typename std::enable_if<std::is_base_of<InputBuffer<BufferType>, BufferType>::value>::type> {
|
||||||
|
public:
|
||||||
|
static void load(BufferType& buffer, activation_func& activation) {
|
||||||
|
buffer >> make_data(&activation, sizeof(activation_func));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace cldnn
|
@ -1,31 +0,0 @@
|
|||||||
// Copyright (C) 2023 Intel Corporation
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <type_traits>
|
|
||||||
#include "buffer.hpp"
|
|
||||||
|
|
||||||
namespace cldnn {
|
|
||||||
struct input_info;
|
|
||||||
|
|
||||||
template <typename BufferType>
|
|
||||||
class Serializer<BufferType, input_info, typename std::enable_if<std::is_base_of<OutputBuffer<BufferType>, BufferType>::value>::type> {
|
|
||||||
public:
|
|
||||||
static void save(BufferType& buffer, const input_info& input) {
|
|
||||||
buffer << input.pid;
|
|
||||||
buffer << input.idx;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename BufferType>
|
|
||||||
class Serializer<BufferType, input_info, typename std::enable_if<std::is_base_of<InputBuffer<BufferType>, BufferType>::value>::type> {
|
|
||||||
public:
|
|
||||||
static void load(BufferType& buffer, input_info& input) {
|
|
||||||
buffer >> input.pid;
|
|
||||||
buffer >> input.idx;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace cldnn
|
|
@ -1,57 +0,0 @@
|
|||||||
// Copyright (C) 2018-2023 Intel Corporation
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <type_traits>
|
|
||||||
#include "buffer.hpp"
|
|
||||||
#include "helpers.hpp"
|
|
||||||
#include "intel_gpu/primitives/loop.hpp"
|
|
||||||
|
|
||||||
namespace cldnn {
|
|
||||||
template <typename BufferType>
|
|
||||||
class Serializer<BufferType, cldnn::loop::io_primitive_map, typename std::enable_if<std::is_base_of<OutputBuffer<BufferType>, BufferType>::value>::type> {
|
|
||||||
public:
|
|
||||||
static void save(BufferType& buffer, const cldnn::loop::io_primitive_map& io_primitive_map) {
|
|
||||||
buffer << io_primitive_map.external_id;
|
|
||||||
buffer << io_primitive_map.internal_id;
|
|
||||||
buffer << io_primitive_map.axis;
|
|
||||||
buffer << io_primitive_map.start;
|
|
||||||
buffer << io_primitive_map.end;
|
|
||||||
buffer << io_primitive_map.stride;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename BufferType>
|
|
||||||
class Serializer<BufferType, cldnn::loop::io_primitive_map, typename std::enable_if<std::is_base_of<InputBuffer<BufferType>, BufferType>::value>::type> {
|
|
||||||
public:
|
|
||||||
static void load(BufferType& buffer, cldnn::loop::io_primitive_map& io_primitive_map) {
|
|
||||||
buffer >> io_primitive_map.external_id;
|
|
||||||
buffer >> io_primitive_map.internal_id;
|
|
||||||
buffer >> io_primitive_map.axis;
|
|
||||||
buffer >> io_primitive_map.start;
|
|
||||||
buffer >> io_primitive_map.end;
|
|
||||||
buffer >> io_primitive_map.stride;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename BufferType>
|
|
||||||
class Serializer<BufferType, cldnn::loop::backedge_mapping, typename std::enable_if<std::is_base_of<OutputBuffer<BufferType>, BufferType>::value>::type> {
|
|
||||||
public:
|
|
||||||
static void save(BufferType& buffer, const cldnn::loop::backedge_mapping& backedge_mapping) {
|
|
||||||
buffer << backedge_mapping.from;
|
|
||||||
buffer << backedge_mapping.to;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename BufferType>
|
|
||||||
class Serializer<BufferType, cldnn::loop::backedge_mapping, typename std::enable_if<std::is_base_of<InputBuffer<BufferType>, BufferType>::value>::type> {
|
|
||||||
public:
|
|
||||||
static void load(BufferType& buffer, cldnn::loop::backedge_mapping& backedge_mapping) {
|
|
||||||
buffer >> backedge_mapping.from;
|
|
||||||
buffer >> backedge_mapping.to;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} // namespace cldnn
|
|
@ -8,6 +8,7 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include "buffer.hpp"
|
#include "buffer.hpp"
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
|
#include "openvino/core/axis_set.hpp"
|
||||||
|
|
||||||
namespace cldnn {
|
namespace cldnn {
|
||||||
template <typename BufferType, typename T>
|
template <typename BufferType, typename T>
|
||||||
@ -35,4 +36,30 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename BufferType>
|
||||||
|
class Serializer<BufferType, ov::AxisSet, typename std::enable_if<std::is_base_of<OutputBuffer<BufferType>, BufferType>::value>::type> {
|
||||||
|
public:
|
||||||
|
static void save(BufferType& buffer, const ov::AxisSet& set) {
|
||||||
|
buffer << set.size();
|
||||||
|
for (const auto& el : set) {
|
||||||
|
buffer << el;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename BufferType>
|
||||||
|
class Serializer<BufferType, ov::AxisSet, typename std::enable_if<std::is_base_of<InputBuffer<BufferType>, BufferType>::value>::type> {
|
||||||
|
public:
|
||||||
|
static void load(BufferType& buffer, ov::AxisSet& set) {
|
||||||
|
typename ov::AxisSet::size_type set_size = 0UL;
|
||||||
|
buffer >> set_size;
|
||||||
|
|
||||||
|
for (long unsigned int i = 0; i < set_size; i++) {
|
||||||
|
size_t el;
|
||||||
|
buffer >> el;
|
||||||
|
set.insert(el);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (C) 2023 Intel Corporation
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <type_traits>
|
||||||
|
#include "buffer.hpp"
|
||||||
|
#include "helpers.hpp"
|
||||||
|
#include "intel_gpu/runtime/tensor.hpp"
|
||||||
|
|
||||||
|
namespace cldnn {
|
||||||
|
template <typename BufferType>
|
||||||
|
class Serializer<BufferType, tensor, typename std::enable_if<std::is_base_of<OutputBuffer<BufferType>, BufferType>::value>::type> {
|
||||||
|
public:
|
||||||
|
static void save(BufferType& buffer, const tensor& tensor_obj) {
|
||||||
|
buffer << tensor_obj.sizes();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename BufferType>
|
||||||
|
class Serializer<BufferType, tensor, typename std::enable_if<std::is_base_of<InputBuffer<BufferType>, BufferType>::value>::type> {
|
||||||
|
public:
|
||||||
|
static void load(BufferType& buffer, tensor& tensor_obj) {
|
||||||
|
std::vector<tensor::value_type> sizes;
|
||||||
|
buffer >> sizes;
|
||||||
|
tensor_obj = tensor(sizes);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace cldnn
|
@ -8,6 +8,9 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include "buffer.hpp"
|
#include "buffer.hpp"
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
|
#include "openvino/core/coordinate_diff.hpp"
|
||||||
|
#include "openvino/core/shape.hpp"
|
||||||
|
#include "openvino/core/strides.hpp"
|
||||||
|
|
||||||
namespace cldnn {
|
namespace cldnn {
|
||||||
template <typename BufferType, typename T>
|
template <typename BufferType, typename T>
|
||||||
@ -60,4 +63,76 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename BufferType>
|
||||||
|
class Serializer<BufferType, ov::CoordinateDiff, typename std::enable_if<std::is_base_of<OutputBuffer<BufferType>, BufferType>::value>::type> {
|
||||||
|
public:
|
||||||
|
static void save(BufferType& buffer, const ov::CoordinateDiff& vector) {
|
||||||
|
buffer << vector.size();
|
||||||
|
for (const auto& el : vector) {
|
||||||
|
buffer << el;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename BufferType>
|
||||||
|
class Serializer<BufferType, ov::CoordinateDiff, typename std::enable_if<std::is_base_of<InputBuffer<BufferType>, BufferType>::value>::type> {
|
||||||
|
public:
|
||||||
|
static void load(BufferType& buffer, ov::CoordinateDiff& vector) {
|
||||||
|
typename ov::CoordinateDiff::size_type vector_size = 0UL;
|
||||||
|
buffer >> vector_size;
|
||||||
|
vector.resize(vector_size);
|
||||||
|
for (auto& el : vector) {
|
||||||
|
buffer >> el;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename BufferType>
|
||||||
|
class Serializer<BufferType, ov::Strides, typename std::enable_if<std::is_base_of<OutputBuffer<BufferType>, BufferType>::value>::type> {
|
||||||
|
public:
|
||||||
|
static void save(BufferType& buffer, const ov::Strides& vector) {
|
||||||
|
buffer << vector.size();
|
||||||
|
for (const auto& el : vector) {
|
||||||
|
buffer << el;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename BufferType>
|
||||||
|
class Serializer<BufferType, ov::Strides, typename std::enable_if<std::is_base_of<InputBuffer<BufferType>, BufferType>::value>::type> {
|
||||||
|
public:
|
||||||
|
static void load(BufferType& buffer, ov::Strides& vector) {
|
||||||
|
typename ov::Strides::size_type vector_size = 0UL;
|
||||||
|
buffer >> vector_size;
|
||||||
|
vector.resize(vector_size);
|
||||||
|
for (auto& el : vector) {
|
||||||
|
buffer >> el;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename BufferType>
|
||||||
|
class Serializer<BufferType, ov::Shape, typename std::enable_if<std::is_base_of<OutputBuffer<BufferType>, BufferType>::value>::type> {
|
||||||
|
public:
|
||||||
|
static void save(BufferType& buffer, const ov::Shape& vector) {
|
||||||
|
buffer << vector.size();
|
||||||
|
for (const auto& el : vector) {
|
||||||
|
buffer << el;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename BufferType>
|
||||||
|
class Serializer<BufferType, ov::Shape, typename std::enable_if<std::is_base_of<InputBuffer<BufferType>, BufferType>::value>::type> {
|
||||||
|
public:
|
||||||
|
static void load(BufferType& buffer, ov::Shape& vector) {
|
||||||
|
typename ov::Shape::size_type vector_size = 0UL;
|
||||||
|
buffer >> vector_size;
|
||||||
|
vector.resize(vector_size);
|
||||||
|
for (auto& el : vector) {
|
||||||
|
buffer >> el;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "primitive.hpp"
|
#include "primitive.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "intel_gpu/graph/serialization/string_serializer.hpp"
|
#include "intel_gpu/graph/serialization/activation_serializer.hpp"
|
||||||
|
|
||||||
namespace cldnn {
|
namespace cldnn {
|
||||||
|
|
||||||
@ -62,6 +62,9 @@ enum class activation_func {
|
|||||||
/// @brief activation additional params
|
/// @brief activation additional params
|
||||||
struct activation_additional_params {
|
struct activation_additional_params {
|
||||||
float a, b;
|
float a, b;
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const { ob << a << b; }
|
||||||
|
void load(BinaryInputBuffer& ib) { ib >> a >> b; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Activation using rectified linear unit or parameterized rectified linear unit.
|
/// @brief Activation using rectified linear unit or parameterized rectified linear unit.
|
||||||
@ -144,14 +147,16 @@ struct activation : public primitive_base<activation> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void save(BinaryOutputBuffer& ob) const override {
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
ob << make_data(&activation_function, sizeof(activation_func));
|
primitive_base<activation>::save(ob);
|
||||||
ob << make_data(&additional_params, sizeof(activation_additional_params));
|
ob << activation_function;
|
||||||
|
ob << additional_params;
|
||||||
ob << additional_params_input;
|
ob << additional_params_input;
|
||||||
}
|
}
|
||||||
|
|
||||||
void load(BinaryInputBuffer& ib) override {
|
void load(BinaryInputBuffer& ib) override {
|
||||||
ib >> make_data(&activation_function, sizeof(activation_func));
|
primitive_base<activation>::load(ib);
|
||||||
ib >> make_data(&additional_params, sizeof(activation_additional_params));
|
ib >> activation_function;
|
||||||
|
ib >> additional_params;
|
||||||
ib >> additional_params_input;
|
ib >> additional_params_input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,12 @@ enum class adaptive_pooling_mode : int32_t {
|
|||||||
struct adaptive_pooling : public primitive_base<adaptive_pooling> {
|
struct adaptive_pooling : public primitive_base<adaptive_pooling> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(adaptive_pooling)
|
CLDNN_DECLARE_PRIMITIVE(adaptive_pooling)
|
||||||
|
|
||||||
|
adaptive_pooling() : primitive_base("", {}),
|
||||||
|
mode{adaptive_pooling_mode::average},
|
||||||
|
output_size{} {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs AdaptiveAvgPooling primitive.
|
/// @brief Constructs AdaptiveAvgPooling primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -69,6 +75,22 @@ struct adaptive_pooling : public primitive_base<adaptive_pooling> {
|
|||||||
index_element_type == rhs_casted.index_element_type;
|
index_element_type == rhs_casted.index_element_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<adaptive_pooling>::save(ob);
|
||||||
|
ob << make_data(&mode, sizeof(adaptive_pooling_mode));
|
||||||
|
ob << output_size;
|
||||||
|
ob << indices_output;
|
||||||
|
ob << make_data(&index_element_type, sizeof(data_types));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<adaptive_pooling>::load(ib);
|
||||||
|
ib >> make_data(&mode, sizeof(adaptive_pooling_mode));
|
||||||
|
ib >> output_size;
|
||||||
|
ib >> indices_output;
|
||||||
|
ib >> make_data(&index_element_type, sizeof(data_types));
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
|
@ -5,9 +5,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "primitive.hpp"
|
#include "primitive.hpp"
|
||||||
#include "openvino/op/util/attr_types.hpp"
|
#include "openvino/op/util/attr_types.hpp"
|
||||||
#include "intel_gpu/graph/serialization/input_info_serializer.hpp"
|
|
||||||
#include "intel_gpu/graph/serialization/string_serializer.hpp"
|
|
||||||
#include "intel_gpu/graph/serialization/vector_serializer.hpp"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -115,6 +112,7 @@ struct arg_max_min : public primitive_base<arg_max_min> {
|
|||||||
bool use_multiple_outputs() const { return input_size() != 3; }
|
bool use_multiple_outputs() const { return input_size() != 3; }
|
||||||
|
|
||||||
void save(BinaryOutputBuffer& ob) const override {
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<arg_max_min>::save(ob);
|
||||||
ob << input;
|
ob << input;
|
||||||
ob << num_outputs;
|
ob << num_outputs;
|
||||||
ob << make_data(&mode, sizeof(ov::op::TopKMode));
|
ob << make_data(&mode, sizeof(ov::op::TopKMode));
|
||||||
@ -125,6 +123,7 @@ struct arg_max_min : public primitive_base<arg_max_min> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void load(BinaryInputBuffer& ib) override {
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<arg_max_min>::load(ib);
|
||||||
ib >> input;
|
ib >> input;
|
||||||
ib >> num_outputs;
|
ib >> num_outputs;
|
||||||
ib >> make_data(&mode, sizeof(ov::op::TopKMode));
|
ib >> make_data(&mode, sizeof(ov::op::TopKMode));
|
||||||
|
@ -15,6 +15,10 @@ namespace cldnn {
|
|||||||
struct assign : public primitive_base<assign> {
|
struct assign : public primitive_base<assign> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(assign)
|
CLDNN_DECLARE_PRIMITIVE(assign)
|
||||||
|
|
||||||
|
assign() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs Assign primitive.
|
/// @brief Constructs Assign primitive.
|
||||||
/// @param id This primitive id
|
/// @param id This primitive id
|
||||||
/// @param inputs Input parameters ids
|
/// @param inputs Input parameters ids
|
||||||
@ -39,5 +43,17 @@ struct assign : public primitive_base<assign> {
|
|||||||
|
|
||||||
return variable_id == rhs_casted.variable_id;
|
return variable_id == rhs_casted.variable_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<assign>::save(ob);
|
||||||
|
ob << variable_id;
|
||||||
|
ob << output_layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<assign>::load(ib);
|
||||||
|
ib >> variable_id;
|
||||||
|
ib >> output_layout;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -40,6 +40,10 @@ namespace cldnn {
|
|||||||
struct batch_to_space : public primitive_base<batch_to_space> {
|
struct batch_to_space : public primitive_base<batch_to_space> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(batch_to_space)
|
CLDNN_DECLARE_PRIMITIVE(batch_to_space)
|
||||||
|
|
||||||
|
batch_to_space() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs batch_to_space primitive.
|
/// @brief Constructs batch_to_space primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input data primitive id.
|
/// @param input Input data primitive id.
|
||||||
@ -82,5 +86,21 @@ struct batch_to_space : public primitive_base<batch_to_space> {
|
|||||||
crops_begin == rhs_casted.crops_begin &&
|
crops_begin == rhs_casted.crops_begin &&
|
||||||
crops_end == rhs_casted.crops_end;
|
crops_end == rhs_casted.crops_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<batch_to_space>::save(ob);
|
||||||
|
ob << block_shape;
|
||||||
|
ob << crops_begin;
|
||||||
|
ob << crops_end;
|
||||||
|
ob << out_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<batch_to_space>::load(ib);
|
||||||
|
ib >> block_shape;
|
||||||
|
ib >> crops_begin;
|
||||||
|
ib >> crops_end;
|
||||||
|
ib >> out_size;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -14,6 +14,10 @@ namespace cldnn {
|
|||||||
struct binary_convolution : public primitive_base<binary_convolution> {
|
struct binary_convolution : public primitive_base<binary_convolution> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(binary_convolution)
|
CLDNN_DECLARE_PRIMITIVE(binary_convolution)
|
||||||
|
|
||||||
|
binary_convolution() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs binary_convolution primitive.
|
/// @brief Constructs binary_convolution primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -90,6 +94,28 @@ struct binary_convolution : public primitive_base<binary_convolution> {
|
|||||||
weights.size() == rhs_casted.weights.size();
|
weights.size() == rhs_casted.weights.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<binary_convolution>::save(ob);
|
||||||
|
ob << pad;
|
||||||
|
ob << stride;
|
||||||
|
ob << dilation;
|
||||||
|
ob << output_size;
|
||||||
|
ob << groups;
|
||||||
|
ob << pad_value;
|
||||||
|
ob << weights;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<binary_convolution>::load(ib);
|
||||||
|
ib >> pad;
|
||||||
|
ib >> stride;
|
||||||
|
ib >> dilation;
|
||||||
|
ib >> output_size;
|
||||||
|
ib >> groups;
|
||||||
|
ib >> pad_value;
|
||||||
|
ib >> *const_cast<primitive_id_arr*>(&weights);
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
ret.reserve(weights.size());
|
ret.reserve(weights.size());
|
||||||
|
@ -24,6 +24,10 @@ namespace cldnn {
|
|||||||
struct border : public primitive_base<border> {
|
struct border : public primitive_base<border> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(border)
|
CLDNN_DECLARE_PRIMITIVE(border)
|
||||||
|
|
||||||
|
border() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief whether the input is const or not
|
/// @brief whether the input is const or not
|
||||||
enum PAD_NON_CONST_INPUT {
|
enum PAD_NON_CONST_INPUT {
|
||||||
BEGIN = 0x1,
|
BEGIN = 0x1,
|
||||||
@ -90,5 +94,23 @@ struct border : public primitive_base<border> {
|
|||||||
pad_mode == rhs_casted.pad_mode &&
|
pad_mode == rhs_casted.pad_mode &&
|
||||||
pad_value == rhs_casted.pad_value;
|
pad_value == rhs_casted.pad_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<border>::save(ob);
|
||||||
|
ob << pads_begin;
|
||||||
|
ob << pads_end;
|
||||||
|
ob << make_data(&pad_mode, sizeof(ov::op::PadMode));
|
||||||
|
ob << pad_value;
|
||||||
|
ob << non_constant_input_mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<border>::load(ib);
|
||||||
|
ib >> pads_begin;
|
||||||
|
ib >> pads_end;
|
||||||
|
ib >> make_data(&pad_mode, sizeof(ov::op::PadMode));
|
||||||
|
ib >> pad_value;
|
||||||
|
ib >> non_constant_input_mask;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -54,6 +54,10 @@ namespace cldnn {
|
|||||||
struct broadcast : public primitive_base<broadcast> {
|
struct broadcast : public primitive_base<broadcast> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(broadcast)
|
CLDNN_DECLARE_PRIMITIVE(broadcast)
|
||||||
|
|
||||||
|
broadcast() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs broadcast primitive / layer.
|
/// @brief Constructs broadcast primitive / layer.
|
||||||
///
|
///
|
||||||
/// @param id An identifier of new primitive.
|
/// @param id An identifier of new primitive.
|
||||||
@ -146,5 +150,23 @@ struct broadcast : public primitive_base<broadcast> {
|
|||||||
broadcast_mode == rhs_casted.broadcast_mode &&
|
broadcast_mode == rhs_casted.broadcast_mode &&
|
||||||
broadcast_sizes == rhs_casted.broadcast_sizes;
|
broadcast_sizes == rhs_casted.broadcast_sizes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<broadcast>::save(ob);
|
||||||
|
ob << target_shape;
|
||||||
|
ob << axes_mapping;
|
||||||
|
ob << make_data(&broadcast_mode, sizeof(ov::op::BroadcastModeSpec));
|
||||||
|
ob << broadcast_sizes;
|
||||||
|
ob << broadcast_axes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<broadcast>::load(ib);
|
||||||
|
ib >> target_shape;
|
||||||
|
ib >> axes_mapping;
|
||||||
|
ib >> make_data(&broadcast_mode, sizeof(ov::op::BroadcastModeSpec));
|
||||||
|
ib >> broadcast_sizes;
|
||||||
|
ib >> broadcast_axes;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -11,6 +11,10 @@ namespace cldnn {
|
|||||||
struct bucketize : primitive_base<bucketize> {
|
struct bucketize : primitive_base<bucketize> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(bucketize)
|
CLDNN_DECLARE_PRIMITIVE(bucketize)
|
||||||
|
|
||||||
|
bucketize() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs bucketize primitive.
|
/// @brief Constructs bucketize primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param inputs Input primitives ids.
|
/// @param inputs Input primitives ids.
|
||||||
@ -40,6 +44,16 @@ struct bucketize : primitive_base<bucketize> {
|
|||||||
|
|
||||||
return with_right_bound == rhs_casted.with_right_bound;
|
return with_right_bound == rhs_casted.with_right_bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<bucketize>::save(ob);
|
||||||
|
ob << with_right_bound;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<bucketize>::load(ib);
|
||||||
|
ib >> with_right_bound;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -32,6 +32,11 @@ namespace cldnn {
|
|||||||
/// @li outputIdx : index of destination feature
|
/// @li outputIdx : index of destination feature
|
||||||
struct concatenation : public primitive_base<concatenation> {
|
struct concatenation : public primitive_base<concatenation> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(concatenation)
|
CLDNN_DECLARE_PRIMITIVE(concatenation)
|
||||||
|
|
||||||
|
concatenation() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @li Constructs concatenation primitive.
|
/// @li Constructs concatenation primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Vector of input primitives ids.
|
/// @param input Vector of input primitives ids.
|
||||||
@ -73,5 +78,15 @@ struct concatenation : public primitive_base<concatenation> {
|
|||||||
|
|
||||||
return axis == rhs_casted.axis;
|
return axis == rhs_casted.axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<concatenation>::save(ob);
|
||||||
|
ob << axis;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<concatenation>::load(ib);
|
||||||
|
ib >> axis;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -12,6 +12,10 @@ namespace cldnn {
|
|||||||
struct convert_color : public primitive_base<convert_color> {
|
struct convert_color : public primitive_base<convert_color> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(convert_color)
|
CLDNN_DECLARE_PRIMITIVE(convert_color)
|
||||||
|
|
||||||
|
convert_color() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
enum color_format : uint32_t {
|
enum color_format : uint32_t {
|
||||||
RGB, ///< RGB color format
|
RGB, ///< RGB color format
|
||||||
BGR, ///< BGR color format, default in OpenVINO
|
BGR, ///< BGR color format, default in OpenVINO
|
||||||
@ -70,5 +74,21 @@ struct convert_color : public primitive_base<convert_color> {
|
|||||||
mem_type == rhs_casted.mem_type &&
|
mem_type == rhs_casted.mem_type &&
|
||||||
output_layout == rhs_casted.output_layout;
|
output_layout == rhs_casted.output_layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<convert_color>::save(ob);
|
||||||
|
ob << make_data(&input_color_format, sizeof(color_format));
|
||||||
|
ob << make_data(&output_color_format, sizeof(color_format));
|
||||||
|
ob << make_data(&mem_type, sizeof(memory_type));
|
||||||
|
ob << output_layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<convert_color>::load(ib);
|
||||||
|
ib >> make_data(&input_color_format, sizeof(color_format));
|
||||||
|
ib >> make_data(&output_color_format, sizeof(color_format));
|
||||||
|
ib >> make_data(&mem_type, sizeof(memory_type));
|
||||||
|
ib >> output_layout;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -13,6 +13,10 @@ namespace cldnn {
|
|||||||
struct convolution : public primitive_base<convolution> {
|
struct convolution : public primitive_base<convolution> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(convolution)
|
CLDNN_DECLARE_PRIMITIVE(convolution)
|
||||||
|
|
||||||
|
convolution() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs convolution primitive
|
/// @brief Constructs convolution primitive
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -245,6 +249,46 @@ struct convolution : public primitive_base<convolution> {
|
|||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<convolution>::save(ob);
|
||||||
|
ob << groups;
|
||||||
|
ob << stride;
|
||||||
|
ob << dilation;
|
||||||
|
ob << padding_begin;
|
||||||
|
ob << padding_end;
|
||||||
|
ob << make_data(&auto_pad, sizeof(ov::op::PadType));
|
||||||
|
ob << deformable_mode;
|
||||||
|
ob << deformable_groups;
|
||||||
|
ob << bilinear_interpolation_pad;
|
||||||
|
ob << transposed;
|
||||||
|
ob << grouped_weights_shape;
|
||||||
|
ob << weights;
|
||||||
|
ob << bias;
|
||||||
|
ob << weights_zero_points;
|
||||||
|
ob << activations_zero_points;
|
||||||
|
ob << compensation;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<convolution>::load(ib);
|
||||||
|
ib >> groups;
|
||||||
|
ib >> stride;
|
||||||
|
ib >> dilation;
|
||||||
|
ib >> padding_begin;
|
||||||
|
ib >> padding_end;
|
||||||
|
ib >> make_data(&auto_pad, sizeof(ov::op::PadType));
|
||||||
|
ib >> deformable_mode;
|
||||||
|
ib >> deformable_groups;
|
||||||
|
ib >> bilinear_interpolation_pad;
|
||||||
|
ib >> transposed;
|
||||||
|
ib >> grouped_weights_shape;
|
||||||
|
ib >> *const_cast<primitive_id*>(&weights);
|
||||||
|
ib >> *const_cast<primitive_id*>(&bias);
|
||||||
|
ib >> *const_cast<primitive_id*>(&weights_zero_points);
|
||||||
|
ib >> *const_cast<primitive_id*>(&activations_zero_points);
|
||||||
|
ib >> *const_cast<primitive_id*>(&compensation);
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret = {std::ref(weights)};
|
std::vector<std::reference_wrapper<const primitive_id>> ret = {std::ref(weights)};
|
||||||
if (!bias.empty()) {
|
if (!bias.empty()) {
|
||||||
@ -267,6 +311,10 @@ struct convolution : public primitive_base<convolution> {
|
|||||||
struct deformable_interp : public primitive_base<deformable_interp> {
|
struct deformable_interp : public primitive_base<deformable_interp> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(deformable_interp)
|
CLDNN_DECLARE_PRIMITIVE(deformable_interp)
|
||||||
|
|
||||||
|
deformable_interp() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
deformable_interp(const primitive_id& id,
|
deformable_interp(const primitive_id& id,
|
||||||
const std::vector<input_info>& inputs,
|
const std::vector<input_info>& inputs,
|
||||||
uint32_t groups,
|
uint32_t groups,
|
||||||
@ -347,11 +395,43 @@ struct deformable_interp : public primitive_base<deformable_interp> {
|
|||||||
cmp_fields(bilinear_interpolation_pad);
|
cmp_fields(bilinear_interpolation_pad);
|
||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<deformable_interp>::save(ob);
|
||||||
|
ob << pad;
|
||||||
|
ob << stride;
|
||||||
|
ob << dilation;
|
||||||
|
ob << output_size;
|
||||||
|
ob << kernel_size;
|
||||||
|
ob << groups;
|
||||||
|
ob << deformable_groups;
|
||||||
|
ob << padding_begin;
|
||||||
|
ob << padding_end;
|
||||||
|
ob << bilinear_interpolation_pad;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<deformable_interp>::load(ib);
|
||||||
|
ib >> pad;
|
||||||
|
ib >> stride;
|
||||||
|
ib >> dilation;
|
||||||
|
ib >> output_size;
|
||||||
|
ib >> kernel_size;
|
||||||
|
ib >> groups;
|
||||||
|
ib >> deformable_groups;
|
||||||
|
ib >> padding_begin;
|
||||||
|
ib >> padding_end;
|
||||||
|
ib >> bilinear_interpolation_pad;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct deformable_conv : public primitive_base<deformable_conv> {
|
struct deformable_conv : public primitive_base<deformable_conv> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(deformable_conv)
|
CLDNN_DECLARE_PRIMITIVE(deformable_conv)
|
||||||
|
|
||||||
|
deformable_conv() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
deformable_conv(const primitive_id& id,
|
deformable_conv(const primitive_id& id,
|
||||||
const input_info& input,
|
const input_info& input,
|
||||||
const std::vector<primitive_id>& weights,
|
const std::vector<primitive_id>& weights,
|
||||||
@ -393,6 +473,22 @@ struct deformable_conv : public primitive_base<deformable_conv> {
|
|||||||
bias.size() == rhs_casted.bias.size();
|
bias.size() == rhs_casted.bias.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<deformable_conv>::save(ob);
|
||||||
|
ob << output_size;
|
||||||
|
ob << groups;
|
||||||
|
ob << weights;
|
||||||
|
ob << bias;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<deformable_conv>::load(ib);
|
||||||
|
ib >> output_size;
|
||||||
|
ib >> groups;
|
||||||
|
ib >> *const_cast<primitive_id_arr*>(&weights);
|
||||||
|
ib >> *const_cast<primitive_id_arr*>(&bias);
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
ret.reserve(weights.size() + bias.size());
|
ret.reserve(weights.size() + bias.size());
|
||||||
|
@ -44,6 +44,10 @@ constexpr auto crop_borders = crop_borders_t{};
|
|||||||
struct crop : public primitive_base<crop> {
|
struct crop : public primitive_base<crop> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(crop)
|
CLDNN_DECLARE_PRIMITIVE(crop)
|
||||||
|
|
||||||
|
crop() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs crop primitive.
|
/// @brief Constructs crop primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -147,5 +151,23 @@ struct crop : public primitive_base<crop> {
|
|||||||
num_splits == rhs_casted.num_splits &&
|
num_splits == rhs_casted.num_splits &&
|
||||||
op_mode == rhs_casted.op_mode;
|
op_mode == rhs_casted.op_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<crop>::save(ob);
|
||||||
|
ob << reference_input;
|
||||||
|
ob << offsets;
|
||||||
|
ob << output_idx;
|
||||||
|
ob << num_splits;
|
||||||
|
ob << make_data(&op_mode, sizeof(crop_ngraph_op_mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<crop>::load(ib);
|
||||||
|
ib >> reference_input;
|
||||||
|
ib >> offsets;
|
||||||
|
ib >> output_idx;
|
||||||
|
ib >> num_splits;
|
||||||
|
ib >> make_data(&op_mode, sizeof(crop_ngraph_op_mode));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -11,6 +11,10 @@ namespace cldnn {
|
|||||||
struct ctc_greedy_decoder : public primitive_base<ctc_greedy_decoder> {
|
struct ctc_greedy_decoder : public primitive_base<ctc_greedy_decoder> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(ctc_greedy_decoder)
|
CLDNN_DECLARE_PRIMITIVE(ctc_greedy_decoder)
|
||||||
|
|
||||||
|
ctc_greedy_decoder() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs ctc_greedy_decoder primitive.
|
/// @brief Constructs ctc_greedy_decoder primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id (input, sequence_indicators, second_output(optional)).
|
/// @param input Input primitive id (input, sequence_indicators, second_output(optional)).
|
||||||
@ -50,5 +54,21 @@ struct ctc_greedy_decoder : public primitive_base<ctc_greedy_decoder> {
|
|||||||
ctc_merge_repeated == rhs_casted.ctc_merge_repeated &&
|
ctc_merge_repeated == rhs_casted.ctc_merge_repeated &&
|
||||||
second_output.empty() == rhs_casted.second_output.empty();
|
second_output.empty() == rhs_casted.second_output.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<ctc_greedy_decoder>::save(ob);
|
||||||
|
ob << blank_index;
|
||||||
|
ob << ctc_merge_repeated;
|
||||||
|
ob << output_tensor;
|
||||||
|
ob << second_output;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<ctc_greedy_decoder>::load(ib);
|
||||||
|
ib >> blank_index;
|
||||||
|
ib >> ctc_merge_repeated;
|
||||||
|
ib >> output_tensor;
|
||||||
|
ib >> second_output;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -13,6 +13,10 @@ namespace cldnn {
|
|||||||
struct ctc_loss : primitive_base<ctc_loss> {
|
struct ctc_loss : primitive_base<ctc_loss> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(ctc_loss)
|
CLDNN_DECLARE_PRIMITIVE(ctc_loss)
|
||||||
|
|
||||||
|
ctc_loss() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs ctc_loss primitive.
|
/// @brief Constructs ctc_loss primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param inputs Input primitives ids.
|
/// @param inputs Input primitives ids.
|
||||||
@ -52,6 +56,20 @@ struct ctc_loss : primitive_base<ctc_loss> {
|
|||||||
ctc_merge_repeated == rhs_casted.ctc_merge_repeated &&
|
ctc_merge_repeated == rhs_casted.ctc_merge_repeated &&
|
||||||
unique == rhs_casted.unique;
|
unique == rhs_casted.unique;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<ctc_loss>::save(ob);
|
||||||
|
ob << preprocess_collapse_repeated;
|
||||||
|
ob << ctc_merge_repeated;
|
||||||
|
ob << unique;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<ctc_loss>::load(ib);
|
||||||
|
ib >> preprocess_collapse_repeated;
|
||||||
|
ib >> ctc_merge_repeated;
|
||||||
|
ib >> unique;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -11,6 +11,10 @@ namespace cldnn {
|
|||||||
struct cum_sum : public primitive_base<cum_sum> {
|
struct cum_sum : public primitive_base<cum_sum> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(cum_sum)
|
CLDNN_DECLARE_PRIMITIVE(cum_sum)
|
||||||
|
|
||||||
|
cum_sum() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs cum_sum primitive.
|
/// @brief Constructs cum_sum primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -51,5 +55,19 @@ struct cum_sum : public primitive_base<cum_sum> {
|
|||||||
exclusive == rhs_casted.exclusive &&
|
exclusive == rhs_casted.exclusive &&
|
||||||
reverse == rhs_casted.reverse;
|
reverse == rhs_casted.reverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<cum_sum>::save(ob);
|
||||||
|
ob << axis;
|
||||||
|
ob << exclusive;
|
||||||
|
ob << reverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<cum_sum>::load(ib);
|
||||||
|
ib >> axis;
|
||||||
|
ib >> exclusive;
|
||||||
|
ib >> reverse;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -16,6 +16,10 @@ namespace cldnn {
|
|||||||
struct custom_gpu_primitive : public primitive_base<custom_gpu_primitive> {
|
struct custom_gpu_primitive : public primitive_base<custom_gpu_primitive> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(custom_gpu_primitive)
|
CLDNN_DECLARE_PRIMITIVE(custom_gpu_primitive)
|
||||||
|
|
||||||
|
custom_gpu_primitive() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Custom primitive kernel argument type
|
/// @brief Custom primitive kernel argument type
|
||||||
enum arg_type {
|
enum arg_type {
|
||||||
arg_input,
|
arg_input,
|
||||||
@ -33,6 +37,16 @@ struct custom_gpu_primitive : public primitive_base<custom_gpu_primitive> {
|
|||||||
bool operator==(const arg_desc& rhs) const {
|
bool operator==(const arg_desc& rhs) const {
|
||||||
return (type == rhs.type && index == rhs.index);
|
return (type == rhs.type && index == rhs.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const {
|
||||||
|
ob << make_data(&type, sizeof(arg_type));
|
||||||
|
ob << index;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) {
|
||||||
|
ib >> make_data(&type, sizeof(arg_type));
|
||||||
|
ib >> index;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Constructs custom_gpu_primitive primitive
|
/// @brief Constructs custom_gpu_primitive primitive
|
||||||
@ -118,5 +132,27 @@ struct custom_gpu_primitive : public primitive_base<custom_gpu_primitive> {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<custom_gpu_primitive>::save(ob);
|
||||||
|
ob << kernel_entry_point;
|
||||||
|
ob << kernel_arguments;
|
||||||
|
ob << build_options;
|
||||||
|
ob << output_layout;
|
||||||
|
ob << gws;
|
||||||
|
ob << lws;
|
||||||
|
ob << kernels_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<custom_gpu_primitive>::load(ib);
|
||||||
|
ib >> *const_cast<std::string*>(&kernel_entry_point);
|
||||||
|
ib >> *const_cast<std::vector<arg_desc>*>(&kernel_arguments);
|
||||||
|
ib >> *const_cast<std::string*>(&build_options);
|
||||||
|
ib >> *const_cast<layout*>(&output_layout);
|
||||||
|
ib >> *const_cast<std::vector<size_t>*>(&gws);
|
||||||
|
ib >> *const_cast<std::vector<size_t>*>(&lws);
|
||||||
|
ib >> *const_cast<primitive_id_arr*>(&kernels_code);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -15,6 +15,10 @@ namespace cldnn {
|
|||||||
struct data : public primitive_base<data> {
|
struct data : public primitive_base<data> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(data)
|
CLDNN_DECLARE_PRIMITIVE(data)
|
||||||
|
|
||||||
|
data() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs data primitive.
|
/// @brief Constructs data primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param mem @ref memory object which contains data.
|
/// @param mem @ref memory object which contains data.
|
||||||
|
@ -17,6 +17,11 @@ namespace cldnn {
|
|||||||
/// and stride and input padding parameters used in opposite sense as in convolution.
|
/// and stride and input padding parameters used in opposite sense as in convolution.
|
||||||
struct deconvolution : public primitive_base<deconvolution> {
|
struct deconvolution : public primitive_base<deconvolution> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(deconvolution)
|
CLDNN_DECLARE_PRIMITIVE(deconvolution)
|
||||||
|
|
||||||
|
deconvolution() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs deconvolution primitive.
|
/// @brief Constructs deconvolution primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -408,6 +413,42 @@ struct deconvolution : public primitive_base<deconvolution> {
|
|||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<deconvolution>::save(ob);
|
||||||
|
ob << pad;
|
||||||
|
ob << stride;
|
||||||
|
ob << dilations;
|
||||||
|
ob << with_output_size;
|
||||||
|
ob << output_size;
|
||||||
|
ob << groups;
|
||||||
|
ob << pads_begin;
|
||||||
|
ob << pads_end;
|
||||||
|
ob << out_padding;
|
||||||
|
ob << grouped_weights_shape;
|
||||||
|
ob << output_partial_shape;
|
||||||
|
ob << output_shape_id;
|
||||||
|
ob << weights;
|
||||||
|
ob << bias;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<deconvolution>::load(ib);
|
||||||
|
ib >> pad;
|
||||||
|
ib >> stride;
|
||||||
|
ib >> dilations;
|
||||||
|
ib >> with_output_size;
|
||||||
|
ib >> output_size;
|
||||||
|
ib >> groups;
|
||||||
|
ib >> pads_begin;
|
||||||
|
ib >> pads_end;
|
||||||
|
ib >> out_padding;
|
||||||
|
ib >> grouped_weights_shape;
|
||||||
|
ib >> output_partial_shape;
|
||||||
|
ib >> output_shape_id;
|
||||||
|
ib >> *const_cast<primitive_id_arr*>(&weights);
|
||||||
|
ib >> *const_cast<primitive_id_arr*>(&bias);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
|
@ -20,6 +20,10 @@ enum class depth_to_space_mode : int32_t {
|
|||||||
struct depth_to_space : public primitive_base<depth_to_space> {
|
struct depth_to_space : public primitive_base<depth_to_space> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(depth_to_space)
|
CLDNN_DECLARE_PRIMITIVE(depth_to_space)
|
||||||
|
|
||||||
|
depth_to_space() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs depth_to_space primitive.
|
/// @brief Constructs depth_to_space primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input dictionary primitive id.
|
/// @param input Input dictionary primitive id.
|
||||||
@ -55,5 +59,17 @@ struct depth_to_space : public primitive_base<depth_to_space> {
|
|||||||
return block_size == rhs_casted.block_size &&
|
return block_size == rhs_casted.block_size &&
|
||||||
mode == rhs_casted.mode;
|
mode == rhs_casted.mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<depth_to_space>::save(ob);
|
||||||
|
ob << block_size;
|
||||||
|
ob << make_data(&mode, sizeof(depth_to_space_mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<depth_to_space>::load(ib);
|
||||||
|
ib >> block_size;
|
||||||
|
ib >> make_data(&mode, sizeof(depth_to_space_mode));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -21,6 +21,28 @@ enum class prior_box_code_type : int32_t {
|
|||||||
struct detection_output : public primitive_base<detection_output> {
|
struct detection_output : public primitive_base<detection_output> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(detection_output)
|
CLDNN_DECLARE_PRIMITIVE(detection_output)
|
||||||
|
|
||||||
|
detection_output() : primitive_base("", {}),
|
||||||
|
num_classes(0),
|
||||||
|
keep_top_k(0),
|
||||||
|
share_location(true),
|
||||||
|
background_label_id(0),
|
||||||
|
nms_threshold(0.3f),
|
||||||
|
top_k(-1),
|
||||||
|
eta(1.f),
|
||||||
|
code_type(prior_box_code_type::corner),
|
||||||
|
variance_encoded_in_target(false),
|
||||||
|
confidence_threshold(-std::numeric_limits<float>::max()),
|
||||||
|
prior_info_size(4),
|
||||||
|
prior_coordinates_offset(0),
|
||||||
|
prior_is_normalized(true),
|
||||||
|
input_width(-1),
|
||||||
|
input_height(-1),
|
||||||
|
decrease_label_id(false),
|
||||||
|
clip_before_nms(false),
|
||||||
|
clip_after_nms(false) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs detection output primitive.
|
/// @brief Constructs detection output primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input_location Input location primitive id.
|
/// @param input_location Input location primitive id.
|
||||||
@ -44,7 +66,7 @@ struct detection_output : public primitive_base<detection_output> {
|
|||||||
const uint32_t keep_top_k,
|
const uint32_t keep_top_k,
|
||||||
const bool share_location = true,
|
const bool share_location = true,
|
||||||
const int background_label_id = 0,
|
const int background_label_id = 0,
|
||||||
const float nms_threshold = 0.3,
|
const float nms_threshold = 0.3f,
|
||||||
const int top_k = -1,
|
const int top_k = -1,
|
||||||
const float eta = 1.f,
|
const float eta = 1.f,
|
||||||
const prior_box_code_type code_type = prior_box_code_type::corner,
|
const prior_box_code_type code_type = prior_box_code_type::corner,
|
||||||
@ -171,6 +193,50 @@ struct detection_output : public primitive_base<detection_output> {
|
|||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<detection_output>::save(ob);
|
||||||
|
ob << num_classes;
|
||||||
|
ob << keep_top_k;
|
||||||
|
ob << share_location;
|
||||||
|
ob << background_label_id;
|
||||||
|
ob << nms_threshold;
|
||||||
|
ob << top_k;
|
||||||
|
ob << eta;
|
||||||
|
ob << make_data(&code_type, sizeof(prior_box_code_type));
|
||||||
|
ob << variance_encoded_in_target;
|
||||||
|
ob << confidence_threshold;
|
||||||
|
ob << prior_info_size;
|
||||||
|
ob << prior_coordinates_offset;
|
||||||
|
ob << prior_is_normalized;
|
||||||
|
ob << input_width;
|
||||||
|
ob << input_height;
|
||||||
|
ob << decrease_label_id;
|
||||||
|
ob << clip_before_nms;
|
||||||
|
ob << clip_after_nms;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<detection_output>::load(ib);
|
||||||
|
ib >> *const_cast<uint32_t*>(&num_classes);
|
||||||
|
ib >> *const_cast<int*>(&keep_top_k);
|
||||||
|
ib >> *const_cast<bool*>(&share_location);
|
||||||
|
ib >> *const_cast<int*>(&background_label_id);
|
||||||
|
ib >> *const_cast<float*>(&nms_threshold);
|
||||||
|
ib >> *const_cast<int*>(&top_k);
|
||||||
|
ib >> *const_cast<float*>(&eta);
|
||||||
|
ib >> make_data(const_cast<prior_box_code_type*>(&code_type), sizeof(prior_box_code_type));
|
||||||
|
ib >> *const_cast<bool*>(&variance_encoded_in_target);
|
||||||
|
ib >> *const_cast<float*>(&confidence_threshold);
|
||||||
|
ib >> *const_cast<int32_t*>(&prior_info_size);
|
||||||
|
ib >> *const_cast<int32_t*>(&prior_coordinates_offset);
|
||||||
|
ib >> *const_cast<bool*>(&prior_is_normalized);
|
||||||
|
ib >> *const_cast<int32_t*>(&input_width);
|
||||||
|
ib >> *const_cast<int32_t*>(&input_height);
|
||||||
|
ib >> *const_cast<bool*>(&decrease_label_id);
|
||||||
|
ib >> *const_cast<bool*>(&clip_before_nms);
|
||||||
|
ib >> *const_cast<bool*>(&clip_after_nms);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,6 +27,10 @@ enum class dft_mode {
|
|||||||
struct dft : public primitive_base<dft> {
|
struct dft : public primitive_base<dft> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(dft)
|
CLDNN_DECLARE_PRIMITIVE(dft)
|
||||||
|
|
||||||
|
dft() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs DFT primitive.
|
/// @brief Constructs DFT primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -76,6 +80,24 @@ struct dft : public primitive_base<dft> {
|
|||||||
direction == rhs_casted.direction &&
|
direction == rhs_casted.direction &&
|
||||||
mode == rhs_casted.mode;
|
mode == rhs_casted.mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<dft>::save(ob);
|
||||||
|
ob << axes;
|
||||||
|
ob << signal_size;
|
||||||
|
ob << output_shape;
|
||||||
|
ob << make_data(&direction, sizeof(dft_direction));
|
||||||
|
ob << make_data(&mode, sizeof(dft_mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<dft>::load(ib);
|
||||||
|
ib >> axes;
|
||||||
|
ib >> signal_size;
|
||||||
|
ib >> output_shape;
|
||||||
|
ib >> make_data(&direction, sizeof(dft_direction));
|
||||||
|
ib >> make_data(&mode, sizeof(dft_mode));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -66,6 +66,10 @@ enum class eltwise_mode : int32_t {
|
|||||||
struct eltwise : public primitive_base<eltwise> {
|
struct eltwise : public primitive_base<eltwise> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(eltwise)
|
CLDNN_DECLARE_PRIMITIVE(eltwise)
|
||||||
|
|
||||||
|
eltwise() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs eltwise primitive.
|
/// @brief Constructs eltwise primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -192,5 +196,21 @@ struct eltwise : public primitive_base<eltwise> {
|
|||||||
broadcast_spec == rhs_casted.broadcast_spec &&
|
broadcast_spec == rhs_casted.broadcast_spec &&
|
||||||
stride == rhs_casted.stride;
|
stride == rhs_casted.stride;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<eltwise>::save(ob);
|
||||||
|
ob << make_data(&mode, sizeof(eltwise_mode));
|
||||||
|
ob << coefficients;
|
||||||
|
ob << stride;
|
||||||
|
ob << make_data(&broadcast_spec, sizeof(ov::op::AutoBroadcastSpec));;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<eltwise>::load(ib);
|
||||||
|
ib >> make_data(&mode, sizeof(eltwise_mode));
|
||||||
|
ib >> coefficients;
|
||||||
|
ib >> stride;
|
||||||
|
ib >> make_data(&broadcast_spec, sizeof(ov::op::AutoBroadcastSpec));;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -12,6 +12,10 @@ namespace cldnn {
|
|||||||
struct embedding_bag : public primitive_base<embedding_bag> {
|
struct embedding_bag : public primitive_base<embedding_bag> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(embedding_bag)
|
CLDNN_DECLARE_PRIMITIVE(embedding_bag)
|
||||||
|
|
||||||
|
embedding_bag() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Select type of embedding_bag operation
|
/// @brief Select type of embedding_bag operation
|
||||||
enum embedding_bag_type {
|
enum embedding_bag_type {
|
||||||
packed_sum,
|
packed_sum,
|
||||||
@ -55,5 +59,19 @@ struct embedding_bag : public primitive_base<embedding_bag> {
|
|||||||
return type == rhs_casted.type &&
|
return type == rhs_casted.type &&
|
||||||
default_index == rhs_casted.default_index;
|
default_index == rhs_casted.default_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<embedding_bag>::save(ob);
|
||||||
|
ob << make_data(&type, sizeof(embedding_bag_type));
|
||||||
|
ob << output_shape;
|
||||||
|
ob << default_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<embedding_bag>::load(ib);
|
||||||
|
ib >> make_data(&type, sizeof(embedding_bag_type));
|
||||||
|
ib >> output_shape;
|
||||||
|
ib >> default_index;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -14,6 +14,10 @@ namespace cldnn {
|
|||||||
struct experimental_detectron_detection_output : public primitive_base<experimental_detectron_detection_output> {
|
struct experimental_detectron_detection_output : public primitive_base<experimental_detectron_detection_output> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(experimental_detectron_detection_output)
|
CLDNN_DECLARE_PRIMITIVE(experimental_detectron_detection_output)
|
||||||
|
|
||||||
|
experimental_detectron_detection_output() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs experimental_detectron_detection_output primitive
|
/// @brief Constructs experimental_detectron_detection_output primitive
|
||||||
/// @param id This primitive id
|
/// @param id This primitive id
|
||||||
/// @param input_rois input rois
|
/// @param input_rois input rois
|
||||||
@ -106,6 +110,34 @@ struct experimental_detectron_detection_output : public primitive_base<experimen
|
|||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<experimental_detectron_detection_output>::save(ob);
|
||||||
|
ob << output_classes;
|
||||||
|
ob << output_scores;
|
||||||
|
ob << score_threshold;
|
||||||
|
ob << nms_threshold;
|
||||||
|
ob << num_classes;
|
||||||
|
ob << post_nms_count;
|
||||||
|
ob << max_detections_per_image;
|
||||||
|
ob << class_agnostic_box_regression;
|
||||||
|
ob << max_delta_log_wh;
|
||||||
|
ob << deltas_weights;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<experimental_detectron_detection_output>::load(ib);
|
||||||
|
ib >> output_classes;
|
||||||
|
ib >> output_scores;
|
||||||
|
ib >> score_threshold;
|
||||||
|
ib >> nms_threshold;
|
||||||
|
ib >> num_classes;
|
||||||
|
ib >> post_nms_count;
|
||||||
|
ib >> max_detections_per_image;
|
||||||
|
ib >> class_agnostic_box_regression;
|
||||||
|
ib >> max_delta_log_wh;
|
||||||
|
ib >> deltas_weights;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
|
@ -13,6 +13,10 @@ struct experimental_detectron_generate_proposals_single_image
|
|||||||
: public primitive_base<experimental_detectron_generate_proposals_single_image> {
|
: public primitive_base<experimental_detectron_generate_proposals_single_image> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(experimental_detectron_generate_proposals_single_image)
|
CLDNN_DECLARE_PRIMITIVE(experimental_detectron_generate_proposals_single_image)
|
||||||
|
|
||||||
|
experimental_detectron_generate_proposals_single_image() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs experimental_detectron_generate_proposals_single_image primitive
|
/// @brief Constructs experimental_detectron_generate_proposals_single_image primitive
|
||||||
/// @param id This primitive id
|
/// @param id This primitive id
|
||||||
/// @param input_im_info image size info
|
/// @param input_im_info image size info
|
||||||
@ -71,6 +75,24 @@ struct experimental_detectron_generate_proposals_single_image
|
|||||||
output_roi_scores.empty() == rhs_casted.output_roi_scores.empty();
|
output_roi_scores.empty() == rhs_casted.output_roi_scores.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<experimental_detectron_generate_proposals_single_image>::save(ob);
|
||||||
|
ob << output_roi_scores;
|
||||||
|
ob << min_size;
|
||||||
|
ob << nms_threshold;
|
||||||
|
ob << pre_nms_count;
|
||||||
|
ob << post_nms_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<experimental_detectron_generate_proposals_single_image>::load(ib);
|
||||||
|
ib >> output_roi_scores;
|
||||||
|
ib >> min_size;
|
||||||
|
ib >> nms_threshold;
|
||||||
|
ib >> pre_nms_count;
|
||||||
|
ib >> post_nms_count;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
|
@ -15,6 +15,10 @@ struct experimental_detectron_prior_grid_generator
|
|||||||
: public primitive_base<experimental_detectron_prior_grid_generator> {
|
: public primitive_base<experimental_detectron_prior_grid_generator> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(experimental_detectron_prior_grid_generator)
|
CLDNN_DECLARE_PRIMITIVE(experimental_detectron_prior_grid_generator)
|
||||||
|
|
||||||
|
experimental_detectron_prior_grid_generator() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
experimental_detectron_prior_grid_generator(const primitive_id& id,
|
experimental_detectron_prior_grid_generator(const primitive_id& id,
|
||||||
const std::vector<input_info>& inputs,
|
const std::vector<input_info>& inputs,
|
||||||
bool flatten,
|
bool flatten,
|
||||||
@ -77,6 +81,32 @@ struct experimental_detectron_prior_grid_generator
|
|||||||
image_height == rhs_casted.image_height &&
|
image_height == rhs_casted.image_height &&
|
||||||
image_width == rhs_casted.image_width;
|
image_width == rhs_casted.image_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<experimental_detectron_prior_grid_generator>::save(ob);
|
||||||
|
ob << flatten;
|
||||||
|
ob << h;
|
||||||
|
ob << w;
|
||||||
|
ob << stride_x;
|
||||||
|
ob << stride_y;
|
||||||
|
ob << featmap_height;
|
||||||
|
ob << featmap_width;
|
||||||
|
ob << image_height;
|
||||||
|
ob << image_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<experimental_detectron_prior_grid_generator>::load(ib);
|
||||||
|
ib >> flatten;
|
||||||
|
ib >> h;
|
||||||
|
ib >> w;
|
||||||
|
ib >> stride_x;
|
||||||
|
ib >> stride_y;
|
||||||
|
ib >> featmap_height;
|
||||||
|
ib >> featmap_width;
|
||||||
|
ib >> image_height;
|
||||||
|
ib >> image_width;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -12,6 +12,10 @@ namespace cldnn {
|
|||||||
struct experimental_detectron_roi_feature_extractor : public primitive_base<experimental_detectron_roi_feature_extractor> {
|
struct experimental_detectron_roi_feature_extractor : public primitive_base<experimental_detectron_roi_feature_extractor> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(experimental_detectron_roi_feature_extractor)
|
CLDNN_DECLARE_PRIMITIVE(experimental_detectron_roi_feature_extractor)
|
||||||
|
|
||||||
|
experimental_detectron_roi_feature_extractor() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs experimental_detectron_roi_feature_extractor primitive
|
/// @brief Constructs experimental_detectron_roi_feature_extractor primitive
|
||||||
/// @param id This primitive id
|
/// @param id This primitive id
|
||||||
/// @param inputs Inputs for primitive id (ROIs, {pyramid levels, ...}, second_output)
|
/// @param inputs Inputs for primitive id (ROIs, {pyramid levels, ...}, second_output)
|
||||||
@ -65,6 +69,26 @@ struct experimental_detectron_roi_feature_extractor : public primitive_base<expe
|
|||||||
sampling_ratio == rhs_casted.sampling_ratio &&
|
sampling_ratio == rhs_casted.sampling_ratio &&
|
||||||
aligned == rhs_casted.aligned;
|
aligned == rhs_casted.aligned;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<experimental_detectron_roi_feature_extractor>::save(ob);
|
||||||
|
ob << output_dim;
|
||||||
|
ob << pooled_height;
|
||||||
|
ob << pooled_width;
|
||||||
|
ob << pyramid_scales;
|
||||||
|
ob << sampling_ratio;
|
||||||
|
ob << aligned;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<experimental_detectron_roi_feature_extractor>::load(ib);
|
||||||
|
ib >> output_dim;
|
||||||
|
ib >> pooled_height;
|
||||||
|
ib >> pooled_width;
|
||||||
|
ib >> pyramid_scales;
|
||||||
|
ib >> sampling_ratio;
|
||||||
|
ib >> aligned;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -17,6 +17,10 @@ namespace cldnn {
|
|||||||
struct experimental_detectron_topk_rois : public primitive_base<experimental_detectron_topk_rois> {
|
struct experimental_detectron_topk_rois : public primitive_base<experimental_detectron_topk_rois> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(experimental_detectron_topk_rois)
|
CLDNN_DECLARE_PRIMITIVE(experimental_detectron_topk_rois)
|
||||||
|
|
||||||
|
experimental_detectron_topk_rois() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct ExperimentalDetectronTopKROIs privitive.
|
* Construct ExperimentalDetectronTopKROIs privitive.
|
||||||
* @param id primitive id
|
* @param id primitive id
|
||||||
@ -46,6 +50,16 @@ struct experimental_detectron_topk_rois : public primitive_base<experimental_det
|
|||||||
|
|
||||||
return max_rois == rhs_casted.max_rois;
|
return max_rois == rhs_casted.max_rois;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<experimental_detectron_topk_rois>::save(ob);
|
||||||
|
ob << max_rois;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<experimental_detectron_topk_rois>::load(ib);
|
||||||
|
ib >> max_rois;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -21,6 +21,10 @@ namespace cldnn {
|
|||||||
struct extract_image_patches : public primitive_base<extract_image_patches> {
|
struct extract_image_patches : public primitive_base<extract_image_patches> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(extract_image_patches)
|
CLDNN_DECLARE_PRIMITIVE(extract_image_patches)
|
||||||
|
|
||||||
|
extract_image_patches() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs select primitive.
|
/// @brief Constructs select primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id containing input 4-D tensor.
|
/// @param input Input primitive id containing input 4-D tensor.
|
||||||
@ -75,5 +79,23 @@ struct extract_image_patches : public primitive_base<extract_image_patches> {
|
|||||||
rates == rhs_casted.rates &&
|
rates == rhs_casted.rates &&
|
||||||
auto_pad == rhs_casted.auto_pad;
|
auto_pad == rhs_casted.auto_pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<extract_image_patches>::save(ob);
|
||||||
|
ob << sizes;
|
||||||
|
ob << strides;
|
||||||
|
ob << rates;
|
||||||
|
ob << auto_pad;
|
||||||
|
ob << output_shape;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<extract_image_patches>::load(ib);
|
||||||
|
ib >> sizes;
|
||||||
|
ib >> strides;
|
||||||
|
ib >> rates;
|
||||||
|
ib >> auto_pad;
|
||||||
|
ib >> output_shape;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -12,6 +12,10 @@ namespace cldnn {
|
|||||||
struct eye : public primitive_base<eye> {
|
struct eye : public primitive_base<eye> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(eye)
|
CLDNN_DECLARE_PRIMITIVE(eye)
|
||||||
|
|
||||||
|
eye() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs eye primitive.
|
/// @brief Constructs eye primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param inputs List of primitive ids.
|
/// @param inputs List of primitive ids.
|
||||||
@ -45,5 +49,17 @@ struct eye : public primitive_base<eye> {
|
|||||||
|
|
||||||
return shift == rhs_casted.shift;
|
return shift == rhs_casted.shift;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<eye>::save(ob);
|
||||||
|
ob << output_shape;
|
||||||
|
ob << shift;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<eye>::load(ib);
|
||||||
|
ib >> output_shape;
|
||||||
|
ib >> shift;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -33,6 +33,10 @@ namespace cldnn {
|
|||||||
struct fully_connected : public primitive_base<fully_connected> {
|
struct fully_connected : public primitive_base<fully_connected> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(fully_connected)
|
CLDNN_DECLARE_PRIMITIVE(fully_connected)
|
||||||
|
|
||||||
|
fully_connected() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs fully connected layer.
|
/// @brief Constructs fully connected layer.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -100,6 +104,22 @@ struct fully_connected : public primitive_base<fully_connected> {
|
|||||||
bias.empty() == rhs_casted.bias.empty();
|
bias.empty() == rhs_casted.bias.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<fully_connected>::save(ob);
|
||||||
|
ob << weights;
|
||||||
|
ob << bias;
|
||||||
|
ob << input_size;
|
||||||
|
ob << weights_rank;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<fully_connected>::load(ib);
|
||||||
|
ib >> weights;
|
||||||
|
ib >> bias;
|
||||||
|
ib >> input_size;
|
||||||
|
ib >> weights_rank;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
|
@ -14,6 +14,10 @@ namespace cldnn {
|
|||||||
struct gather : public primitive_base<gather> {
|
struct gather : public primitive_base<gather> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(gather)
|
CLDNN_DECLARE_PRIMITIVE(gather)
|
||||||
|
|
||||||
|
gather() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs gather primitive.
|
/// @brief Constructs gather primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param dict Input dictionary primitive id.
|
/// @param dict Input dictionary primitive id.
|
||||||
@ -63,5 +67,21 @@ struct gather : public primitive_base<gather> {
|
|||||||
batch_dim == rhs_casted.batch_dim &&
|
batch_dim == rhs_casted.batch_dim &&
|
||||||
support_neg_ind == rhs_casted.support_neg_ind;
|
support_neg_ind == rhs_casted.support_neg_ind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<gather>::save(ob);
|
||||||
|
ob << axis;
|
||||||
|
ob << output_shape;
|
||||||
|
ob << batch_dim;
|
||||||
|
ob << support_neg_ind;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<gather>::load(ib);
|
||||||
|
ib >> axis;
|
||||||
|
ib >> output_shape;
|
||||||
|
ib >> batch_dim;
|
||||||
|
ib >> support_neg_ind;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -12,6 +12,10 @@ namespace cldnn {
|
|||||||
struct gather_elements : public primitive_base<gather_elements> {
|
struct gather_elements : public primitive_base<gather_elements> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(gather_elements)
|
CLDNN_DECLARE_PRIMITIVE(gather_elements)
|
||||||
|
|
||||||
|
gather_elements() : primitive_base("", {}), output_format({}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs gather_elements primitive.
|
/// @brief Constructs gather_elements primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param data Input data primitive id.
|
/// @param data Input data primitive id.
|
||||||
@ -59,5 +63,21 @@ struct gather_elements : public primitive_base<gather_elements> {
|
|||||||
return output_format == rhs_casted.output_format &&
|
return output_format == rhs_casted.output_format &&
|
||||||
axis == rhs_casted.axis;
|
axis == rhs_casted.axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<gather_elements>::save(ob);
|
||||||
|
ob << make_data(&output_format.value, sizeof(format::type));
|
||||||
|
ob << output_shape;
|
||||||
|
ob << axis;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<gather_elements>::load(ib);
|
||||||
|
format::type tmp_type;
|
||||||
|
ib >> make_data(&tmp_type, sizeof(format::type));
|
||||||
|
output_format = format(tmp_type);
|
||||||
|
ib >> output_shape;
|
||||||
|
ib >> axis;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -12,6 +12,10 @@ namespace cldnn {
|
|||||||
struct gather_nd : public primitive_base<gather_nd> {
|
struct gather_nd : public primitive_base<gather_nd> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(gather_nd)
|
CLDNN_DECLARE_PRIMITIVE(gather_nd)
|
||||||
|
|
||||||
|
gather_nd() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs gather_nd primitive.
|
/// @brief Constructs gather_nd primitive.
|
||||||
///
|
///
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
@ -69,5 +73,21 @@ struct gather_nd : public primitive_base<gather_nd> {
|
|||||||
batch_dims == rhs_casted.batch_dims &&
|
batch_dims == rhs_casted.batch_dims &&
|
||||||
batch_merged_output == rhs_casted.batch_merged_output;
|
batch_merged_output == rhs_casted.batch_merged_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<gather_nd>::save(ob);
|
||||||
|
ob << input_rank;
|
||||||
|
ob << indices_rank;
|
||||||
|
ob << batch_dims;
|
||||||
|
ob << batch_merged_output;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<gather_nd>::load(ib);
|
||||||
|
ib >> input_rank;
|
||||||
|
ib >> indices_rank;
|
||||||
|
ib >> batch_dims;
|
||||||
|
ib >> batch_merged_output;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -13,6 +13,10 @@ namespace cldnn {
|
|||||||
struct gather_tree : public primitive_base<gather_tree> {
|
struct gather_tree : public primitive_base<gather_tree> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(gather_tree)
|
CLDNN_DECLARE_PRIMITIVE(gather_tree)
|
||||||
|
|
||||||
|
gather_tree() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs gather tree primitive / layer.
|
/// @brief Constructs gather tree primitive / layer.
|
||||||
///
|
///
|
||||||
/// @param id An identifier of new primitive.
|
/// @param id An identifier of new primitive.
|
||||||
|
@ -25,6 +25,10 @@ namespace cldnn {
|
|||||||
struct gemm : public primitive_base<gemm> {
|
struct gemm : public primitive_base<gemm> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(gemm)
|
CLDNN_DECLARE_PRIMITIVE(gemm)
|
||||||
|
|
||||||
|
gemm() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs gemm layer.
|
/// @brief Constructs gemm layer.
|
||||||
/// @brief Primitive id containing first matrix
|
/// @brief Primitive id containing first matrix
|
||||||
/// @brief Primitive id containing second matrix
|
/// @brief Primitive id containing second matrix
|
||||||
@ -90,6 +94,26 @@ struct gemm : public primitive_base<gemm> {
|
|||||||
input_rank == rhs_casted.input_rank &&
|
input_rank == rhs_casted.input_rank &&
|
||||||
weight_rank == rhs_casted.weight_rank;
|
weight_rank == rhs_casted.weight_rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<gemm>::save(ob);
|
||||||
|
ob << transpose_input0;
|
||||||
|
ob << transpose_input1;
|
||||||
|
ob << alpha;
|
||||||
|
ob << beta;
|
||||||
|
ob << input_rank;
|
||||||
|
ob << weight_rank;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<gemm>::load(ib);
|
||||||
|
ib >> transpose_input0;
|
||||||
|
ib >> transpose_input1;
|
||||||
|
ib >> alpha;
|
||||||
|
ib >> beta;
|
||||||
|
ib >> input_rank;
|
||||||
|
ib >> weight_rank;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -13,6 +13,10 @@ struct generate_proposals
|
|||||||
: public primitive_base<generate_proposals> {
|
: public primitive_base<generate_proposals> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(generate_proposals)
|
CLDNN_DECLARE_PRIMITIVE(generate_proposals)
|
||||||
|
|
||||||
|
generate_proposals() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs generate_proposals primitive
|
/// @brief Constructs generate_proposals primitive
|
||||||
/// @param id This primitive id
|
/// @param id This primitive id
|
||||||
/// @param input_im_info image size info
|
/// @param input_im_info image size info
|
||||||
@ -92,6 +96,32 @@ struct generate_proposals
|
|||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<generate_proposals>::save(ob);
|
||||||
|
ob << output_rois_scores;
|
||||||
|
ob << output_rois_num;
|
||||||
|
ob << min_size;
|
||||||
|
ob << nms_threshold;
|
||||||
|
ob << pre_nms_count;
|
||||||
|
ob << post_nms_count;
|
||||||
|
ob << normalized;
|
||||||
|
ob << nms_eta;
|
||||||
|
ob << make_data(&roi_num_type, sizeof(data_types));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<generate_proposals>::load(ib);
|
||||||
|
ib >> output_rois_scores;
|
||||||
|
ib >> output_rois_num;
|
||||||
|
ib >> min_size;
|
||||||
|
ib >> nms_threshold;
|
||||||
|
ib >> pre_nms_count;
|
||||||
|
ib >> post_nms_count;
|
||||||
|
ib >> normalized;
|
||||||
|
ib >> nms_eta;
|
||||||
|
ib >> make_data(&roi_num_type, sizeof(data_types));
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
|
@ -40,6 +40,10 @@ protected:
|
|||||||
struct generic_layer : public primitive_base<generic_layer> {
|
struct generic_layer : public primitive_base<generic_layer> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(generic_layer)
|
CLDNN_DECLARE_PRIMITIVE(generic_layer)
|
||||||
|
|
||||||
|
generic_layer() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs generic_layer primitive which takes mean subtract values from another primitive.
|
/// @brief Constructs generic_layer primitive which takes mean subtract values from another primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -77,6 +81,20 @@ struct generic_layer : public primitive_base<generic_layer> {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<generic_layer>::save(ob);
|
||||||
|
ob << params->get_input_layout();
|
||||||
|
ob << params->get_output_layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<generic_layer>::load(ib);
|
||||||
|
layout input_layout, output_layout;
|
||||||
|
ib >> input_layout;
|
||||||
|
ib >> output_layout;
|
||||||
|
params = std::make_shared<WeightsReorderParams>(input_layout, output_layout);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override { return {}; }
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override { return {}; }
|
||||||
};
|
};
|
||||||
|
@ -18,6 +18,10 @@ using GridSampleOp = ov::op::v9::GridSample;
|
|||||||
struct grid_sample : primitive_base<grid_sample> {
|
struct grid_sample : primitive_base<grid_sample> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(grid_sample)
|
CLDNN_DECLARE_PRIMITIVE(grid_sample)
|
||||||
|
|
||||||
|
grid_sample() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs grid_sample primitive.
|
/// @brief Constructs grid_sample primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param inputs Input primitives ids.
|
/// @param inputs Input primitives ids.
|
||||||
@ -49,6 +53,16 @@ struct grid_sample : primitive_base<grid_sample> {
|
|||||||
attributes.mode == rhs_casted.attributes.mode &&
|
attributes.mode == rhs_casted.attributes.mode &&
|
||||||
attributes.padding_mode == rhs_casted.attributes.padding_mode;
|
attributes.padding_mode == rhs_casted.attributes.padding_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<grid_sample>::save(ob);
|
||||||
|
ob << make_data(&attributes, sizeof(GridSampleOp::Attributes));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<grid_sample>::load(ib);
|
||||||
|
ib >> make_data(&attributes, sizeof(GridSampleOp::Attributes));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -11,6 +11,10 @@ namespace cldnn {
|
|||||||
struct grn : public primitive_base<grn> {
|
struct grn : public primitive_base<grn> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(grn)
|
CLDNN_DECLARE_PRIMITIVE(grn)
|
||||||
|
|
||||||
|
grn() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs grn primitive.
|
/// @brief Constructs grn primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -41,5 +45,15 @@ struct grn : public primitive_base<grn> {
|
|||||||
|
|
||||||
return bias == rhs_casted.bias;
|
return bias == rhs_casted.bias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<grn>::save(ob);
|
||||||
|
ob << bias;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<grn>::load(ib);
|
||||||
|
ib >> bias;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -18,6 +18,10 @@ namespace cldnn {
|
|||||||
struct input_layout : public primitive_base<input_layout> {
|
struct input_layout : public primitive_base<input_layout> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(input_layout)
|
CLDNN_DECLARE_PRIMITIVE(input_layout)
|
||||||
|
|
||||||
|
input_layout() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs input layout primitive.
|
/// @brief Constructs input layout primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param layout Defines layout for the data will be passed to network.
|
/// @param layout Defines layout for the data will be passed to network.
|
||||||
@ -36,5 +40,15 @@ struct input_layout : public primitive_base<input_layout> {
|
|||||||
seed = hash_combine(seed, id);
|
seed = hash_combine(seed, id);
|
||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<input_layout>::save(ob);
|
||||||
|
ob << layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<input_layout>::load(ib);
|
||||||
|
ib >> layout;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include "primitive.hpp"
|
#include "primitive.hpp"
|
||||||
#include "intel_gpu/graph/topology.hpp"
|
#include "intel_gpu/graph/topology.hpp"
|
||||||
#include "intel_gpu/graph/serialization/string_serializer.hpp"
|
|
||||||
#include "intel_gpu/graph/serialization/vector_serializer.hpp"
|
|
||||||
|
|
||||||
#define DEFAULT_MAX_NUM_ITERATION 256
|
#define DEFAULT_MAX_NUM_ITERATION 256
|
||||||
namespace cldnn {
|
namespace cldnn {
|
||||||
@ -208,6 +206,7 @@ struct loop : public primitive_base<loop> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void save(BinaryOutputBuffer& ob) const override {
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<loop>::save(ob);
|
||||||
ob << trip_count_id;
|
ob << trip_count_id;
|
||||||
ob << initial_execution_id;
|
ob << initial_execution_id;
|
||||||
ob << num_iteration_id;
|
ob << num_iteration_id;
|
||||||
@ -220,6 +219,7 @@ struct loop : public primitive_base<loop> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void load(BinaryInputBuffer& ib) override {
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<loop>::load(ib);
|
||||||
ib >> trip_count_id;
|
ib >> trip_count_id;
|
||||||
ib >> initial_execution_id;
|
ib >> initial_execution_id;
|
||||||
ib >> num_iteration_id;
|
ib >> num_iteration_id;
|
||||||
|
@ -27,6 +27,10 @@ typedef enum { /*:int32_t*/
|
|||||||
struct lrn : public primitive_base<lrn> {
|
struct lrn : public primitive_base<lrn> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(lrn)
|
CLDNN_DECLARE_PRIMITIVE(lrn)
|
||||||
|
|
||||||
|
lrn() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs LRN primitive.
|
/// @brief Constructs LRN primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -83,5 +87,23 @@ struct lrn : public primitive_base<lrn> {
|
|||||||
beta == rhs_casted.beta &&
|
beta == rhs_casted.beta &&
|
||||||
norm_region == rhs_casted.norm_region;
|
norm_region == rhs_casted.norm_region;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<lrn>::save(ob);
|
||||||
|
ob << size;
|
||||||
|
ob << k;
|
||||||
|
ob << alpha;
|
||||||
|
ob << beta;
|
||||||
|
ob << make_data(&norm_region, sizeof(lrn_norm_region));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<lrn>::load(ib);
|
||||||
|
ib >> size;
|
||||||
|
ib >> k;
|
||||||
|
ib >> alpha;
|
||||||
|
ib >> beta;
|
||||||
|
ib >> make_data(&norm_region, sizeof(lrn_norm_region));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "activation.hpp"
|
#include "activation.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "intel_gpu/graph/serialization/string_serializer.hpp"
|
#include "intel_gpu/graph/serialization/activation_serializer.hpp"
|
||||||
|
|
||||||
namespace cldnn {
|
namespace cldnn {
|
||||||
|
|
||||||
@ -51,6 +51,10 @@ enum class lstm_output_selection {
|
|||||||
struct lstm : public primitive_base<lstm> {
|
struct lstm : public primitive_base<lstm> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(lstm)
|
CLDNN_DECLARE_PRIMITIVE(lstm)
|
||||||
|
|
||||||
|
lstm() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs lstm layer.
|
/// @brief Constructs lstm layer.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Vector of primitive id.
|
/// @param input Vector of primitive id.
|
||||||
@ -170,6 +174,38 @@ struct lstm : public primitive_base<lstm> {
|
|||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<lstm>::save(ob);
|
||||||
|
ob << weights;
|
||||||
|
ob << recurrent;
|
||||||
|
ob << bias;
|
||||||
|
ob << initial_hidden;
|
||||||
|
ob << initial_cell;
|
||||||
|
ob << peepholes;
|
||||||
|
ob << clip;
|
||||||
|
ob << input_forget;
|
||||||
|
ob << activations;
|
||||||
|
ob << activation_params;
|
||||||
|
ob << make_data(&output_selection, sizeof(lstm_output_selection));
|
||||||
|
ob << make_data(&offset_order, sizeof(lstm_weights_order));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<lstm>::load(ib);
|
||||||
|
ib >> weights;
|
||||||
|
ib >> recurrent;
|
||||||
|
ib >> bias;
|
||||||
|
ib >> initial_hidden;
|
||||||
|
ib >> initial_cell;
|
||||||
|
ib >> peepholes;
|
||||||
|
ib >> clip;
|
||||||
|
ib >> input_forget;
|
||||||
|
ib >> activations;
|
||||||
|
ib >> activation_params;
|
||||||
|
ib >> make_data(&output_selection, sizeof(lstm_output_selection));
|
||||||
|
ib >> make_data(&offset_order, sizeof(lstm_weights_order));
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
@ -374,6 +410,8 @@ struct lstm_elt : public primitive_base<lstm_elt> {
|
|||||||
ob << cell;
|
ob << cell;
|
||||||
ob << clip;
|
ob << clip;
|
||||||
ob << input_forget;
|
ob << input_forget;
|
||||||
|
ob << activations;
|
||||||
|
ob << activation_params;
|
||||||
ob << make_data(&offset_order, sizeof(lstm_weights_order));
|
ob << make_data(&offset_order, sizeof(lstm_weights_order));
|
||||||
ob << direction;
|
ob << direction;
|
||||||
}
|
}
|
||||||
@ -382,6 +420,8 @@ struct lstm_elt : public primitive_base<lstm_elt> {
|
|||||||
ib >> cell;
|
ib >> cell;
|
||||||
ib >> clip;
|
ib >> clip;
|
||||||
ib >> input_forget;
|
ib >> input_forget;
|
||||||
|
ib >> activations;
|
||||||
|
ib >> activation_params;
|
||||||
ib >> make_data(&offset_order, sizeof(lstm_weights_order));
|
ib >> make_data(&offset_order, sizeof(lstm_weights_order));
|
||||||
ib >> direction;
|
ib >> direction;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,10 @@ namespace cldnn {
|
|||||||
struct lstm_dynamic : public primitive_base<lstm_dynamic> {
|
struct lstm_dynamic : public primitive_base<lstm_dynamic> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(lstm_dynamic)
|
CLDNN_DECLARE_PRIMITIVE(lstm_dynamic)
|
||||||
|
|
||||||
|
lstm_dynamic() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs lstm_dynamic layer.
|
/// @brief Constructs lstm_dynamic layer.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Primitive id of input layer.
|
/// @param input Primitive id of input layer.
|
||||||
@ -108,6 +112,34 @@ struct lstm_dynamic : public primitive_base<lstm_dynamic> {
|
|||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<lstm_dynamic>::save(ob);
|
||||||
|
ob << dyn_length;
|
||||||
|
ob << weights;
|
||||||
|
ob << recurrent;
|
||||||
|
ob << last_hidden_state;
|
||||||
|
ob << last_cell_state;
|
||||||
|
ob << bias;
|
||||||
|
ob << initial_hidden;
|
||||||
|
ob << initial_cell;
|
||||||
|
ob << clip;
|
||||||
|
ob << input_forget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<lstm_dynamic>::load(ib);
|
||||||
|
ib >> dyn_length;
|
||||||
|
ib >> weights;
|
||||||
|
ib >> recurrent;
|
||||||
|
ib >> last_hidden_state;
|
||||||
|
ib >> last_cell_state;
|
||||||
|
ib >> bias;
|
||||||
|
ib >> initial_hidden;
|
||||||
|
ib >> initial_cell;
|
||||||
|
ib >> clip;
|
||||||
|
ib >> input_forget;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
|
@ -20,6 +20,10 @@ namespace cldnn {
|
|||||||
struct lstm_dynamic_input : public primitive_base<lstm_dynamic_input> {
|
struct lstm_dynamic_input : public primitive_base<lstm_dynamic_input> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(lstm_dynamic_input)
|
CLDNN_DECLARE_PRIMITIVE(lstm_dynamic_input)
|
||||||
|
|
||||||
|
lstm_dynamic_input() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs lstm_dynamic layer.
|
/// @brief Constructs lstm_dynamic layer.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Primitive id of input layer.
|
/// @param input Primitive id of input layer.
|
||||||
@ -57,6 +61,20 @@ struct lstm_dynamic_input : public primitive_base<lstm_dynamic_input> {
|
|||||||
return bias.empty() == rhs_casted.bias.empty();
|
return bias.empty() == rhs_casted.bias.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<lstm_dynamic_input>::save(ob);
|
||||||
|
ob << dyn_length;
|
||||||
|
ob << weights;
|
||||||
|
ob << bias;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<lstm_dynamic_input>::load(ib);
|
||||||
|
ib >> dyn_length;
|
||||||
|
ib >> weights;
|
||||||
|
ib >> bias;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
|
@ -21,6 +21,10 @@ struct lstm_dynamic_timeloop
|
|||||||
: public primitive_base<lstm_dynamic_timeloop> {
|
: public primitive_base<lstm_dynamic_timeloop> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(lstm_dynamic_timeloop)
|
CLDNN_DECLARE_PRIMITIVE(lstm_dynamic_timeloop)
|
||||||
|
|
||||||
|
lstm_dynamic_timeloop() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs lstm_dynamic layer.
|
/// @brief Constructs lstm_dynamic layer.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Primitive id of input layer.
|
/// @param input Primitive id of input layer.
|
||||||
@ -95,6 +99,30 @@ struct lstm_dynamic_timeloop
|
|||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<lstm_dynamic_timeloop>::save(ob);
|
||||||
|
ob << dyn_length;
|
||||||
|
ob << recurrent;
|
||||||
|
ob << last_hidden_state;
|
||||||
|
ob << last_cell_state;
|
||||||
|
ob << initial_hidden;
|
||||||
|
ob << initial_cell;
|
||||||
|
ob << clip;
|
||||||
|
ob << input_forget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<lstm_dynamic_timeloop>::load(ib);
|
||||||
|
ib >> dyn_length;
|
||||||
|
ib >> recurrent;
|
||||||
|
ib >> last_hidden_state;
|
||||||
|
ib >> last_cell_state;
|
||||||
|
ib >> initial_hidden;
|
||||||
|
ib >> initial_cell;
|
||||||
|
ib >> clip;
|
||||||
|
ib >> input_forget;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
|
@ -14,6 +14,10 @@ namespace cldnn {
|
|||||||
struct matrix_nms : public primitive_base<matrix_nms> {
|
struct matrix_nms : public primitive_base<matrix_nms> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(matrix_nms)
|
CLDNN_DECLARE_PRIMITIVE(matrix_nms)
|
||||||
|
|
||||||
|
matrix_nms() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
enum decay_function { gaussian, linear };
|
enum decay_function { gaussian, linear };
|
||||||
|
|
||||||
enum sort_result_type {
|
enum sort_result_type {
|
||||||
@ -82,6 +86,32 @@ struct matrix_nms : public primitive_base<matrix_nms> {
|
|||||||
gaussian_sigma(gaussian_sigma),
|
gaussian_sigma(gaussian_sigma),
|
||||||
post_threshold(post_threshold),
|
post_threshold(post_threshold),
|
||||||
normalized(normalized) {}
|
normalized(normalized) {}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const {
|
||||||
|
ob << make_data(&sort_type, sizeof(sort_result_type));
|
||||||
|
ob << sort_result_across_batch;
|
||||||
|
ob << score_threshold;
|
||||||
|
ob << nms_top_k;
|
||||||
|
ob << keep_top_k;
|
||||||
|
ob << background_class;
|
||||||
|
ob << make_data(&decay, sizeof(decay_function));
|
||||||
|
ob << gaussian_sigma;
|
||||||
|
ob << post_threshold;
|
||||||
|
ob << normalized;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) {
|
||||||
|
ib >> make_data(&sort_type, sizeof(sort_result_type));
|
||||||
|
ib >> sort_result_across_batch;
|
||||||
|
ib >> score_threshold;
|
||||||
|
ib >> nms_top_k;
|
||||||
|
ib >> keep_top_k;
|
||||||
|
ib >> background_class;
|
||||||
|
ib >> make_data(&decay, sizeof(decay_function));
|
||||||
|
ib >> gaussian_sigma;
|
||||||
|
ib >> post_threshold;
|
||||||
|
ib >> normalized;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Constructs matrix_nms primitive.
|
/// @brief Constructs matrix_nms primitive.
|
||||||
@ -153,6 +183,16 @@ struct matrix_nms : public primitive_base<matrix_nms> {
|
|||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<matrix_nms>::save(ob);
|
||||||
|
ob << attribs;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<matrix_nms>::load(ib);
|
||||||
|
ib >> attribs;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static cldnn::matrix_nms::decay_function from(ngraph::op::v8::MatrixNms::DecayFunction decay) {
|
static cldnn::matrix_nms::decay_function from(ngraph::op::v8::MatrixNms::DecayFunction decay) {
|
||||||
switch (decay) {
|
switch (decay) {
|
||||||
|
@ -16,6 +16,10 @@ namespace cldnn {
|
|||||||
struct multiclass_nms : public primitive_base<multiclass_nms> {
|
struct multiclass_nms : public primitive_base<multiclass_nms> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(multiclass_nms)
|
CLDNN_DECLARE_PRIMITIVE(multiclass_nms)
|
||||||
|
|
||||||
|
multiclass_nms() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
enum class sort_result_type : int32_t {
|
enum class sort_result_type : int32_t {
|
||||||
classid, // sort selected boxes by class id (ascending) in each batch element
|
classid, // sort selected boxes by class id (ascending) in each batch element
|
||||||
score, // sort selected boxes by score (descending) in each batch element
|
score, // sort selected boxes by score (descending) in each batch element
|
||||||
@ -79,6 +83,32 @@ struct multiclass_nms : public primitive_base<multiclass_nms> {
|
|||||||
attrs.normalized,
|
attrs.normalized,
|
||||||
attrs.nms_eta) {}
|
attrs.nms_eta) {}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const {
|
||||||
|
ob << make_data(&sort_result, sizeof(sort_result_type));
|
||||||
|
ob << sort_result_across_batch;
|
||||||
|
ob << make_data(&indices_output_type, sizeof(data_types));
|
||||||
|
ob << iou_threshold;
|
||||||
|
ob << score_threshold;
|
||||||
|
ob << nms_top_k;
|
||||||
|
ob << keep_top_k;
|
||||||
|
ob << background_class;
|
||||||
|
ob << normalized;
|
||||||
|
ob << nms_eta;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) {
|
||||||
|
ib >> make_data(&sort_result, sizeof(sort_result_type));
|
||||||
|
ib >> sort_result_across_batch;
|
||||||
|
ib >> make_data(&indices_output_type, sizeof(data_types));
|
||||||
|
ib >> iou_threshold;
|
||||||
|
ib >> score_threshold;
|
||||||
|
ib >> nms_top_k;
|
||||||
|
ib >> keep_top_k;
|
||||||
|
ib >> background_class;
|
||||||
|
ib >> normalized;
|
||||||
|
ib >> nms_eta;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static sort_result_type from(const ngraph::op::util::MulticlassNmsBase::SortResultType sort_result_type) {
|
static sort_result_type from(const ngraph::op::util::MulticlassNmsBase::SortResultType sort_result_type) {
|
||||||
switch (sort_result_type) {
|
switch (sort_result_type) {
|
||||||
@ -162,6 +192,22 @@ struct multiclass_nms : public primitive_base<multiclass_nms> {
|
|||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<multiclass_nms>::save(ob);
|
||||||
|
ob << output_selected_indices;
|
||||||
|
ob << output_selected_num;
|
||||||
|
ob << attrs;
|
||||||
|
ob << has_roisnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<multiclass_nms>::load(ib);
|
||||||
|
ib >> output_selected_indices;
|
||||||
|
ib >> output_selected_num;
|
||||||
|
ib >> attrs;
|
||||||
|
ib >> has_roisnum;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
|
@ -16,6 +16,10 @@ namespace cldnn {
|
|||||||
struct mutable_data : public primitive_base<mutable_data> {
|
struct mutable_data : public primitive_base<mutable_data> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(mutable_data)
|
CLDNN_DECLARE_PRIMITIVE(mutable_data)
|
||||||
|
|
||||||
|
mutable_data() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Enum type to specify function for data filling.
|
/// @brief Enum type to specify function for data filling.
|
||||||
enum filler_type { no_fill, zero, one, xavier };
|
enum filler_type { no_fill, zero, one, xavier };
|
||||||
|
|
||||||
@ -53,5 +57,15 @@ struct mutable_data : public primitive_base<mutable_data> {
|
|||||||
seed = hash_combine(seed, id);
|
seed = hash_combine(seed, id);
|
||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<mutable_data>::save(ob);
|
||||||
|
ob << make_data(&fill_type, sizeof(filler_type));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<mutable_data>::load(ib);
|
||||||
|
ib >> make_data(&fill_type, sizeof(filler_type));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -12,6 +12,10 @@ namespace cldnn {
|
|||||||
struct mvn : public primitive_base<mvn> {
|
struct mvn : public primitive_base<mvn> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(mvn)
|
CLDNN_DECLARE_PRIMITIVE(mvn)
|
||||||
|
|
||||||
|
mvn() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs mvn primitive.
|
/// @brief Constructs mvn primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -62,6 +66,22 @@ struct mvn : public primitive_base<mvn> {
|
|||||||
reduction_axes == rhs_casted.reduction_axes;
|
reduction_axes == rhs_casted.reduction_axes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<mvn>::save(ob);
|
||||||
|
ob << normalize_variance;
|
||||||
|
ob << epsilon;
|
||||||
|
ob << eps_inside_sqrt;
|
||||||
|
ob << reduction_axes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<mvn>::load(ib);
|
||||||
|
ib >> normalize_variance;
|
||||||
|
ib >> epsilon;
|
||||||
|
ib >> eps_inside_sqrt;
|
||||||
|
ib >> reduction_axes;
|
||||||
|
}
|
||||||
|
|
||||||
bool across_channels() const {
|
bool across_channels() const {
|
||||||
int64_t channel_axis = 1;
|
int64_t channel_axis = 1;
|
||||||
if (std::find(reduction_axes.begin(), reduction_axes.end(), channel_axis) != reduction_axes.end()) {
|
if (std::find(reduction_axes.begin(), reduction_axes.end(), channel_axis) != reduction_axes.end()) {
|
||||||
|
@ -122,6 +122,7 @@ struct non_max_suppression : public primitive_base<non_max_suppression> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void save(BinaryOutputBuffer& ob) const override {
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<non_max_suppression>::save(ob);
|
||||||
ob << selected_indices_num;
|
ob << selected_indices_num;
|
||||||
ob << center_point_box;
|
ob << center_point_box;
|
||||||
ob << sort_result_descending;
|
ob << sort_result_descending;
|
||||||
@ -134,6 +135,7 @@ struct non_max_suppression : public primitive_base<non_max_suppression> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void load(BinaryInputBuffer& ib) override {
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<non_max_suppression>::load(ib);
|
||||||
ib >> selected_indices_num;
|
ib >> selected_indices_num;
|
||||||
ib >> center_point_box;
|
ib >> center_point_box;
|
||||||
ib >> sort_result_descending;
|
ib >> sort_result_descending;
|
||||||
|
@ -11,6 +11,10 @@ namespace cldnn {
|
|||||||
struct count_nonzero : public primitive_base<count_nonzero> {
|
struct count_nonzero : public primitive_base<count_nonzero> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(count_nonzero)
|
CLDNN_DECLARE_PRIMITIVE(count_nonzero)
|
||||||
|
|
||||||
|
count_nonzero() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs count_nonzero primitive.
|
/// @brief Constructs count_nonzero primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param data Input data primitive id.
|
/// @param data Input data primitive id.
|
||||||
@ -27,6 +31,10 @@ struct count_nonzero : public primitive_base<count_nonzero> {
|
|||||||
struct gather_nonzero : public primitive_base<gather_nonzero> {
|
struct gather_nonzero : public primitive_base<gather_nonzero> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(gather_nonzero)
|
CLDNN_DECLARE_PRIMITIVE(gather_nonzero)
|
||||||
|
|
||||||
|
gather_nonzero() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs gather_nonzero primitive.
|
/// @brief Constructs gather_nonzero primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param data Input data primitive id.
|
/// @param data Input data primitive id.
|
||||||
|
@ -27,6 +27,10 @@ namespace cldnn {
|
|||||||
struct normalize : public primitive_base<normalize> {
|
struct normalize : public primitive_base<normalize> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(normalize)
|
CLDNN_DECLARE_PRIMITIVE(normalize)
|
||||||
|
|
||||||
|
normalize() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs normalize primitive.
|
/// @brief Constructs normalize primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -72,6 +76,20 @@ struct normalize : public primitive_base<normalize> {
|
|||||||
epsilon == rhs_casted.epsilon;
|
epsilon == rhs_casted.epsilon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<normalize>::save(ob);
|
||||||
|
ob << scale_input;
|
||||||
|
ob << across_spatial;
|
||||||
|
ob << epsilon;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<normalize>::load(ib);
|
||||||
|
ib >> scale_input;
|
||||||
|
ib >> across_spatial;
|
||||||
|
ib >> epsilon;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override { return {scale_input}; }
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override { return {scale_input}; }
|
||||||
};
|
};
|
||||||
|
@ -33,6 +33,10 @@ namespace cldnn {
|
|||||||
struct one_hot : public primitive_base<one_hot> {
|
struct one_hot : public primitive_base<one_hot> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(one_hot)
|
CLDNN_DECLARE_PRIMITIVE(one_hot)
|
||||||
|
|
||||||
|
one_hot() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs one-hot primitive layer.
|
/// @brief Constructs one-hot primitive layer.
|
||||||
/// @param id An identifier of new primitive.
|
/// @param id An identifier of new primitive.
|
||||||
/// @param input An identifier of primitive which is an input for newly created one-hot primitive.
|
/// @param input An identifier of primitive which is an input for newly created one-hot primitive.
|
||||||
@ -107,5 +111,23 @@ struct one_hot : public primitive_base<one_hot> {
|
|||||||
on_value == rhs_casted.on_value &&
|
on_value == rhs_casted.on_value &&
|
||||||
off_value == rhs_casted.off_value;
|
off_value == rhs_casted.off_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<one_hot>::save(ob);
|
||||||
|
ob << shape;
|
||||||
|
ob << one_hot_axis;
|
||||||
|
ob << depth;
|
||||||
|
ob << on_value;
|
||||||
|
ob << off_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<one_hot>::load(ib);
|
||||||
|
ib >> shape;
|
||||||
|
ib >> one_hot_axis;
|
||||||
|
ib >> depth;
|
||||||
|
ib >> on_value;
|
||||||
|
ib >> off_value;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -19,6 +19,10 @@ namespace cldnn {
|
|||||||
struct permute : public primitive_base<permute> {
|
struct permute : public primitive_base<permute> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(permute)
|
CLDNN_DECLARE_PRIMITIVE(permute)
|
||||||
|
|
||||||
|
permute() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs permute primitive.
|
/// @brief Constructs permute primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -46,5 +50,15 @@ struct permute : public primitive_base<permute> {
|
|||||||
|
|
||||||
return permute_order == rhs_casted.permute_order;
|
return permute_order == rhs_casted.permute_order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<permute>::save(ob);
|
||||||
|
ob << permute_order;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<permute>::load(ib);
|
||||||
|
ib >> permute_order;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -32,6 +32,10 @@ enum class pooling_mode : int32_t {
|
|||||||
struct pooling : public primitive_base<pooling> {
|
struct pooling : public primitive_base<pooling> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(pooling)
|
CLDNN_DECLARE_PRIMITIVE(pooling)
|
||||||
|
|
||||||
|
pooling() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs pooling primitive.
|
/// @brief Constructs pooling primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -198,6 +202,42 @@ struct pooling : public primitive_base<pooling> {
|
|||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<pooling>::save(ob);
|
||||||
|
ob << indices_output;
|
||||||
|
ob << make_data(&mode, sizeof(pooling_mode));
|
||||||
|
ob << size;
|
||||||
|
ob << stride;
|
||||||
|
ob << dilation;
|
||||||
|
ob << pads_begin;
|
||||||
|
ob << pads_end;
|
||||||
|
ob << make_data(&auto_pad, sizeof(ov::op::PadType));
|
||||||
|
ob << make_data(&rounding_type, sizeof(ov::op::RoundingType));
|
||||||
|
ob << axis;
|
||||||
|
ob << with_output_size;
|
||||||
|
ob << output_size;
|
||||||
|
ob << make_data(&index_element_type, sizeof(data_types));
|
||||||
|
ob << maxPoolOpset8Features;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<pooling>::load(ib);
|
||||||
|
ib >> indices_output;
|
||||||
|
ib >> make_data(&mode, sizeof(pooling_mode));;
|
||||||
|
ib >> size;
|
||||||
|
ib >> stride;
|
||||||
|
ib >> dilation;
|
||||||
|
ib >> pads_begin;
|
||||||
|
ib >> pads_end;
|
||||||
|
ib >> make_data(&auto_pad, sizeof(ov::op::PadType));
|
||||||
|
ib >> make_data(&rounding_type, sizeof(ov::op::RoundingType));
|
||||||
|
ib >> axis;
|
||||||
|
ib >> with_output_size;
|
||||||
|
ib >> output_size;
|
||||||
|
ib >> make_data(&index_element_type, sizeof(data_types));
|
||||||
|
ib >> maxPoolOpset8Features;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
|
||||||
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
std::vector<std::reference_wrapper<const primitive_id>> ret;
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "intel_gpu/graph/serialization/binary_buffer.hpp"
|
#include "intel_gpu/graph/serialization/binary_buffer.hpp"
|
||||||
|
#include "intel_gpu/graph/serialization/layout_serializer.hpp"
|
||||||
|
#include "intel_gpu/graph/serialization/set_serializer.hpp"
|
||||||
|
#include "intel_gpu/graph/serialization/string_serializer.hpp"
|
||||||
|
#include "intel_gpu/graph/serialization/tensor_serializer.hpp"
|
||||||
|
#include "intel_gpu/graph/serialization/vector_serializer.hpp"
|
||||||
#include "intel_gpu/runtime/compounds.hpp"
|
#include "intel_gpu/runtime/compounds.hpp"
|
||||||
#include "intel_gpu/runtime/layout.hpp"
|
#include "intel_gpu/runtime/layout.hpp"
|
||||||
#include "intel_gpu/runtime/optionals.hpp"
|
#include "intel_gpu/runtime/optionals.hpp"
|
||||||
@ -55,6 +60,34 @@ struct input_info {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const {
|
||||||
|
ob << pid;
|
||||||
|
ob << idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) {
|
||||||
|
ib >> pid;
|
||||||
|
ib >> idx;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct prim_map_storage {
|
||||||
|
static prim_map_storage& instance() {
|
||||||
|
static prim_map_storage instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cldnn::primitive_type_id get_type_id(const std::string& type_string) const {
|
||||||
|
return map.at(type_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool set_type_id(const std::string& type_string, const cldnn::primitive_type_id type_id) {
|
||||||
|
return map.insert({type_string, type_id}).second;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unordered_map<std::string, cldnn::primitive_type_id> map;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Base class of network primitive description.
|
/// @brief Base class of network primitive description.
|
||||||
@ -171,8 +204,49 @@ public:
|
|||||||
size_t num_outputs;
|
size_t num_outputs;
|
||||||
|
|
||||||
virtual std::string get_type() const { return "NONE"; }
|
virtual std::string get_type() const { return "NONE"; }
|
||||||
virtual void save(BinaryOutputBuffer& ob) const { }
|
virtual void save(BinaryOutputBuffer& ob) const {
|
||||||
virtual void load(BinaryInputBuffer& ib) { }
|
ob << type_string();
|
||||||
|
ob << id;
|
||||||
|
ob << origin_op_name;
|
||||||
|
ob << origin_op_type_name;
|
||||||
|
ob << output_paddings;
|
||||||
|
ob << output_data_types.size();
|
||||||
|
for (auto& output_data_type : output_data_types) {
|
||||||
|
if (output_data_type.has_value()) {
|
||||||
|
ob << true;
|
||||||
|
ob << make_data(&output_data_type.value(), sizeof(data_types));
|
||||||
|
} else {
|
||||||
|
ob << false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ob << input;
|
||||||
|
ob << num_outputs;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void load(BinaryInputBuffer& ib) {
|
||||||
|
std::string type_str;
|
||||||
|
ib >> type_str;
|
||||||
|
*const_cast<primitive_type_id*>(&type) = prim_map_storage::instance().get_type_id(type_str);
|
||||||
|
ib >> *const_cast<primitive_id*>(&id);
|
||||||
|
ib >> origin_op_name;
|
||||||
|
ib >> origin_op_type_name;
|
||||||
|
ib >> output_paddings;
|
||||||
|
size_t output_data_types_size;
|
||||||
|
ib >> output_data_types_size;
|
||||||
|
for (size_t i = 0; i < output_data_types_size; i++) {
|
||||||
|
bool has_value;
|
||||||
|
ib >> has_value;
|
||||||
|
if (has_value) {
|
||||||
|
data_types data_type;
|
||||||
|
ib >> make_data(&data_type, sizeof(data_types));
|
||||||
|
output_data_types.emplace_back(optional_data_type(data_type));
|
||||||
|
} else {
|
||||||
|
output_data_types.emplace_back(optional_data_type());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ib >> input;
|
||||||
|
ib >> num_outputs;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const { return {}; }
|
virtual std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const { return {}; }
|
||||||
@ -248,22 +322,4 @@ struct primitive_info {
|
|||||||
return &instance; \
|
return &instance; \
|
||||||
} \
|
} \
|
||||||
bool _##PType##_added_ = prim_map_storage::instance().set_type_id(#PType, PType::type_id());
|
bool _##PType##_added_ = prim_map_storage::instance().set_type_id(#PType, PType::type_id());
|
||||||
|
|
||||||
struct prim_map_storage {
|
|
||||||
static prim_map_storage& instance() {
|
|
||||||
static prim_map_storage instance;
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cldnn::primitive_type_id get_type_id(const std::string& type_string) const {
|
|
||||||
return map.at(type_string);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool set_type_id(const std::string& type_string, const cldnn::primitive_type_id type_id) {
|
|
||||||
return map.insert({type_string, type_id}).second;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unordered_map<std::string, cldnn::primitive_type_id> map;
|
|
||||||
};
|
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -19,6 +19,10 @@ namespace cldnn {
|
|||||||
struct prior_box : public primitive_base<prior_box> {
|
struct prior_box : public primitive_base<prior_box> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(prior_box)
|
CLDNN_DECLARE_PRIMITIVE(prior_box)
|
||||||
|
|
||||||
|
prior_box() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs prior-box primitive.
|
/// @brief Constructs prior-box primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -235,6 +239,56 @@ struct prior_box : public primitive_base<prior_box> {
|
|||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<prior_box>::save(ob);
|
||||||
|
ob << output_size;
|
||||||
|
ob << img_size;
|
||||||
|
ob << min_sizes;
|
||||||
|
ob << max_sizes;
|
||||||
|
ob << aspect_ratios;
|
||||||
|
ob << flip;
|
||||||
|
ob << clip;
|
||||||
|
ob << variance;
|
||||||
|
ob << step_width;
|
||||||
|
ob << step_height;
|
||||||
|
ob << offset;
|
||||||
|
ob << scale_all_sizes;
|
||||||
|
ob << fixed_ratio;
|
||||||
|
ob << fixed_size;
|
||||||
|
ob << density;
|
||||||
|
ob << support_opset8;
|
||||||
|
ob << step;
|
||||||
|
ob << min_max_aspect_ratios_order;
|
||||||
|
ob << widths;
|
||||||
|
ob << heights;
|
||||||
|
ob << clustered;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<prior_box>::load(ib);
|
||||||
|
ib >> output_size;
|
||||||
|
ib >> img_size;
|
||||||
|
ib >> min_sizes;
|
||||||
|
ib >> max_sizes;
|
||||||
|
ib >> aspect_ratios;
|
||||||
|
ib >> flip;
|
||||||
|
ib >> clip;
|
||||||
|
ib >> variance;
|
||||||
|
ib >> step_width;
|
||||||
|
ib >> step_height;
|
||||||
|
ib >> offset;
|
||||||
|
ib >> scale_all_sizes;
|
||||||
|
ib >> fixed_ratio;
|
||||||
|
ib >> fixed_size;
|
||||||
|
ib >> density;
|
||||||
|
ib >> support_opset8;
|
||||||
|
ib >> step;
|
||||||
|
ib >> min_max_aspect_ratios_order;
|
||||||
|
ib >> widths;
|
||||||
|
ib >> heights;
|
||||||
|
ib >> clustered;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool clustered;
|
bool clustered;
|
||||||
|
|
||||||
|
@ -235,6 +235,7 @@ struct proposal : public primitive_base<proposal> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void save(BinaryOutputBuffer& ob) const override {
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<proposal>::save(ob);
|
||||||
ob << max_proposals;
|
ob << max_proposals;
|
||||||
ob << iou_threshold;
|
ob << iou_threshold;
|
||||||
ob << base_bbox_size;
|
ob << base_bbox_size;
|
||||||
@ -258,6 +259,7 @@ struct proposal : public primitive_base<proposal> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void load(BinaryInputBuffer& ib) override {
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<proposal>::load(ib);
|
||||||
ib >> max_proposals;
|
ib >> max_proposals;
|
||||||
ib >> iou_threshold;
|
ib >> iou_threshold;
|
||||||
ib >> base_bbox_size;
|
ib >> base_bbox_size;
|
||||||
|
@ -24,6 +24,10 @@ namespace cldnn {
|
|||||||
struct pyramid_roi_align : public primitive_base<pyramid_roi_align> {
|
struct pyramid_roi_align : public primitive_base<pyramid_roi_align> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(pyramid_roi_align)
|
CLDNN_DECLARE_PRIMITIVE(pyramid_roi_align)
|
||||||
|
|
||||||
|
pyramid_roi_align() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param rois Input RoI boxes as tuple [x1, y1, x2, y2] describing two opposite corners of the region.
|
/// @param rois Input RoI boxes as tuple [x1, y1, x2, y2] describing two opposite corners of the region.
|
||||||
/// @param P2 First level of the image pyramid.
|
/// @param P2 First level of the image pyramid.
|
||||||
@ -78,5 +82,21 @@ struct pyramid_roi_align : public primitive_base<pyramid_roi_align> {
|
|||||||
pyramid_scales == rhs_casted.pyramid_scales &&
|
pyramid_scales == rhs_casted.pyramid_scales &&
|
||||||
pyramid_starting_level == rhs_casted.pyramid_starting_level;
|
pyramid_starting_level == rhs_casted.pyramid_starting_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<pyramid_roi_align>::save(ob);
|
||||||
|
ob << output_size;
|
||||||
|
ob << sampling_ratio;
|
||||||
|
ob << pyramid_scales;
|
||||||
|
ob << pyramid_starting_level;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<pyramid_roi_align>::load(ib);
|
||||||
|
ib >> output_size;
|
||||||
|
ib >> sampling_ratio;
|
||||||
|
ib >> pyramid_scales;
|
||||||
|
ib >> pyramid_starting_level;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -125,6 +125,7 @@ struct quantize : public primitive_base<quantize> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void save(BinaryOutputBuffer& ob) const override {
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<quantize>::save(ob);
|
||||||
ob << levels;
|
ob << levels;
|
||||||
ob << scale_shift_opt;
|
ob << scale_shift_opt;
|
||||||
ob << need_post_scale;
|
ob << need_post_scale;
|
||||||
@ -150,6 +151,7 @@ struct quantize : public primitive_base<quantize> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void load(BinaryInputBuffer& ib) override {
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<quantize>::load(ib);
|
||||||
ib >> levels;
|
ib >> levels;
|
||||||
ib >> scale_shift_opt;
|
ib >> scale_shift_opt;
|
||||||
ib >> need_post_scale;
|
ib >> need_post_scale;
|
||||||
|
@ -17,6 +17,14 @@ namespace cldnn {
|
|||||||
struct random_uniform : public primitive_base<random_uniform> {
|
struct random_uniform : public primitive_base<random_uniform> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(random_uniform)
|
CLDNN_DECLARE_PRIMITIVE(random_uniform)
|
||||||
|
|
||||||
|
random_uniform() : primitive_base("", {}),
|
||||||
|
global_seed(0),
|
||||||
|
op_seed(0),
|
||||||
|
output_shape{},
|
||||||
|
output_format(format::type::any) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct Random Uniform privitive.
|
* Construct Random Uniform privitive.
|
||||||
* @param id primitive id
|
* @param id primitive id
|
||||||
@ -59,6 +67,24 @@ struct random_uniform : public primitive_base<random_uniform> {
|
|||||||
return global_seed == rhs_casted.global_seed &&
|
return global_seed == rhs_casted.global_seed &&
|
||||||
op_seed == rhs_casted.op_seed;
|
op_seed == rhs_casted.op_seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<random_uniform>::save(ob);
|
||||||
|
ob << global_seed;
|
||||||
|
ob << op_seed;
|
||||||
|
ob << output_shape;
|
||||||
|
ob << make_data(&output_format.value, sizeof(format::type));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<random_uniform>::load(ib);
|
||||||
|
ib >> *const_cast<uint64_t*>(&global_seed);
|
||||||
|
ib >> *const_cast<uint64_t*>(&op_seed);
|
||||||
|
ib >> *const_cast<tensor*>(&output_shape);
|
||||||
|
format::type tmp_type;
|
||||||
|
ib >> make_data(&tmp_type, sizeof(format::type));
|
||||||
|
*const_cast<format*>(&output_format) = format(tmp_type);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -10,6 +10,10 @@ namespace cldnn {
|
|||||||
struct range: public primitive_base<range> {
|
struct range: public primitive_base<range> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(range)
|
CLDNN_DECLARE_PRIMITIVE(range)
|
||||||
|
|
||||||
|
range() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs range primitive.
|
/// @brief Constructs range primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param inputs Input primitive id vector.
|
/// @param inputs Input primitive id vector.
|
||||||
@ -33,5 +37,15 @@ struct range: public primitive_base<range> {
|
|||||||
bool operator==(const primitive& rhs) const override {
|
bool operator==(const primitive& rhs) const override {
|
||||||
return compare_common_params(rhs);
|
return compare_common_params(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<range>::save(ob);
|
||||||
|
ob << output_layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<range>::load(ib);
|
||||||
|
ib >> output_layout;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -15,6 +15,10 @@ namespace cldnn {
|
|||||||
struct read_value : public primitive_base<read_value> {
|
struct read_value : public primitive_base<read_value> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(read_value)
|
CLDNN_DECLARE_PRIMITIVE(read_value)
|
||||||
|
|
||||||
|
read_value() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs ReadValue primitive.
|
/// @brief Constructs ReadValue primitive.
|
||||||
/// @param id This primitive id
|
/// @param id This primitive id
|
||||||
/// @param inputs Input parameters ids
|
/// @param inputs Input parameters ids
|
||||||
@ -39,5 +43,17 @@ struct read_value : public primitive_base<read_value> {
|
|||||||
|
|
||||||
return variable_id == rhs_casted.variable_id;
|
return variable_id == rhs_casted.variable_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<read_value>::save(ob);
|
||||||
|
ob << variable_id;
|
||||||
|
ob << output_layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<read_value>::load(ib);
|
||||||
|
ib >> variable_id;
|
||||||
|
ib >> output_layout;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -42,6 +42,10 @@ enum class reduce_mode : uint16_t {
|
|||||||
struct reduce : public primitive_base<reduce> {
|
struct reduce : public primitive_base<reduce> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(reduce)
|
CLDNN_DECLARE_PRIMITIVE(reduce)
|
||||||
|
|
||||||
|
reduce() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs reduce primitive
|
/// @brief Constructs reduce primitive
|
||||||
/// @param id This primitive id
|
/// @param id This primitive id
|
||||||
/// @param input Input primitive id
|
/// @param input Input primitive id
|
||||||
@ -79,5 +83,19 @@ struct reduce : public primitive_base<reduce> {
|
|||||||
axes == rhs_casted.axes &&
|
axes == rhs_casted.axes &&
|
||||||
keep_dims == rhs_casted.keep_dims;
|
keep_dims == rhs_casted.keep_dims;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<reduce>::save(ob);
|
||||||
|
ob << make_data(&mode, sizeof(reduce_mode));
|
||||||
|
ob << axes;
|
||||||
|
ob << keep_dims;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<reduce>::load(ib);
|
||||||
|
ib >> make_data(&mode, sizeof(reduce_mode));
|
||||||
|
ib >> axes;
|
||||||
|
ib >> keep_dims;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -14,6 +14,10 @@ namespace cldnn {
|
|||||||
struct region_yolo : public primitive_base<region_yolo> {
|
struct region_yolo : public primitive_base<region_yolo> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(region_yolo)
|
CLDNN_DECLARE_PRIMITIVE(region_yolo)
|
||||||
|
|
||||||
|
region_yolo() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs region_yolo primitive.
|
/// @brief Constructs region_yolo primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -64,6 +68,24 @@ struct region_yolo : public primitive_base<region_yolo> {
|
|||||||
mask_size == rhs_casted.mask_size &&
|
mask_size == rhs_casted.mask_size &&
|
||||||
do_softmax == rhs_casted.do_softmax;
|
do_softmax == rhs_casted.do_softmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<region_yolo>::save(ob);
|
||||||
|
ob << coords;
|
||||||
|
ob << classes;
|
||||||
|
ob << num;
|
||||||
|
ob << mask_size;
|
||||||
|
ob << do_softmax;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<region_yolo>::load(ib);
|
||||||
|
ib >> coords;
|
||||||
|
ib >> classes;
|
||||||
|
ib >> num;
|
||||||
|
ib >> mask_size;
|
||||||
|
ib >> do_softmax;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -187,6 +187,7 @@ struct reorder : public primitive_base<reorder> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void save(BinaryOutputBuffer& ob) const override {
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<reorder>::save(ob);
|
||||||
ob << make_data(&output_format, sizeof(format));
|
ob << make_data(&output_format, sizeof(format));
|
||||||
ob << mean;
|
ob << mean;
|
||||||
ob << subtract_per_feature;
|
ob << subtract_per_feature;
|
||||||
@ -196,6 +197,7 @@ struct reorder : public primitive_base<reorder> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void load(BinaryInputBuffer& ib) override {
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<reorder>::load(ib);
|
||||||
ib >> make_data(&output_format, sizeof(format));
|
ib >> make_data(&output_format, sizeof(format));
|
||||||
ib >> mean;
|
ib >> mean;
|
||||||
ib >> subtract_per_feature;
|
ib >> subtract_per_feature;
|
||||||
|
@ -14,6 +14,10 @@ namespace cldnn {
|
|||||||
struct reorg_yolo : public primitive_base<reorg_yolo> {
|
struct reorg_yolo : public primitive_base<reorg_yolo> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(reorg_yolo)
|
CLDNN_DECLARE_PRIMITIVE(reorg_yolo)
|
||||||
|
|
||||||
|
reorg_yolo() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs region_yolo primitive.
|
/// @brief Constructs region_yolo primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -43,6 +47,16 @@ struct reorg_yolo : public primitive_base<reorg_yolo> {
|
|||||||
|
|
||||||
return stride == rhs_casted.stride;
|
return stride == rhs_casted.stride;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<reorg_yolo>::save(ob);
|
||||||
|
ob << stride;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<reorg_yolo>::load(ib);
|
||||||
|
ib >> stride;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -15,6 +15,10 @@ namespace cldnn {
|
|||||||
struct resample : public primitive_base<resample> {
|
struct resample : public primitive_base<resample> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(resample)
|
CLDNN_DECLARE_PRIMITIVE(resample)
|
||||||
|
|
||||||
|
resample() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
using InterpolateOp = ov::op::v4::Interpolate;
|
using InterpolateOp = ov::op::v4::Interpolate;
|
||||||
|
|
||||||
/// @brief Constructs Resample primitive.
|
/// @brief Constructs Resample primitive.
|
||||||
@ -187,5 +191,39 @@ struct resample : public primitive_base<resample> {
|
|||||||
cmp_fields(round_mode);
|
cmp_fields(round_mode);
|
||||||
#undef cmp_fields
|
#undef cmp_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<resample>::save(ob);
|
||||||
|
ob << output_size;
|
||||||
|
ob << num_filter;
|
||||||
|
ob << sizes;
|
||||||
|
ob << scales;
|
||||||
|
ob << axes;
|
||||||
|
ob << pads_begin;
|
||||||
|
ob << pads_end;
|
||||||
|
ob << make_data(&operation_type, sizeof(InterpolateOp::InterpolateMode));
|
||||||
|
ob << make_data(&shape_calc_mode, sizeof(InterpolateOp::ShapeCalcMode));
|
||||||
|
ob << antialias;
|
||||||
|
ob << cube_coeff;
|
||||||
|
ob << make_data(&coord_trans_mode, sizeof(InterpolateOp::CoordinateTransformMode));
|
||||||
|
ob << make_data(&round_mode, sizeof(InterpolateOp::NearestMode));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<resample>::load(ib);
|
||||||
|
ib >> output_size;
|
||||||
|
ib >> num_filter;
|
||||||
|
ib >> sizes;
|
||||||
|
ib >> scales;
|
||||||
|
ib >> axes;
|
||||||
|
ib >> pads_begin;
|
||||||
|
ib >> pads_end;
|
||||||
|
ib >> make_data(&operation_type, sizeof(InterpolateOp::InterpolateMode));
|
||||||
|
ib >> make_data(&shape_calc_mode, sizeof(InterpolateOp::ShapeCalcMode));
|
||||||
|
ib >> antialias;
|
||||||
|
ib >> cube_coeff;
|
||||||
|
ib >> make_data(&coord_trans_mode, sizeof(InterpolateOp::CoordinateTransformMode));
|
||||||
|
ib >> make_data(&round_mode, sizeof(InterpolateOp::NearestMode));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -15,6 +15,10 @@ namespace cldnn {
|
|||||||
struct reshape : public primitive_base<reshape> {
|
struct reshape : public primitive_base<reshape> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(reshape)
|
CLDNN_DECLARE_PRIMITIVE(reshape)
|
||||||
|
|
||||||
|
reshape() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
enum reshape_mode : uint32_t {
|
enum reshape_mode : uint32_t {
|
||||||
base,
|
base,
|
||||||
squeeze,
|
squeeze,
|
||||||
@ -89,6 +93,24 @@ struct reshape : public primitive_base<reshape> {
|
|||||||
return special_zero == rhs_casted.special_zero &&
|
return special_zero == rhs_casted.special_zero &&
|
||||||
mode == rhs_casted.mode;
|
mode == rhs_casted.mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<reshape>::save(ob);
|
||||||
|
ob << output_shape;
|
||||||
|
ob << special_zero;
|
||||||
|
ob << output_pattern;
|
||||||
|
ob << output_partial_shape;
|
||||||
|
ob << make_data(&mode, sizeof(reshape_mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<reshape>::load(ib);
|
||||||
|
ib >> output_shape;
|
||||||
|
ib >> special_zero;
|
||||||
|
ib >> output_pattern;
|
||||||
|
ib >> output_partial_shape;
|
||||||
|
ib >> make_data(&mode, sizeof(reshape_mode));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -13,6 +13,10 @@ enum class reverse_mode : uint32_t { index, mask };
|
|||||||
struct reverse : public primitive_base<reverse> {
|
struct reverse : public primitive_base<reverse> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(reverse)
|
CLDNN_DECLARE_PRIMITIVE(reverse)
|
||||||
|
|
||||||
|
reverse() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs reverse primitive.
|
/// @brief Constructs reverse primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -42,5 +46,15 @@ struct reverse : public primitive_base<reverse> {
|
|||||||
|
|
||||||
return mode == rhs_casted.mode;
|
return mode == rhs_casted.mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<reverse>::save(ob);
|
||||||
|
ob << make_data(&mode, sizeof(reverse_mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<reverse>::load(ib);
|
||||||
|
ib >> make_data(&mode, sizeof(reverse_mode));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -13,6 +13,10 @@ namespace cldnn {
|
|||||||
struct reverse_sequence : public primitive_base<reverse_sequence> {
|
struct reverse_sequence : public primitive_base<reverse_sequence> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(reverse_sequence)
|
CLDNN_DECLARE_PRIMITIVE(reverse_sequence)
|
||||||
|
|
||||||
|
reverse_sequence() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs reverse_sequence primitive.
|
/// @brief Constructs reverse_sequence primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -68,5 +72,17 @@ struct reverse_sequence : public primitive_base<reverse_sequence> {
|
|||||||
return seq_axis == rhs_casted.seq_axis &&
|
return seq_axis == rhs_casted.seq_axis &&
|
||||||
batch_axis == rhs_casted.batch_axis;
|
batch_axis == rhs_casted.batch_axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<reverse_sequence>::save(ob);
|
||||||
|
ob << seq_axis;
|
||||||
|
ob << batch_axis;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<reverse_sequence>::load(ib);
|
||||||
|
ib >> seq_axis;
|
||||||
|
ib >> batch_axis;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -13,6 +13,10 @@ namespace cldnn {
|
|||||||
struct roi_align : public primitive_base<roi_align> {
|
struct roi_align : public primitive_base<roi_align> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(roi_align)
|
CLDNN_DECLARE_PRIMITIVE(roi_align)
|
||||||
|
|
||||||
|
roi_align() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Pooling mode for the @ref roi_align
|
/// @brief Pooling mode for the @ref roi_align
|
||||||
enum PoolingMode { max, avg };
|
enum PoolingMode { max, avg };
|
||||||
|
|
||||||
@ -82,5 +86,25 @@ struct roi_align : public primitive_base<roi_align> {
|
|||||||
pooling_mode == rhs_casted.pooling_mode &&
|
pooling_mode == rhs_casted.pooling_mode &&
|
||||||
aligned_mode == rhs_casted.aligned_mode;
|
aligned_mode == rhs_casted.aligned_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<roi_align>::save(ob);
|
||||||
|
ob << pooled_h;
|
||||||
|
ob << pooled_w;
|
||||||
|
ob << sampling_ratio;
|
||||||
|
ob << spatial_scale;
|
||||||
|
ob << make_data(&pooling_mode, sizeof(PoolingMode));
|
||||||
|
ob << make_data(&aligned_mode, sizeof(AlignedMode));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<roi_align>::load(ib);
|
||||||
|
ib >> pooled_h;
|
||||||
|
ib >> pooled_w;
|
||||||
|
ib >> sampling_ratio;
|
||||||
|
ib >> spatial_scale;
|
||||||
|
ib >> make_data(&pooling_mode, sizeof(PoolingMode));
|
||||||
|
ib >> make_data(&aligned_mode, sizeof(AlignedMode));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -136,6 +136,7 @@ struct roi_pooling : public primitive_base<roi_pooling> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void save(BinaryOutputBuffer& ob) const override {
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<roi_pooling>::save(ob);
|
||||||
ob << make_data(&mode, sizeof(pooling_mode));
|
ob << make_data(&mode, sizeof(pooling_mode));
|
||||||
ob << position_sensitive;
|
ob << position_sensitive;
|
||||||
ob << pooled_width;
|
ob << pooled_width;
|
||||||
@ -151,6 +152,7 @@ struct roi_pooling : public primitive_base<roi_pooling> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void load(BinaryInputBuffer& ib) override {
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<roi_pooling>::load(ib);
|
||||||
ib >> make_data(&mode, sizeof(pooling_mode));
|
ib >> make_data(&mode, sizeof(pooling_mode));
|
||||||
ib >> position_sensitive;
|
ib >> position_sensitive;
|
||||||
ib >> pooled_width;
|
ib >> pooled_width;
|
||||||
|
@ -13,6 +13,10 @@ namespace cldnn {
|
|||||||
struct roll : primitive_base<roll> {
|
struct roll : primitive_base<roll> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(roll)
|
CLDNN_DECLARE_PRIMITIVE(roll)
|
||||||
|
|
||||||
|
roll() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs roll primitive.
|
/// @brief Constructs roll primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -41,6 +45,16 @@ struct roll : primitive_base<roll> {
|
|||||||
|
|
||||||
return shift == rhs_casted.shift;
|
return shift == rhs_casted.shift;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<roll>::save(ob);
|
||||||
|
ob << shift;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<roll>::load(ib);
|
||||||
|
ib >> shift;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -12,6 +12,10 @@ namespace cldnn {
|
|||||||
struct scatter_elements_update : public primitive_base<scatter_elements_update> {
|
struct scatter_elements_update : public primitive_base<scatter_elements_update> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(scatter_elements_update)
|
CLDNN_DECLARE_PRIMITIVE(scatter_elements_update)
|
||||||
|
|
||||||
|
scatter_elements_update() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs scatter_elements_update primitive.
|
/// @brief Constructs scatter_elements_update primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param dict Input data primitive id.
|
/// @param dict Input data primitive id.
|
||||||
@ -43,5 +47,15 @@ struct scatter_elements_update : public primitive_base<scatter_elements_update>
|
|||||||
|
|
||||||
return axis == rhs_casted.axis;
|
return axis == rhs_casted.axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<scatter_elements_update>::save(ob);
|
||||||
|
ob << axis;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<scatter_elements_update>::load(ib);
|
||||||
|
ib >> axis;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -12,6 +12,10 @@ namespace cldnn {
|
|||||||
struct scatter_nd_update : public primitive_base<scatter_nd_update> {
|
struct scatter_nd_update : public primitive_base<scatter_nd_update> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(scatter_nd_update)
|
CLDNN_DECLARE_PRIMITIVE(scatter_nd_update)
|
||||||
|
|
||||||
|
scatter_nd_update() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs scatter_nd_update primitive.
|
/// @brief Constructs scatter_nd_update primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param dict Input data primitive id.
|
/// @param dict Input data primitive id.
|
||||||
@ -43,5 +47,15 @@ struct scatter_nd_update : public primitive_base<scatter_nd_update> {
|
|||||||
|
|
||||||
return indices_rank == rhs_casted.indices_rank;
|
return indices_rank == rhs_casted.indices_rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<scatter_nd_update>::save(ob);
|
||||||
|
ob << indices_rank;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<scatter_nd_update>::load(ib);
|
||||||
|
ib >> indices_rank;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -12,6 +12,10 @@ namespace cldnn {
|
|||||||
struct scatter_update : public primitive_base<scatter_update> {
|
struct scatter_update : public primitive_base<scatter_update> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(scatter_update)
|
CLDNN_DECLARE_PRIMITIVE(scatter_update)
|
||||||
|
|
||||||
|
scatter_update() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
enum scatter_update_axis {
|
enum scatter_update_axis {
|
||||||
along_b,
|
along_b,
|
||||||
along_f,
|
along_f,
|
||||||
@ -52,5 +56,15 @@ struct scatter_update : public primitive_base<scatter_update> {
|
|||||||
|
|
||||||
return axis == rhs_casted.axis;
|
return axis == rhs_casted.axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<scatter_update>::save(ob);
|
||||||
|
ob << axis;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<scatter_update>::load(ib);
|
||||||
|
ib >> axis;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -20,6 +20,10 @@ namespace cldnn {
|
|||||||
struct select : public primitive_base<select> {
|
struct select : public primitive_base<select> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(select)
|
CLDNN_DECLARE_PRIMITIVE(select)
|
||||||
|
|
||||||
|
select() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs select primitive.
|
/// @brief Constructs select primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param mask Input primitive id with values needed for select computation.
|
/// @param mask Input primitive id with values needed for select computation.
|
||||||
@ -49,5 +53,15 @@ struct select : public primitive_base<select> {
|
|||||||
|
|
||||||
return broadcast_spec == rhs_casted.broadcast_spec;
|
return broadcast_spec == rhs_casted.broadcast_spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<select>::save(ob);
|
||||||
|
ob << make_data(&broadcast_spec, sizeof(ov::op::AutoBroadcastSpec));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<select>::load(ib);
|
||||||
|
ib >> make_data(&broadcast_spec, sizeof(ov::op::AutoBroadcastSpec));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -12,6 +12,10 @@ namespace cldnn {
|
|||||||
struct shape_of : public primitive_base<shape_of> {
|
struct shape_of : public primitive_base<shape_of> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(shape_of)
|
CLDNN_DECLARE_PRIMITIVE(shape_of)
|
||||||
|
|
||||||
|
shape_of() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs shape_of primitive.
|
/// @brief Constructs shape_of primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -45,5 +49,15 @@ struct shape_of : public primitive_base<shape_of> {
|
|||||||
|
|
||||||
return output_rank == rhs_casted.output_rank;
|
return output_rank == rhs_casted.output_rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<shape_of>::save(ob);
|
||||||
|
ob << output_rank;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<shape_of>::load(ib);
|
||||||
|
ib >> output_rank;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -13,6 +13,10 @@ namespace cldnn {
|
|||||||
struct shuffle_channels : public primitive_base<shuffle_channels> {
|
struct shuffle_channels : public primitive_base<shuffle_channels> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(shuffle_channels)
|
CLDNN_DECLARE_PRIMITIVE(shuffle_channels)
|
||||||
|
|
||||||
|
shuffle_channels() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs shuffle_channels primitive.
|
/// @brief Constructs shuffle_channels primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input dictionary primitive id.
|
/// @param input Input dictionary primitive id.
|
||||||
@ -46,5 +50,17 @@ struct shuffle_channels : public primitive_base<shuffle_channels> {
|
|||||||
return group == rhs_casted.group &&
|
return group == rhs_casted.group &&
|
||||||
axis == rhs_casted.axis;
|
axis == rhs_casted.axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<shuffle_channels>::save(ob);
|
||||||
|
ob << group;
|
||||||
|
ob << axis;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<shuffle_channels>::load(ib);
|
||||||
|
ib >> group;
|
||||||
|
ib >> axis;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -12,6 +12,10 @@ namespace cldnn {
|
|||||||
struct slice : public primitive_base<slice> {
|
struct slice : public primitive_base<slice> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(slice)
|
CLDNN_DECLARE_PRIMITIVE(slice)
|
||||||
|
|
||||||
|
slice() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs slice primitive.
|
/// @brief Constructs slice primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param inputs List of primitive ids.
|
/// @param inputs List of primitive ids.
|
||||||
@ -28,5 +32,15 @@ struct slice : public primitive_base<slice> {
|
|||||||
bool operator==(const primitive& rhs) const override {
|
bool operator==(const primitive& rhs) const override {
|
||||||
return compare_common_params(rhs);
|
return compare_common_params(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<slice>::save(ob);
|
||||||
|
ob << output_shape;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<slice>::load(ib);
|
||||||
|
ib >> output_shape;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -18,6 +18,10 @@ namespace cldnn {
|
|||||||
struct softmax : public primitive_base<softmax> {
|
struct softmax : public primitive_base<softmax> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(softmax)
|
CLDNN_DECLARE_PRIMITIVE(softmax)
|
||||||
|
|
||||||
|
softmax() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs softmax primitive.
|
/// @brief Constructs softmax primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input primitive id.
|
/// @param input Input primitive id.
|
||||||
@ -53,5 +57,15 @@ struct softmax : public primitive_base<softmax> {
|
|||||||
|
|
||||||
return dimension == rhs_casted.dimension;
|
return dimension == rhs_casted.dimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<softmax>::save(ob);
|
||||||
|
ob << dimension;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<softmax>::load(ib);
|
||||||
|
ib >> dimension;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -36,6 +36,10 @@ namespace cldnn {
|
|||||||
struct space_to_batch : public primitive_base<space_to_batch> {
|
struct space_to_batch : public primitive_base<space_to_batch> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(space_to_batch)
|
CLDNN_DECLARE_PRIMITIVE(space_to_batch)
|
||||||
|
|
||||||
|
space_to_batch() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs space_to_batch primitive.
|
/// @brief Constructs space_to_batch primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input data primitive id.
|
/// @param input Input data primitive id.
|
||||||
@ -79,5 +83,21 @@ struct space_to_batch : public primitive_base<space_to_batch> {
|
|||||||
pads_begin == rhs_casted.pads_begin &&
|
pads_begin == rhs_casted.pads_begin &&
|
||||||
pads_end == rhs_casted.pads_end;
|
pads_end == rhs_casted.pads_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<space_to_batch>::save(ob);
|
||||||
|
ob << block_shape;
|
||||||
|
ob << pads_begin;
|
||||||
|
ob << pads_end;
|
||||||
|
ob << out_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<space_to_batch>::load(ib);
|
||||||
|
ib >> block_shape;
|
||||||
|
ib >> pads_begin;
|
||||||
|
ib >> pads_end;
|
||||||
|
ib >> out_size;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -42,6 +42,10 @@ namespace cldnn {
|
|||||||
struct space_to_depth : public primitive_base<space_to_depth> {
|
struct space_to_depth : public primitive_base<space_to_depth> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(space_to_depth)
|
CLDNN_DECLARE_PRIMITIVE(space_to_depth)
|
||||||
|
|
||||||
|
space_to_depth() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
enum depth_mode {
|
enum depth_mode {
|
||||||
depth_first,
|
depth_first,
|
||||||
blocks_first
|
blocks_first
|
||||||
@ -81,5 +85,17 @@ struct space_to_depth : public primitive_base<space_to_depth> {
|
|||||||
return mode == rhs_casted.mode &&
|
return mode == rhs_casted.mode &&
|
||||||
block_size == rhs_casted.block_size;
|
block_size == rhs_casted.block_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<space_to_depth>::save(ob);
|
||||||
|
ob << make_data(&mode, sizeof(depth_mode));
|
||||||
|
ob << block_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<space_to_depth>::load(ib);
|
||||||
|
ib >> make_data(&mode, sizeof(depth_mode));
|
||||||
|
ib >> block_size;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -14,6 +14,10 @@ namespace cldnn {
|
|||||||
struct strided_slice : public primitive_base<strided_slice> {
|
struct strided_slice : public primitive_base<strided_slice> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(strided_slice)
|
CLDNN_DECLARE_PRIMITIVE(strided_slice)
|
||||||
|
|
||||||
|
strided_slice() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs strided_slice primitive.
|
/// @brief Constructs strided_slice primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Input data primitive id.
|
/// @param input Input data primitive id.
|
||||||
@ -127,5 +131,31 @@ struct strided_slice : public primitive_base<strided_slice> {
|
|||||||
shrink_axis_mask == rhs_casted.shrink_axis_mask &&
|
shrink_axis_mask == rhs_casted.shrink_axis_mask &&
|
||||||
ellipsis_mask == rhs_casted.ellipsis_mask;
|
ellipsis_mask == rhs_casted.ellipsis_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<strided_slice>::save(ob);
|
||||||
|
ob << begin;
|
||||||
|
ob << end;
|
||||||
|
ob << strides;
|
||||||
|
ob << begin_mask;
|
||||||
|
ob << end_mask;
|
||||||
|
ob << new_axis_mask;
|
||||||
|
ob << shrink_axis_mask;
|
||||||
|
ob << ellipsis_mask;
|
||||||
|
ob << out_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<strided_slice>::load(ib);
|
||||||
|
ib >> begin;
|
||||||
|
ib >> end;
|
||||||
|
ib >> strides;
|
||||||
|
ib >> begin_mask;
|
||||||
|
ib >> end_mask;
|
||||||
|
ib >> new_axis_mask;
|
||||||
|
ib >> shrink_axis_mask;
|
||||||
|
ib >> ellipsis_mask;
|
||||||
|
ib >> out_size;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -12,6 +12,10 @@ namespace cldnn {
|
|||||||
struct tile : public primitive_base<tile> {
|
struct tile : public primitive_base<tile> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(tile)
|
CLDNN_DECLARE_PRIMITIVE(tile)
|
||||||
|
|
||||||
|
tile() : primitive_base("", {}) {}
|
||||||
|
|
||||||
|
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||||
|
|
||||||
/// @brief Constructs tile primitive with static input.
|
/// @brief Constructs tile primitive with static input.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param repeats Per-dimension replication factor.
|
/// @param repeats Per-dimension replication factor.
|
||||||
@ -47,5 +51,15 @@ struct tile : public primitive_base<tile> {
|
|||||||
|
|
||||||
return repeats == rhs_casted.repeats;
|
return repeats == rhs_casted.repeats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const override {
|
||||||
|
primitive_base<tile>::save(ob);
|
||||||
|
ob << repeats;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) override {
|
||||||
|
primitive_base<tile>::load(ib);
|
||||||
|
ib >> repeats;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
#include <openvino/core/partial_shape.hpp>
|
#include <openvino/core/partial_shape.hpp>
|
||||||
#include <openvino/core/type/element_type.hpp>
|
#include <openvino/core/type/element_type.hpp>
|
||||||
|
|
||||||
|
#include "intel_gpu/graph/serialization/binary_buffer.hpp"
|
||||||
|
#include "intel_gpu/graph/serialization/vector_serializer.hpp"
|
||||||
|
|
||||||
namespace cldnn {
|
namespace cldnn {
|
||||||
/// @addtogroup cpp_api C++ API
|
/// @addtogroup cpp_api C++ API
|
||||||
/// @{
|
/// @{
|
||||||
@ -357,6 +360,24 @@ struct padding {
|
|||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save(BinaryOutputBuffer& ob) const {
|
||||||
|
ob << _lower_size.sizes();
|
||||||
|
ob << _upper_size.sizes();
|
||||||
|
ob << _filling_value;
|
||||||
|
ob << _dynamic_pad_dims.sizes();
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(BinaryInputBuffer& ib) {
|
||||||
|
std::vector<tensor::value_type> sizes;
|
||||||
|
ib >> sizes;
|
||||||
|
_lower_size = tensor(sizes);
|
||||||
|
ib >> sizes;
|
||||||
|
_upper_size = tensor(sizes);
|
||||||
|
ib >> _filling_value;
|
||||||
|
ib >> sizes;
|
||||||
|
_dynamic_pad_dims = tensor(sizes);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
tensor _lower_size; ///< Lower padding sizes. For spatials, it means size of left (X) and top (Y) padding.
|
tensor _lower_size; ///< Lower padding sizes. For spatials, it means size of left (X) and top (Y) padding.
|
||||||
tensor _upper_size; ///< Upper padding sizes. For spatials, it means size of right (X) and bottom (Y) padding.
|
tensor _upper_size; ///< Upper padding sizes. For spatials, it means size of right (X) and bottom (Y) padding.
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "register.hpp"
|
#include "register.hpp"
|
||||||
#include "mutable_data_inst.h"
|
#include "mutable_data_inst.h"
|
||||||
#include "input_layout_inst.h"
|
#include "input_layout_inst.h"
|
||||||
#include "intel_gpu/graph/serialization/loop_serializer.hpp"
|
|
||||||
#include "intel_gpu/runtime/error_handler.hpp"
|
#include "intel_gpu/runtime/error_handler.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -78,3 +78,5 @@ attach_prior_box_common::attach_prior_box_common() {
|
|||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
|
||||||
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::common::wait_for_events_impl)
|
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::common::wait_for_events_impl)
|
||||||
|
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::data)
|
||||||
|
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::input_layout)
|
||||||
|
@ -81,3 +81,4 @@ attach_assign_impl::attach_assign_impl() {
|
|||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
|
||||||
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::cpu::assign_impl)
|
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::cpu::assign_impl)
|
||||||
|
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::assign)
|
||||||
|
@ -81,3 +81,4 @@ attach_read_value_impl::attach_read_value_impl() {
|
|||||||
} // namespace cldnn
|
} // namespace cldnn
|
||||||
|
|
||||||
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::cpu::read_value_impl)
|
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::cpu::read_value_impl)
|
||||||
|
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::read_value)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user