提交 fb0e8026 编写于 作者: W wuzewu

add parameter process func

上级 2c045b9c
...@@ -61,6 +61,7 @@ def from_param_to_flexible_data(param, flexible_data): ...@@ -61,6 +61,7 @@ def from_param_to_flexible_data(param, flexible_data):
flexible_data.map.data['trainable']) flexible_data.map.data['trainable'])
from_pyobj_to_flexible_data(param.do_model_average, from_pyobj_to_flexible_data(param.do_model_average,
flexible_data.map.data['do_model_average']) flexible_data.map.data['do_model_average'])
#TODO(wuzewu): don't save learning rate
from_pyobj_to_flexible_data(param.optimize_attr, from_pyobj_to_flexible_data(param.optimize_attr,
flexible_data.map.data['optimize_attr']) flexible_data.map.data['optimize_attr'])
from_pyobj_to_flexible_data( from_pyobj_to_flexible_data(
...@@ -215,8 +216,14 @@ def set_parameter_trainable(program, trainable=True): ...@@ -215,8 +216,14 @@ def set_parameter_trainable(program, trainable=True):
param.trainable = trainable param.trainable = trainable
def set_parameter_regularization(program, regularization): def set_parameter_regularizer(program, regularizer):
pass for param in program.global_block().iter_parameters():
param.regularizer = regularizer
def set_parameter_learning_rate(program, learning_rate):
for param in program.global_block().iter_parameters():
param.optimize_attr['learning_rate'] = learning_rate
def set_op_attr(program, is_test=False): def set_op_attr(program, is_test=False):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册