@@ -39,52 +39,36 @@ typedef ov::RemoteContext OVRemoteContext;
3939#endif
4040
4141struct ParameterShape {
42- using onnx_shape_t = std::vector<int64_t >;
42+ using ort_shape_t = std::vector<int64_t >;
4343
44- private:
45- onnx_shape_t onnx_;
46- ov::PartialShape ov_;
47-
48- public:
49- static ov::PartialShape ToOvPartialShape (const onnx_shape_t & onnx_shape) {
50- std::vector<ov::Dimension> ov_shape (onnx_shape.size ());
51- std::transform (onnx_shape.begin (), onnx_shape.end (), ov_shape.begin (), [](int64_t dim) {
44+ static ov::PartialShape ToOvPartialShape (const ort_shape_t & ort_shape) {
45+ std::vector<ov::Dimension> ov_shape (ort_shape.size ());
46+ std::transform (ort_shape.begin (), ort_shape.end (), ov_shape.begin (), [](int64_t dim) {
5247 return dim == -1 ? ov::Dimension::dynamic () : ov::Dimension (dim);
5348 });
5449 return ov::PartialShape (ov_shape);
5550 }
5651
57- static onnx_shape_t ToOnnxShape (const ov::PartialShape& ov_shape) {
58- onnx_shape_t onnx_shape (ov_shape.size ());
59- std::transform (ov_shape.begin (), ov_shape.end (), onnx_shape .begin (), [](const auto & dim) {
52+ static ort_shape_t ToOrtShape (const ov::PartialShape& ov_shape) {
53+ ort_shape_t ort_shape (ov_shape.size ());
54+ std::transform (ov_shape.begin (), ov_shape.end (), ort_shape .begin (), [](const auto & dim) {
6055 return dim.is_dynamic () ? -1 : dim.get_length ();
6156 });
62- return onnx_shape;
63- }
64-
65- static bool IsDynamic (const ov::PartialShape& ov_shape) {
66- return ov_shape.is_dynamic ();
67- }
68- static bool IsDynamic (const onnx_shape_t & onnx_shape) {
69- return std::any_of (onnx_shape.begin (), onnx_shape.end (), [](const auto & dim) { return dim == -1 ; });
57+ return ort_shape;
7058 }
7159
7260 ov::Shape ov_shape () const { return ov_.get_shape (); }
73-
7461 const ov::PartialShape& ov () const { return ov_; }
75- const onnx_shape_t & onnx () const { return onnx_; }
76-
77- ParameterShape reshape (const onnx_shape_t & new_onnx_shape) const {
78- return ParameterShape (new_onnx_shape);
79- };
80- ParameterShape reshape (const ov::Shape& new_ov_shape) const {
81- return ParameterShape (new_ov_shape);
82- };
62+ const ort_shape_t & ort () const { return ort_; }
8363
84- ParameterShape (const onnx_shape_t & onnx_shape ) : onnx_(onnx_shape ), ov_(ToOvPartialShape(onnx_shape )) {
64+ ParameterShape (const ort_shape_t & ort_shape ) : ort_(ort_shape ), ov_(ToOvPartialShape(ort_shape )) {
8565 }
86- ParameterShape (const ov::PartialShape& ov_partial_shape) : ov_(ov_partial_shape), onnx_(ToOnnxShape (ov_partial_shape)) {
66+ ParameterShape (const ov::PartialShape& ov_partial_shape) : ov_(ov_partial_shape), ort_(ToOrtShape (ov_partial_shape)) {
8767 }
68+
69+ private:
70+ ort_shape_t ort_;
71+ ov::PartialShape ov_;
8872};
8973
9074struct ParameterInfo {
0 commit comments