Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
a7660331a
tesseract
提交
f53290ac
T
tesseract
项目概览
a7660331a
/
tesseract
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tesseract
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f53290ac
编写于
5月 03, 2018
作者:
Z
zdenop
提交者:
GitHub
5月 03, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1552 from stweil/override
Use more override specifiers
上级
bf9b72c6
dc3d28cc
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
65 addition
and
65 deletion
+65
-65
src/lstm/convolve.h
src/lstm/convolve.h
+9
-9
src/lstm/input.h
src/lstm/input.h
+13
-13
src/lstm/maxpool.h
src/lstm/maxpool.h
+8
-8
src/lstm/parallel.h
src/lstm/parallel.h
+8
-8
src/lstm/reconfig.h
src/lstm/reconfig.h
+11
-11
src/lstm/reversed.h
src/lstm/reversed.h
+8
-8
src/lstm/tfnetwork.h
src/lstm/tfnetwork.h
+8
-8
未找到文件。
src/lstm/convolve.h
浏览文件 @
f53290ac
...
...
@@ -37,7 +37,7 @@ class Convolve : public Network {
Convolve
(
const
STRING
&
name
,
int
ni
,
int
half_x
,
int
half_y
);
virtual
~
Convolve
();
virtual
STRING
spec
()
const
{
STRING
spec
()
const
override
{
STRING
spec
;
spec
.
add_str_int
(
"C"
,
half_x_
*
2
+
1
);
spec
.
add_str_int
(
","
,
half_y_
*
2
+
1
);
...
...
@@ -45,21 +45,21 @@ class Convolve : public Network {
}
// Writes to the given file. Returns false in case of error.
virtual
bool
Serialize
(
TFile
*
fp
)
const
;
bool
Serialize
(
TFile
*
fp
)
const
override
;
// Reads from the given file. Returns false in case of error.
virtual
bool
DeSerialize
(
TFile
*
fp
)
;
bool
DeSerialize
(
TFile
*
fp
)
override
;
// Runs forward propagation of activations on the input line.
// See Network for a detailed discussion of the arguments.
v
irtual
v
oid
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
;
void
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
override
;
// Runs backward propagation of errors on the deltas line.
// See Network for a detailed discussion of the arguments.
virtual
bool
Backward
(
bool
debug
,
const
NetworkIO
&
fwd_deltas
,
NetworkScratch
*
scratch
,
NetworkIO
*
back_deltas
)
;
bool
Backward
(
bool
debug
,
const
NetworkIO
&
fwd_deltas
,
NetworkScratch
*
scratch
,
NetworkIO
*
back_deltas
)
override
;
protected:
// Serialized data.
...
...
src/lstm/input.h
浏览文件 @
f53290ac
...
...
@@ -31,7 +31,7 @@ class Input : public Network {
Input
(
const
STRING
&
name
,
const
StaticShape
&
shape
);
virtual
~
Input
();
virtual
STRING
spec
()
const
{
STRING
spec
()
const
override
{
STRING
spec
;
spec
.
add_str_int
(
""
,
shape_
.
batch
());
spec
.
add_str_int
(
","
,
shape_
.
height
());
...
...
@@ -41,17 +41,17 @@ class Input : public Network {
}
// Returns the required shape input to the network.
virtual
StaticShape
InputShape
()
const
{
return
shape_
;
}
StaticShape
InputShape
()
const
override
{
return
shape_
;
}
// Returns the shape output from the network given an input shape (which may
// be partially unknown ie zero).
virtual
StaticShape
OutputShape
(
const
StaticShape
&
input_shape
)
const
{
StaticShape
OutputShape
(
const
StaticShape
&
input_shape
)
const
override
{
return
shape_
;
}
// Writes to the given file. Returns false in case of error.
// Should be overridden by subclasses, but called by their Serialize.
virtual
bool
Serialize
(
TFile
*
fp
)
const
;
bool
Serialize
(
TFile
*
fp
)
const
override
;
// Reads from the given file. Returns false in case of error.
virtual
bool
DeSerialize
(
TFile
*
fp
)
;
bool
DeSerialize
(
TFile
*
fp
)
override
;
// Returns an integer reduction factor that the network applies to the
// time sequence. Assumes that any 2-d is already eliminated. Used for
...
...
@@ -59,23 +59,23 @@ class Input : public Network {
// WARNING: if GlobalMinimax is used to vary the scale, this will return
// the last used scale factor. Call it before any forward, and it will return
// the minimum scale factor of the paths through the GlobalMinimax.
virtual
int
XScaleFactor
()
const
;
int
XScaleFactor
()
const
override
;
// Provides the (minimum) x scale factor to the network (of interest only to
// input units) so they can determine how to scale bounding boxes.
v
irtual
void
CacheXScaleFactor
(
int
factor
)
;
v
oid
CacheXScaleFactor
(
int
factor
)
override
;
// Runs forward propagation of activations on the input line.
// See Network for a detailed discussion of the arguments.
v
irtual
v
oid
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
;
void
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
override
;
// Runs backward propagation of errors on the deltas line.
// See Network for a detailed discussion of the arguments.
virtual
bool
Backward
(
bool
debug
,
const
NetworkIO
&
fwd_deltas
,
NetworkScratch
*
scratch
,
NetworkIO
*
back_deltas
)
;
bool
Backward
(
bool
debug
,
const
NetworkIO
&
fwd_deltas
,
NetworkScratch
*
scratch
,
NetworkIO
*
back_deltas
)
override
;
// Creates and returns a Pix of appropriate size for the network from the
// image_data. If non-null, *image_scale returns the image scale factor used.
// Returns nullptr on error.
...
...
src/lstm/maxpool.h
浏览文件 @
f53290ac
...
...
@@ -32,7 +32,7 @@ class Maxpool : public Reconfig {
virtual
~
Maxpool
();
// Accessors.
virtual
STRING
spec
()
const
{
STRING
spec
()
const
override
{
STRING
spec
;
spec
.
add_str_int
(
"Mp"
,
y_scale_
);
spec
.
add_str_int
(
","
,
x_scale_
);
...
...
@@ -40,19 +40,19 @@ class Maxpool : public Reconfig {
}
// Reads from the given file. Returns false in case of error.
virtual
bool
DeSerialize
(
TFile
*
fp
)
;
bool
DeSerialize
(
TFile
*
fp
)
override
;
// Runs forward propagation of activations on the input line.
// See Network for a detailed discussion of the arguments.
v
irtual
v
oid
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
;
void
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
override
;
// Runs backward propagation of errors on the deltas line.
// See Network for a detailed discussion of the arguments.
virtual
bool
Backward
(
bool
debug
,
const
NetworkIO
&
fwd_deltas
,
NetworkScratch
*
scratch
,
NetworkIO
*
back_deltas
)
;
bool
Backward
(
bool
debug
,
const
NetworkIO
&
fwd_deltas
,
NetworkScratch
*
scratch
,
NetworkIO
*
back_deltas
)
override
;
private:
// Memory of which input was the max.
...
...
src/lstm/parallel.h
浏览文件 @
f53290ac
...
...
@@ -32,9 +32,9 @@ class Parallel : public Plumbing {
// Returns the shape output from the network given an input shape (which may
// be partially unknown ie zero).
virtual
StaticShape
OutputShape
(
const
StaticShape
&
input_shape
)
const
;
StaticShape
OutputShape
(
const
StaticShape
&
input_shape
)
const
override
;
virtual
STRING
spec
()
const
{
STRING
spec
()
const
override
{
STRING
spec
;
if
(
type_
==
NT_PAR_2D_LSTM
)
{
// We have 4 LSTMs operating in parallel here, so the size of each is
...
...
@@ -63,15 +63,15 @@ class Parallel : public Plumbing {
// Runs forward propagation of activations on the input line.
// See Network for a detailed discussion of the arguments.
v
irtual
v
oid
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
;
void
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
override
;
// Runs backward propagation of errors on the deltas line.
// See Network for a detailed discussion of the arguments.
virtual
bool
Backward
(
bool
debug
,
const
NetworkIO
&
fwd_deltas
,
NetworkScratch
*
scratch
,
NetworkIO
*
back_deltas
)
;
bool
Backward
(
bool
debug
,
const
NetworkIO
&
fwd_deltas
,
NetworkScratch
*
scratch
,
NetworkIO
*
back_deltas
)
override
;
private:
// If *this is a NT_REPLICATED, then it feeds a replicated network with
...
...
src/lstm/reconfig.h
浏览文件 @
f53290ac
...
...
@@ -37,9 +37,9 @@ class Reconfig : public Network {
// Returns the shape output from the network given an input shape (which may
// be partially unknown ie zero).
virtual
StaticShape
OutputShape
(
const
StaticShape
&
input_shape
)
const
;
StaticShape
OutputShape
(
const
StaticShape
&
input_shape
)
const
override
;
virtual
STRING
spec
()
const
{
STRING
spec
()
const
override
{
STRING
spec
;
spec
.
add_str_int
(
"S"
,
y_scale_
);
spec
.
add_str_int
(
","
,
x_scale_
);
...
...
@@ -52,24 +52,24 @@ class Reconfig : public Network {
// WARNING: if GlobalMinimax is used to vary the scale, this will return
// the last used scale factor. Call it before any forward, and it will return
// the minimum scale factor of the paths through the GlobalMinimax.
virtual
int
XScaleFactor
()
const
;
int
XScaleFactor
()
const
override
;
// Writes to the given file. Returns false in case of error.
virtual
bool
Serialize
(
TFile
*
fp
)
const
;
bool
Serialize
(
TFile
*
fp
)
const
override
;
// Reads from the given file. Returns false in case of error.
virtual
bool
DeSerialize
(
TFile
*
fp
)
;
bool
DeSerialize
(
TFile
*
fp
)
override
;
// Runs forward propagation of activations on the input line.
// See Network for a detailed discussion of the arguments.
v
irtual
v
oid
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
;
void
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
override
;
// Runs backward propagation of errors on the deltas line.
// See Network for a detailed discussion of the arguments.
virtual
bool
Backward
(
bool
debug
,
const
NetworkIO
&
fwd_deltas
,
NetworkScratch
*
scratch
,
NetworkIO
*
back_deltas
)
;
bool
Backward
(
bool
debug
,
const
NetworkIO
&
fwd_deltas
,
NetworkScratch
*
scratch
,
NetworkIO
*
back_deltas
)
override
;
protected:
// Non-serialized data used to store parameters between forward and back.
...
...
src/lstm/reversed.h
浏览文件 @
f53290ac
...
...
@@ -32,9 +32,9 @@ class Reversed : public Plumbing {
// Returns the shape output from the network given an input shape (which may
// be partially unknown ie zero).
virtual
StaticShape
OutputShape
(
const
StaticShape
&
input_shape
)
const
;
StaticShape
OutputShape
(
const
StaticShape
&
input_shape
)
const
override
;
virtual
STRING
spec
()
const
{
STRING
spec
()
const
override
{
STRING
spec
(
type_
==
NT_XREVERSED
?
"Rx"
:
(
type_
==
NT_YREVERSED
?
"Ry"
:
"Txy"
));
// For most simple cases, we will output Rx<net> or Ry<net> where <net> is
...
...
@@ -69,15 +69,15 @@ class Reversed : public Plumbing {
// Runs forward propagation of activations on the input line.
// See Network for a detailed discussion of the arguments.
v
irtual
v
oid
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
;
void
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
override
;
// Runs backward propagation of errors on the deltas line.
// See Network for a detailed discussion of the arguments.
virtual
bool
Backward
(
bool
debug
,
const
NetworkIO
&
fwd_deltas
,
NetworkScratch
*
scratch
,
NetworkIO
*
back_deltas
)
;
bool
Backward
(
bool
debug
,
const
NetworkIO
&
fwd_deltas
,
NetworkScratch
*
scratch
,
NetworkIO
*
back_deltas
)
override
;
private:
// Copies src to *dest with the reversal according to type_.
...
...
src/lstm/tfnetwork.h
浏览文件 @
f53290ac
...
...
@@ -39,14 +39,14 @@ class TFNetwork : public Network {
virtual
~
TFNetwork
();
// Returns the required shape input to the network.
virtual
StaticShape
InputShape
()
const
{
return
input_shape_
;
}
StaticShape
InputShape
()
const
override
{
return
input_shape_
;
}
// Returns the shape output from the network given an input shape (which may
// be partially unknown ie zero).
virtual
StaticShape
OutputShape
(
const
StaticShape
&
input_shape
)
const
{
StaticShape
OutputShape
(
const
StaticShape
&
input_shape
)
const
override
{
return
output_shape_
;
}
virtual
STRING
spec
()
const
{
return
spec_
.
c_str
();
}
STRING
spec
()
const
override
{
return
spec_
.
c_str
();
}
// Deserializes *this from a serialized TFNetwork proto. Returns 0 if failed,
// otherwise the global step of the serialized graph.
...
...
@@ -57,16 +57,16 @@ class TFNetwork : public Network {
// Writes to the given file. Returns false in case of error.
// Should be overridden by subclasses, but called by their Serialize.
virtual
bool
Serialize
(
TFile
*
fp
)
const
;
bool
Serialize
(
TFile
*
fp
)
const
override
;
// Reads from the given file. Returns false in case of error.
// Should be overridden by subclasses, but NOT called by their DeSerialize.
virtual
bool
DeSerialize
(
TFile
*
fp
)
;
bool
DeSerialize
(
TFile
*
fp
)
override
;
// Runs forward propagation of activations on the input line.
// See Network for a detailed discussion of the arguments.
v
irtual
v
oid
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
;
void
Forward
(
bool
debug
,
const
NetworkIO
&
input
,
const
TransposedArray
*
input_transpose
,
NetworkScratch
*
scratch
,
NetworkIO
*
output
)
override
;
private:
int
InitFromProto
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录