提交 6b69bd23 编写于 作者: Z zhongpu 提交者: Leo Chen

Optimizer init with parameters, test=develop (#4154)

* Optimizer init with parameters, test=develop

* fix bug for eval, test=develop
上级 f1050475
......@@ -323,7 +323,7 @@ def train_ptb_lm():
lr_arr.append(new_lr)
sgd = SGDOptimizer(learning_rate=fluid.layers.piecewise_decay(
boundaries=bd, values=lr_arr))
boundaries=bd, values=lr_arr), parameter_list=ptb_model.parameters())
def eval(model, data):
print("begion to eval")
......@@ -338,8 +338,8 @@ def train_ptb_lm():
train_data_iter = reader.get_data_iter(data, batch_size, num_steps)
for batch_id, batch in enumerate(train_data_iter):
x_data, y_data = batch
x_data = x_data.reshape((-1, num_steps))
y_data = y_data.reshape((-1, 1))
x_data = x_data.reshape((-1, num_steps, 1))
y_data = y_data.reshape((-1, num_steps, 1))
x = to_variable(x_data)
y = to_variable(y_data)
init_hidden = to_variable(init_hidden_data)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册