-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved AxisSet, AxisVector, Coordinate, CoordinateDiff to ov (#7237)
- Loading branch information
Showing
13 changed files
with
275 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (C) 2018-2021 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <cstddef> | ||
#include <ostream> | ||
#include <set> | ||
#include <vector> | ||
|
||
#include "openvino/core/attribute_adapter.hpp" | ||
#include "openvino/core/core_visibility.hpp" | ||
|
||
namespace ov { | ||
/// \brief A set of axes. | ||
class AxisSet : public std::set<size_t> { | ||
public: | ||
OPENVINO_API AxisSet(); | ||
|
||
OPENVINO_API AxisSet(const std::initializer_list<size_t>& axes); | ||
|
||
OPENVINO_API AxisSet(const std::set<size_t>& axes); | ||
|
||
OPENVINO_API AxisSet(const std::vector<size_t>& axes); | ||
|
||
OPENVINO_API AxisSet(const AxisSet& axes); | ||
|
||
OPENVINO_API AxisSet& operator=(const AxisSet& v); | ||
|
||
OPENVINO_API AxisSet& operator=(AxisSet&& v) noexcept; | ||
|
||
OPENVINO_API std::vector<int64_t> to_vector() const; | ||
}; | ||
|
||
OPENVINO_API | ||
std::ostream& operator<<(std::ostream& s, const AxisSet& axis_set); | ||
|
||
template <> | ||
class OPENVINO_API AttributeAdapter<ov::AxisSet> : public ValueAccessor<std::vector<int64_t>> { | ||
public: | ||
AttributeAdapter(ov::AxisSet& value) : m_ref(value) {} | ||
|
||
const std::vector<int64_t>& get() override; | ||
void set(const std::vector<int64_t>& value) override; | ||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<AxisSet>", 0}; | ||
const DiscreteTypeInfo& get_type_info() const override { | ||
return type_info; | ||
} | ||
operator ov::AxisSet&() { | ||
return m_ref; | ||
} | ||
|
||
protected: | ||
ov::AxisSet& m_ref; | ||
std::vector<int64_t> m_buffer; | ||
bool m_buffer_valid{false}; | ||
}; | ||
|
||
} // namespace ov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (C) 2018-2021 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <cstddef> | ||
#include <ostream> | ||
#include <vector> | ||
|
||
#include "openvino/core/attribute_adapter.hpp" | ||
#include "openvino/core/core_visibility.hpp" | ||
|
||
namespace ov { | ||
/// \brief A vector of axes. | ||
class AxisVector : public std::vector<size_t> { | ||
public: | ||
OPENVINO_API AxisVector(const std::initializer_list<size_t>& axes); | ||
|
||
OPENVINO_API AxisVector(const std::vector<size_t>& axes); | ||
|
||
OPENVINO_API AxisVector(const AxisVector& axes); | ||
|
||
OPENVINO_API explicit AxisVector(size_t n); | ||
|
||
template <class InputIterator> | ||
AxisVector(InputIterator first, InputIterator last) : std::vector<size_t>(first, last) {} | ||
|
||
OPENVINO_API AxisVector(); | ||
|
||
OPENVINO_API ~AxisVector(); | ||
|
||
OPENVINO_API AxisVector& operator=(const AxisVector& v); | ||
|
||
OPENVINO_API AxisVector& operator=(AxisVector&& v) noexcept; | ||
}; | ||
|
||
OPENVINO_API | ||
std::ostream& operator<<(std::ostream& s, const AxisVector& axis_vector); | ||
|
||
template <> | ||
class OPENVINO_API AttributeAdapter<AxisVector> : public IndirectVectorValueAccessor<AxisVector, std::vector<int64_t>> { | ||
public: | ||
AttributeAdapter(AxisVector& value) : IndirectVectorValueAccessor<AxisVector, std::vector<int64_t>>(value) {} | ||
|
||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<AxisVector>", 0}; | ||
const DiscreteTypeInfo& get_type_info() const override { | ||
return type_info; | ||
} | ||
}; | ||
|
||
} // namespace ov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (C) 2018-2021 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <algorithm> | ||
#include <vector> | ||
|
||
#include "ngraph/shape.hpp" | ||
#include "openvino/core/core_visibility.hpp" | ||
|
||
namespace ov { | ||
/// \brief Coordinates for a tensor element | ||
class Coordinate : public std::vector<size_t> { | ||
public: | ||
OPENVINO_API Coordinate(); | ||
OPENVINO_API Coordinate(const std::initializer_list<size_t>& axes); | ||
|
||
OPENVINO_API Coordinate(const ngraph::Shape& shape); | ||
|
||
OPENVINO_API Coordinate(const std::vector<size_t>& axes); | ||
|
||
OPENVINO_API Coordinate(const Coordinate& axes); | ||
|
||
OPENVINO_API Coordinate(size_t n, size_t initial_value = 0); | ||
|
||
OPENVINO_API ~Coordinate(); | ||
|
||
template <class InputIterator> | ||
Coordinate(InputIterator first, InputIterator last) : std::vector<size_t>(first, last) {} | ||
|
||
OPENVINO_API Coordinate& operator=(const Coordinate& v); | ||
|
||
OPENVINO_API Coordinate& operator=(Coordinate&& v) noexcept; | ||
}; | ||
|
||
OPENVINO_API | ||
std::ostream& operator<<(std::ostream& s, const Coordinate& coordinate); | ||
|
||
template <> | ||
class OPENVINO_API AttributeAdapter<Coordinate> : public IndirectVectorValueAccessor<Coordinate, std::vector<int64_t>> { | ||
public: | ||
AttributeAdapter(Coordinate& value) : IndirectVectorValueAccessor<Coordinate, std::vector<int64_t>>(value) {} | ||
|
||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<Coordinate>", 0}; | ||
const DiscreteTypeInfo& get_type_info() const override { | ||
return type_info; | ||
} | ||
}; | ||
} // namespace ov |
Oops, something went wrong.