#include <stridemap.h>
Definition at line 46 of file stridemap.h.
◆ Index() [1/2]
tesseract::StrideMap::Index::Index |
( |
const StrideMap & |
stride_map | ) |
|
|
inlineexplicit |
Definition at line 48 of file stridemap.h.
48 : stride_map_(&stride_map) {
◆ Index() [2/2]
tesseract::StrideMap::Index::Index |
( |
const StrideMap & |
stride_map, |
|
|
int |
batch, |
|
|
int |
y, |
|
|
int |
x |
|
) |
| |
|
inline |
Definition at line 51 of file stridemap.h.
52 : stride_map_(&stride_map) {
◆ AddOffset()
bool tesseract::StrideMap::Index::AddOffset |
( |
int |
offset, |
|
|
FlexDimensions |
dimension |
|
) |
| |
Definition at line 63 of file stridemap.cpp.
64 indices_[dimension] += offset;
◆ Decrement()
bool tesseract::StrideMap::Index::Decrement |
( |
| ) |
|
Definition at line 88 of file stridemap.cpp.
90 if (indices_[d] > 0) {
95 InitToLastOfBatch(indices_[
FD_BATCH]);
97 t_ -= stride_map_->t_increments_[d];
102 t_ += stride_map_->t_increments_[d] * indices_[d];
int MaxIndexOfDim(FlexDimensions dim) const
◆ Increment()
bool tesseract::StrideMap::Index::Increment |
( |
| ) |
|
Definition at line 71 of file stridemap.cpp.
73 if (!
IsLast(static_cast<FlexDimensions>(d))) {
74 t_ += stride_map_->t_increments_[d];
78 t_ -= stride_map_->t_increments_[d] * indices_[d];
bool IsLast(FlexDimensions dimension) const
◆ index()
int tesseract::StrideMap::Index::index |
( |
FlexDimensions |
dimension | ) |
const |
|
inline |
Definition at line 60 of file stridemap.h.
60 {
return indices_[dimension]; }
◆ InitToFirst()
void tesseract::StrideMap::Index::InitToFirst |
( |
| ) |
|
|
inline |
Definition at line 62 of file stridemap.h.
63 memset(indices_, 0,
sizeof(indices_));
◆ InitToLast()
void tesseract::StrideMap::Index::InitToLast |
( |
| ) |
|
|
inline |
Definition at line 67 of file stridemap.h.
int MaxIndexOfDim(FlexDimensions dim) const
◆ IsLast()
bool tesseract::StrideMap::Index::IsLast |
( |
FlexDimensions |
dimension | ) |
const |
Definition at line 38 of file stridemap.cpp.
int MaxIndexOfDim(FlexDimensions dim) const
◆ IsValid()
bool tesseract::StrideMap::Index::IsValid |
( |
| ) |
const |
Definition at line 25 of file stridemap.cpp.
28 if (indices_[d] < 0)
return false;
31 if (indices_[d] >
MaxIndexOfDim(static_cast<FlexDimensions>(d)))
int MaxIndexOfDim(FlexDimensions dim) const
◆ MaxIndexOfDim()
int tesseract::StrideMap::Index::MaxIndexOfDim |
( |
FlexDimensions |
dim | ) |
const |
Definition at line 44 of file stridemap.cpp.
45 int max_index = stride_map_->shape_[dim] - 1;
46 if (dim ==
FD_BATCH)
return max_index;
48 const size_t batch = indices_[
FD_BATCH];
50 if (batch >= stride_map_->heights_.size() ||
51 stride_map_->heights_[batch] > max_index)
53 return stride_map_->heights_[batch] - 1;
55 if (batch >= stride_map_->widths_.size() ||
56 stride_map_->widths_[batch] > max_index)
58 return stride_map_->widths_[batch] - 1;
◆ t()
int tesseract::StrideMap::Index::t |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: