#include <networkio.h>
Public Member Functions | |
NetworkIO () | |
void | Resize (const NetworkIO &src, int num_features) |
void | Resize2d (bool int_mode, int width, int num_features) |
void | ResizeFloat (const NetworkIO &src, int num_features) |
void | ResizeToMap (bool int_mode, const StrideMap &stride_map, int num_features) |
void | ResizeScaled (const NetworkIO &src, int x_scale, int y_scale, int num_features) |
void | ResizeXTo1 (const NetworkIO &src, int num_features) |
void | Zero () |
void | ZeroInvalidElements () |
void | FromPix (const StaticShape &shape, const Pix *pix, TRand *randomizer) |
void | FromPixes (const StaticShape &shape, const std::vector< const Pix *> &pixes, TRand *randomizer) |
void | Copy2DImage (int batch, Pix *pix, float black, float contrast, TRand *randomizer) |
void | Copy1DGreyImage (int batch, Pix *pix, float black, float contrast, TRand *randomizer) |
void | SetPixel (int t, int f, int pixel, float black, float contrast) |
Pix * | ToPix () const |
void | Print (int num) const |
int | Width () const |
int | NumFeatures () const |
float * | f (int t) |
const float * | f (int t) const |
const int8_t * | i (int t) const |
bool | int_mode () const |
void | set_int_mode (bool is_quantized) |
const StrideMap & | stride_map () const |
void | set_stride_map (const StrideMap &map) |
const GENERIC_2D_ARRAY< float > & | float_array () const |
GENERIC_2D_ARRAY< float > * | mutable_float_array () |
void | CopyTimeStepFrom (int dest_t, const NetworkIO &src, int src_t) |
void | CopyTimeStepGeneral (int dest_t, int dest_offset, int num_features, const NetworkIO &src, int src_t, int src_offset) |
void | ZeroTimeStep (int t) |
void | ZeroTimeStepGeneral (int t, int offset, int num_features) |
void | Randomize (int t, int offset, int num_features, TRand *randomizer) |
int | BestChoiceOverRange (int t_start, int t_end, int not_this, int null_ch, float *rating, float *certainty) const |
void | ScoresOverRange (int t_start, int t_end, int choice, int null_ch, float *rating, float *certainty) const |
int | BestLabel (int t, float *score) const |
int | BestLabel (int t, int not_this, int not_that, float *score) const |
int | PositionOfBestMatch (const GenericVector< int > &labels, int start, int end) const |
double | ScoreOfLabels (const GenericVector< int > &labels, int start) const |
void | SetActivations (int t, int label, float ok_score) |
void | EnsureBestLabel (int t, int label) |
bool | AnySuspiciousTruth (float confidence_thr) const |
void | ReadTimeStep (int t, double *output) const |
void | AddTimeStep (int t, double *inout) const |
void | AddTimeStepPart (int t, int offset, int num_features, float *inout) const |
void | WriteTimeStep (int t, const double *input) |
void | WriteTimeStepPart (int t, int offset, int num_features, const double *input) |
void | MaxpoolTimeStep (int dest_t, const NetworkIO &src, int src_t, int *max_line) |
void | MaxpoolBackward (const NetworkIO &fwd, const GENERIC_2D_ARRAY< int > &maxes) |
float | MinOfMaxes () const |
float | Max () const |
void | CombineOutputs (const NetworkIO &base_output, const NetworkIO &combiner_output) |
void | ComputeCombinerDeltas (const NetworkIO &fwd_deltas, const NetworkIO &base_output) |
void | CopyAll (const NetworkIO &src) |
void | AddAllToFloat (const NetworkIO &src) |
void | SubtractAllFromFloat (const NetworkIO &src) |
void | CopyWithNormalization (const NetworkIO &src, const NetworkIO &scale) |
void | ScaleFloatBy (float factor) |
void | CopyWithYReversal (const NetworkIO &src) |
void | CopyWithXReversal (const NetworkIO &src) |
void | CopyWithXYTranspose (const NetworkIO &src) |
int | CopyPacking (const NetworkIO &src, int feature_offset) |
void | CopyUnpacking (const NetworkIO &src, int feature_offset, int num_features) |
void | Transpose (TransposedArray *dest) const |
void | ClipVector (int t, float range) |
template<class Func > | |
void | FuncMultiply (const NetworkIO &v_io, int t, double *product) |
template<class Func > | |
void | FuncMultiply3 (int u_t, const NetworkIO &v_io, int v_t, const double *w, double *product) const |
template<class Func > | |
void | FuncMultiply3Add (const NetworkIO &v_io, int t, const double *w, double *product) const |
template<class Func1 , class Func2 > | |
void | Func2Multiply3 (const NetworkIO &v_io, int t, const double *w, double *product) const |
Static Public Member Functions | |
static float | ProbToCertainty (float prob) |
Static Private Member Functions | |
static int | GetPadding (int num_features) |
Private Attributes | |
GENERIC_2D_ARRAY< float > | f_ |
GENERIC_2D_ARRAY< int8_t > | i_ |
bool | int_mode_ |
StrideMap | stride_map_ |
Static Private Attributes | |
static IntSimdMatrix * | multiplier_ = nullptr |
|
inline |
void tesseract::NetworkIO::AddAllToFloat | ( | const NetworkIO & | src | ) |
void tesseract::NetworkIO::AddTimeStep | ( | int | t, |
double * | inout | ||
) | const |
void tesseract::NetworkIO::AddTimeStepPart | ( | int | t, |
int | offset, | ||
int | num_features, | ||
float * | inout | ||
) | const |
bool tesseract::NetworkIO::AnySuspiciousTruth | ( | float | confidence_thr | ) | const |
int tesseract::NetworkIO::BestChoiceOverRange | ( | int | t_start, |
int | t_end, | ||
int | not_this, | ||
int | null_ch, | ||
float * | rating, | ||
float * | certainty | ||
) | const |
|
inline |
int tesseract::NetworkIO::BestLabel | ( | int | t, |
int | not_this, | ||
int | not_that, | ||
float * | score | ||
) | const |
void tesseract::NetworkIO::ClipVector | ( | int | t, |
float | range | ||
) |
void tesseract::NetworkIO::CombineOutputs | ( | const NetworkIO & | base_output, |
const NetworkIO & | combiner_output | ||
) |
void tesseract::NetworkIO::ComputeCombinerDeltas | ( | const NetworkIO & | fwd_deltas, |
const NetworkIO & | base_output | ||
) |
void tesseract::NetworkIO::Copy1DGreyImage | ( | int | batch, |
Pix * | pix, | ||
float | black, | ||
float | contrast, | ||
TRand * | randomizer | ||
) |
void tesseract::NetworkIO::Copy2DImage | ( | int | batch, |
Pix * | pix, | ||
float | black, | ||
float | contrast, | ||
TRand * | randomizer | ||
) |
void tesseract::NetworkIO::CopyAll | ( | const NetworkIO & | src | ) |
int tesseract::NetworkIO::CopyPacking | ( | const NetworkIO & | src, |
int | feature_offset | ||
) |
void tesseract::NetworkIO::CopyTimeStepFrom | ( | int | dest_t, |
const NetworkIO & | src, | ||
int | src_t | ||
) |
void tesseract::NetworkIO::CopyTimeStepGeneral | ( | int | dest_t, |
int | dest_offset, | ||
int | num_features, | ||
const NetworkIO & | src, | ||
int | src_t, | ||
int | src_offset | ||
) |
void tesseract::NetworkIO::CopyUnpacking | ( | const NetworkIO & | src, |
int | feature_offset, | ||
int | num_features | ||
) |
void tesseract::NetworkIO::CopyWithXReversal | ( | const NetworkIO & | src | ) |
void tesseract::NetworkIO::CopyWithXYTranspose | ( | const NetworkIO & | src | ) |
void tesseract::NetworkIO::CopyWithYReversal | ( | const NetworkIO & | src | ) |
void tesseract::NetworkIO::EnsureBestLabel | ( | int | t, |
int | label | ||
) |
|
inline |
|
inline |
|
inline |
void tesseract::NetworkIO::FromPix | ( | const StaticShape & | shape, |
const Pix * | pix, | ||
TRand * | randomizer | ||
) |
void tesseract::NetworkIO::FromPixes | ( | const StaticShape & | shape, |
const std::vector< const Pix *> & | pixes, | ||
TRand * | randomizer | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
staticprivate |
|
inline |
|
inline |
|
inline |
void tesseract::NetworkIO::MaxpoolBackward | ( | const NetworkIO & | fwd, |
const GENERIC_2D_ARRAY< int > & | maxes | ||
) |
void tesseract::NetworkIO::MaxpoolTimeStep | ( | int | dest_t, |
const NetworkIO & | src, | ||
int | src_t, | ||
int * | max_line | ||
) |
float tesseract::NetworkIO::MinOfMaxes | ( | ) | const |
|
inline |
|
inline |
int tesseract::NetworkIO::PositionOfBestMatch | ( | const GenericVector< int > & | labels, |
int | start, | ||
int | end | ||
) | const |
void tesseract::NetworkIO::Print | ( | int | num | ) | const |
|
static |
void tesseract::NetworkIO::Randomize | ( | int | t, |
int | offset, | ||
int | num_features, | ||
TRand * | randomizer | ||
) |
void tesseract::NetworkIO::ReadTimeStep | ( | int | t, |
double * | output | ||
) | const |
|
inline |
void tesseract::NetworkIO::Resize2d | ( | bool | int_mode, |
int | width, | ||
int | num_features | ||
) |
|
inline |
void tesseract::NetworkIO::ResizeScaled | ( | const NetworkIO & | src, |
int | x_scale, | ||
int | y_scale, | ||
int | num_features | ||
) |
void tesseract::NetworkIO::ResizeToMap | ( | bool | int_mode, |
const StrideMap & | stride_map, | ||
int | num_features | ||
) |
void tesseract::NetworkIO::ResizeXTo1 | ( | const NetworkIO & | src, |
int | num_features | ||
) |
|
inline |
double tesseract::NetworkIO::ScoreOfLabels | ( | const GenericVector< int > & | labels, |
int | start | ||
) | const |
void tesseract::NetworkIO::ScoresOverRange | ( | int | t_start, |
int | t_end, | ||
int | choice, | ||
int | null_ch, | ||
float * | rating, | ||
float * | certainty | ||
) | const |
|
inline |
|
inline |
void tesseract::NetworkIO::SetActivations | ( | int | t, |
int | label, | ||
float | ok_score | ||
) |
void tesseract::NetworkIO::SetPixel | ( | int | t, |
int | f, | ||
int | pixel, | ||
float | black, | ||
float | contrast | ||
) |
|
inline |
void tesseract::NetworkIO::SubtractAllFromFloat | ( | const NetworkIO & | src | ) |
Pix * tesseract::NetworkIO::ToPix | ( | ) | const |
void tesseract::NetworkIO::Transpose | ( | TransposedArray * | dest | ) | const |
|
inline |
void tesseract::NetworkIO::WriteTimeStep | ( | int | t, |
const double * | input | ||
) |
void tesseract::NetworkIO::WriteTimeStepPart | ( | int | t, |
int | offset, | ||
int | num_features, | ||
const double * | input | ||
) |
void tesseract::NetworkIO::Zero | ( | ) |
void tesseract::NetworkIO::ZeroInvalidElements | ( | ) |
|
inline |
void tesseract::NetworkIO::ZeroTimeStepGeneral | ( | int | t, |
int | offset, | ||
int | num_features | ||
) |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |