tesseract
5.0.0-alpha-619-ge9db
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
Typedefs
b
c
d
f
i
l
n
p
r
s
t
u
w
Enumerations
a
c
d
e
f
g
k
l
n
o
p
s
t
u
v
w
x
Enumerator
a
c
d
e
f
h
j
l
n
o
p
r
s
t
u
w
x
Classes
Class List
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Typedefs
Enumerations
Enumerator
a
b
c
d
f
g
i
k
l
m
n
o
p
r
s
t
u
v
w
y
Related Functions
:
b
c
d
e
f
g
m
o
r
s
t
u
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Variables
b
c
d
e
f
g
i
k
m
n
o
p
r
t
u
w
Typedefs
a
b
c
d
e
f
i
l
m
n
p
r
s
t
u
v
Enumerations
a
b
c
d
f
g
i
l
m
n
o
p
r
s
t
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
convolve.h
Go to the documentation of this file.
1
// File: convolve.h
3
// Description: Convolutional layer that stacks the inputs over its rectangle
4
// and pulls in random data to fill out-of-input inputs.
5
// Output is therefore same size as its input, but deeper.
6
// Author: Ray Smith
7
//
8
// (C) Copyright 2014, Google Inc.
9
// Licensed under the Apache License, Version 2.0 (the "License");
10
// you may not use this file except in compliance with the License.
11
// You may obtain a copy of the License at
12
// http://www.apache.org/licenses/LICENSE-2.0
13
// Unless required by applicable law or agreed to in writing, software
14
// distributed under the License is distributed on an "AS IS" BASIS,
15
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
// See the License for the specific language governing permissions and
17
// limitations under the License.
19
20
#ifndef TESSERACT_LSTM_CONVOLVE_H_
21
#define TESSERACT_LSTM_CONVOLVE_H_
22
23
#include <
tesseract/genericvector.h
>
24
#include "
matrix.h
"
25
#include "
network.h
"
26
27
namespace
tesseract
{
28
29
// Makes each time-step deeper by stacking inputs over its rectangle. Does not
30
// affect the size of its input. Achieves this by bringing in random values in
31
// out-of-input areas.
32
class
Convolve
:
public
Network
{
33
public
:
34
// The area of convolution is 2*half_x + 1 by 2*half_y + 1, forcing it to
35
// always be odd, so the center is the current pixel.
36
Convolve
(
const
STRING
&
name
,
int
ni,
int
half_x,
int
half_y);
37
~Convolve
()
override
=
default
;
38
39
STRING
spec
()
const override
{
40
STRING
spec
;
41
spec
.
add_str_int
(
"C"
,
half_x_
* 2 + 1);
42
spec
.
add_str_int
(
","
,
half_y_
* 2 + 1);
43
return
spec
;
44
}
45
46
// Writes to the given file. Returns false in case of error.
47
bool
Serialize
(
TFile
* fp)
const override
;
48
// Reads from the given file. Returns false in case of error.
49
bool
DeSerialize
(
TFile
* fp)
override
;
50
51
// Runs forward propagation of activations on the input line.
52
// See Network for a detailed discussion of the arguments.
53
void
Forward
(
bool
debug,
const
NetworkIO
& input,
54
const
TransposedArray
* input_transpose,
55
NetworkScratch
* scratch,
NetworkIO
* output)
override
;
56
57
// Runs backward propagation of errors on the deltas line.
58
// See Network for a detailed discussion of the arguments.
59
bool
Backward
(
bool
debug,
const
NetworkIO
& fwd_deltas,
60
NetworkScratch
* scratch,
61
NetworkIO
* back_deltas)
override
;
62
63
private
:
64
void
DebugWeights()
override
{
65
tprintf
(
"Must override Network::DebugWeights for type %d\n"
,
type_
);
66
}
67
68
protected
:
69
// Serialized data.
70
int32_t
half_x_
;
71
int32_t
half_y_
;
72
};
73
74
}
// namespace tesseract.
75
76
#endif // TESSERACT_LSTM_SUBSAMPLE_H_
STRING::add_str_int
void add_str_int(const char *str, int number)
Definition:
strngs.cpp:370
STRING
Definition:
strngs.h:45
tesseract::NetworkScratch
Definition:
networkscratch.h:34
tesseract::Convolve::Forward
void Forward(bool debug, const NetworkIO &input, const TransposedArray *input_transpose, NetworkScratch *scratch, NetworkIO *output) override
Definition:
convolve.cpp:50
network.h
genericvector.h
tesseract::Network::type_
NetworkType type_
Definition:
network.h:293
tesseract::Convolve::half_y_
int32_t half_y_
Definition:
convolve.h:71
matrix.h
tesseract::TFile
Definition:
serialis.h:75
tesseract::NetworkIO
Definition:
networkio.h:39
tesseract::Convolve::DeSerialize
bool DeSerialize(TFile *fp) override
Definition:
convolve.cpp:41
tesseract::Convolve::Serialize
bool Serialize(TFile *fp) const override
Definition:
convolve.cpp:34
tesseract::Convolve
Definition:
convolve.h:32
tesseract
Definition:
baseapi.h:65
tesseract::Convolve::spec
STRING spec() const override
Definition:
convolve.h:39
tesseract::Convolve::half_x_
int32_t half_x_
Definition:
convolve.h:70
tesseract::Network
Definition:
network.h:105
tesseract::Network::name
const STRING & name() const
Definition:
network.h:138
tesseract::Convolve::Backward
bool Backward(bool debug, const NetworkIO &fwd_deltas, NetworkScratch *scratch, NetworkIO *back_deltas) override
Definition:
convolve.cpp:84
tesseract::TransposedArray
Definition:
weightmatrix.h:32
tesseract::Convolve::~Convolve
~Convolve() override=default
tprintf
DLLSYM void tprintf(const char *format,...)
Definition:
tprintf.cpp:34
tesseract::Convolve::Convolve
Convolve(const STRING &name, int ni, int half_x, int half_y)
Definition:
convolve.cpp:28
src
lstm
convolve.h
Generated on Thu Jan 30 2020 14:22:20 for tesseract by
1.8.16