17#ifndef TESSERACT_LSTM_STRIDEMAP_H_
18#define TESSERACT_LSTM_STRIDEMAP_H_
49 Index(
const StrideMap &stride_map,
int batch,
int y,
int x) : stride_map_(&stride_map) {
60 return indices_[dimension];
64 memset(indices_, 0,
sizeof(indices_));
92 void InitToLastOfBatch(
int batch);
94 void SetTFromIndices();
105 memset(shape_, 0,
sizeof(shape_));
106 memset(t_increments_, 0,
sizeof(t_increments_));
111 void SetStride(
const std::vector<std::pair<int, int>> &h_w_pairs);
113 void ScaleXY(
int x_factor,
int y_factor);
120 return shape_[dimension];
129 void ComputeTIncrements();
137 std::vector<int> heights_;
139 std::vector<int> widths_;
int Size(FlexDimensions dimension) const
void ScaleXY(int x_factor, int y_factor)
void SetStride(const std::vector< std::pair< int, int > > &h_w_pairs)
int index(FlexDimensions dimension) const
bool AddOffset(int offset, FlexDimensions dimension)
bool IsLast(FlexDimensions dimension) const
Index(const StrideMap &stride_map, int batch, int y, int x)
int MaxIndexOfDim(FlexDimensions dim) const
Index(const StrideMap &stride_map)