namespace ov::op::slice¶
Overview¶
namespace slice {
// typedefs
typedef std::pair<int64_t, int64_t> Bounds;
// structs
struct AxesMap;
// global variables
constexpr std::array<char const \*, 4> shape_names {"start", "stop", "step", "axes"};
// global functions
int64_t get_sliced_value(
const int64_t& dim,
const int64_t& start,
const int64_t& stop,
const int64_t& step
);
element::Type get_input_const_element_type(
const ov::Node \* op,
size_t idx,
const std::map<size_t, HostTensorPtr>& constant_data = {}
);
template <class TShape, class TResult = std::vector<Bounds>>
std::unique_ptr<TResult> get_input_bounds(
const ov::Node \* op,
size_t idx,
const std::map<size_t, HostTensorPtr>& constant_data
);
template <class TDim>
TDim make_dim(
const TDim& dim,
const Bounds& start,
const Bounds& stop,
int64_t step
);
} // namespace slice
Detailed Documentation¶
Global Functions¶
int64_t get_sliced_value(
const int64_t& dim,
const int64_t& start,
const int64_t& stop,
const int64_t& step
)
Get sliced value in step for given dimension value and start, stop, step.
This function cannot be use for step 0 (division by 0)
Parameters:
dim |
Dimension value. |
start |
Start of slice. |
stop |
Stop of slice. |
step |
Step of slice. |
Returns:
-1 for infinite number otherwise [0..int64_max] for finit step.
template <class TShape, class TResult = std::vector<Bounds>>
std::unique_ptr<TResult> get_input_bounds(
const ov::Node \* op,
size_t idx,
const std::map<size_t, HostTensorPtr>& constant_data
)
Get the input bounds from constant input (constant map) or evaluate bunds and return them as vector of pairs (lower, upper).
Parameters:
TShape |
Shape type. |
op |
Operator pointer. |
idx |
Input index. |
constant_data |
Map with constant data. |
Returns:
Return vector of slice::Bounds.
Make sliced dimension for input dimension by step from start to stop bounds.
Parameters:
TDim |
Type of in/out dimension. |
dim |
|
start |
Slice start bounds. |
stop |
Slice stop bounds. |
step |
Slice step. |
Returns:
Dimension with upper/lower values set according slice inputs.