115inline int Clamp(
const int32_t v,
const int32_t
lo,
const int32_t
hi)
133 const auto *strides = params.
strides;
140 int64_t start = start_indices[axis];
143 if (begin_mask & (1LL << axis))
145 if (strides[axis] > 0)
150 start = std::numeric_limits<int32_t>::lowest();
155 start = std::numeric_limits<int32_t>::max();
166 if (strides[axis] > 0)
188 const auto end_mask = params.
end_mask;
191 const auto *strides = params.
strides;
199 const bool shrink_axis = shrink_axis_mask & (1LL << axis);
212 if (end_mask & (1LL << axis))
214 if (strides[axis] > 0)
218 stop = std::numeric_limits<int32_t>::max();
223 stop = std::numeric_limits<int32_t>::lowest();
236 if (strides[axis] > 0)
268 if (!((1LL <<
i) &
op_context->params.ellipsis_mask) &&
408 INTERNAL_EXN(
"StridedSlice strides node is not Constant");
425 auto &effective_input_shape =
op_context.effective_input_shape;
429 for (int32_t
idx = effective_input_shape.rank() - 1;
idx >= 0; --
idx)
432 LUCI_ASSERT(stride != 0,
"stride value has to be non-zero");
465 LUCI_ASSERT(0 <= dim && dim < 0xfffffffL,
"Dimension size exceeds limit");
#define INTERNAL_EXN(msg)
@ brief throw internal exception with message
The value of one dimension in a tensor shape.
Class to build tensor data.
loco::Node * input(void) const
int32_t begin_mask() const
int32_t shrink_axis_mask() const
loco::Node * begin(void) const
int32_t ellipsis_mask() const
int32_t new_axis_mask() const
loco::Node * strides(void) const
loco::Node * end(void) const
loco::TensorShape visit(const luci::CircleNode *node) final
Default fallback.
const luci_interpreter::RuntimeShape output_shape
#define LUCI_ASSERT(condition, msg)
T must_cast(FeatureEncoder *node)
A helper dynamic_cast that throws when failed.
DataType
"scalar" value type
int64_t StopForAxis(const StridedSliceParams ¶ms, const loco::TensorShape &input_shape, int64_t axis, int64_t start_for_axis)
int Clamp(const int32_t v, const int32_t lo, const int32_t hi)
loco::TensorShape circle_shape(const luci::CircleNode *node)
int64_t StartForAxis(const StridedSliceParams ¶ms, const loco::TensorShape &input_shape, int64_t axis)
StridedSliceParams BuildStridedSliceParams(StridedSliceContext *op_context)
T must_cast(loco::Node *node)
CircleInput * input_node(loco::Graph *g, const loco::GraphInputIndex &index)
Find a Pull node with a given input index.
luci::CircleConst * strides
StridedSliceParams params
luci::CircleConst * begin
StridedSliceContext(const luci::CircleStridedSlice *node)
loco::TensorShape effective_input_shape
int32_t stop_indices[kMaxDim]
int32_t start_indices[kMaxDim]
int8_t start_indices_count
int8_t stop_indices_count