MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ClampedIndex

Function ClampedIndex

tensorflow/lite/kernels/strided_slice.cc:68–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68inline int32_t ClampedIndex(int32_t index, int dim, bool pos_stride) {
69 return pos_stride
70 ? (index >= dim ? dim
71 : PositiveRemainder(
72 std::min(std::max(index, -dim), dim), dim))
73 : (index < -dim
74 ? -1
75 : PositiveRemainder(
76 std::min(std::max(index, -dim), dim - 1), dim));
77}
78
79// TODO(b/77971377) this logic should be removed, as it's a duplication of
80// StartForAxis() & StopForAxis() in kernels/internal/reference/reference_ops.h

Callers 2

GetBeginValueAtIndexFunction · 0.85
GetEndValueAtIndexFunction · 0.85

Calls 3

PositiveRemainderFunction · 0.85
minFunction · 0.50
maxFunction · 0.50

Tested by

no test coverage detected