Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
ba20e50b
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
ba20e50b
编写于
6月 06, 2019
作者:
J
Jiabin Yang
提交者:
GitHub
6月 06, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Feature/hide build once (#2365)
* test=develop, hide build once usage * test=develop, polish code
上级
82a2acbc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
0 addition
and
38 deletion
+0
-38
dygraph/ocr_recognition/train.py
dygraph/ocr_recognition/train.py
+0
-8
dygraph/pbt_lm/ptb_dy.py
dygraph/pbt_lm/ptb_dy.py
+0
-30
未找到文件。
dygraph/ocr_recognition/train.py
浏览文件 @
ba20e50b
...
@@ -331,9 +331,6 @@ class SimpleAttention(fluid.dygraph.Layer):
...
@@ -331,9 +331,6 @@ class SimpleAttention(fluid.dygraph.Layer):
act
=
None
,
act
=
None
,
bias_attr
=
False
)
bias_attr
=
False
)
def
_build_once
(
self
,
encoder_vec
,
encoder_proj
,
decoder_state
):
pass
def
forward
(
self
,
encoder_vec
,
encoder_proj
,
decoder_state
):
def
forward
(
self
,
encoder_vec
,
encoder_proj
,
decoder_state
):
decoder_state_fc
=
self
.
fc_1
(
decoder_state
)
decoder_state_fc
=
self
.
fc_1
(
decoder_state
)
...
@@ -381,9 +378,6 @@ class GRUDecoderWithAttention(fluid.dygraph.Layer):
...
@@ -381,9 +378,6 @@ class GRUDecoderWithAttention(fluid.dygraph.Layer):
self
.
decoder_size
=
decoder_size
self
.
decoder_size
=
decoder_size
def
_build_once
(
self
,
target_embedding
,
encoder_vec
,
encoder_proj
,
decoder_boot
):
pass
def
forward
(
self
,
target_embedding
,
encoder_vec
,
encoder_proj
,
def
forward
(
self
,
target_embedding
,
encoder_vec
,
encoder_proj
,
decoder_boot
):
decoder_boot
):
...
@@ -431,8 +425,6 @@ class OCRAttention(fluid.dygraph.Layer):
...
@@ -431,8 +425,6 @@ class OCRAttention(fluid.dygraph.Layer):
self
.
gru_decoder_with_attention
=
GRUDecoderWithAttention
(
self
.
gru_decoder_with_attention
=
GRUDecoderWithAttention
(
self
.
full_name
(),
Config
.
decoder_size
,
Config
.
num_classes
)
self
.
full_name
(),
Config
.
decoder_size
,
Config
.
num_classes
)
def
_build_once
(
self
,
inputs
,
label_in
):
pass
def
forward
(
self
,
inputs
,
label_in
):
def
forward
(
self
,
inputs
,
label_in
):
gru_backward
,
encoded_vector
,
encoded_proj
=
self
.
encoder_net
(
inputs
)
gru_backward
,
encoded_vector
,
encoded_proj
=
self
.
encoder_net
(
inputs
)
...
...
dygraph/pbt_lm/ptb_dy.py
浏览文件 @
ba20e50b
...
@@ -56,7 +56,6 @@ class SimpleLSTMRNN(fluid.Layer):
...
@@ -56,7 +56,6 @@ class SimpleLSTMRNN(fluid.Layer):
self
.
cell_array
=
[]
self
.
cell_array
=
[]
self
.
hidden_array
=
[]
self
.
hidden_array
=
[]
#build_once()
self
.
weight_1_arr
=
[]
self
.
weight_1_arr
=
[]
self
.
weight_2_arr
=
[]
self
.
weight_2_arr
=
[]
self
.
bias_arr
=
[]
self
.
bias_arr
=
[]
...
@@ -81,35 +80,6 @@ class SimpleLSTMRNN(fluid.Layer):
...
@@ -81,35 +80,6 @@ class SimpleLSTMRNN(fluid.Layer):
default_initializer
=
fluid
.
initializer
.
Constant
(
0.0
))
default_initializer
=
fluid
.
initializer
.
Constant
(
0.0
))
self
.
bias_arr
.
append
(
self
.
add_parameter
(
'b_%d'
%
i
,
bias_1
))
self
.
bias_arr
.
append
(
self
.
add_parameter
(
'b_%d'
%
i
,
bias_1
))
def
build_once
(
self
,
input_embedding
,
init_hidden
=
None
,
init_cell
=
None
):
pass
'''
self.weight_1_arr = []
self.weight_2_arr = []
self.bias_arr = []
self.mask_array = []
for i in range(self._num_layers):
weight_1 = self.create_parameter(
attr=fluid.ParamAttr(
initializer=fluid.initializer.UniformInitializer(
low=-self._init_scale, high=self._init_scale)),
shape=[self._hidden_size * 2, self._hidden_size * 4],
dtype="float32",
default_initializer=fluid.initializer.UniformInitializer(
low=-self._init_scale, high=self._init_scale))
self.weight_1_arr.append(self.add_parameter('w_%d' % i, weight_1))
bias_1 = self.create_parameter(
attr=fluid.ParamAttr(
initializer=fluid.initializer.UniformInitializer(
low=-self._init_scale, high=self._init_scale)),
shape=[self._hidden_size * 4],
dtype="float32",
default_initializer=fluid.initializer.Constant(0.0))
self.bias_arr.append(self.add_parameter('b_%d' % i, bias_1))
'''
def
forward
(
self
,
input_embedding
,
init_hidden
=
None
,
init_cell
=
None
):
def
forward
(
self
,
input_embedding
,
init_hidden
=
None
,
init_cell
=
None
):
self
.
cell_array
=
[]
self
.
cell_array
=
[]
self
.
hidden_array
=
[]
self
.
hidden_array
=
[]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录