未验证 提交 a12071ab 编写于 作者: H hutuxian 提交者: GitHub

add type check for initializer and regularizer in ParamAttr (#27720)

上级 fd616fad
...@@ -87,6 +87,10 @@ class ParamAttr(object): ...@@ -87,6 +87,10 @@ class ParamAttr(object):
check_type(learning_rate, "learning_rate", (float, int), "ParamAttr") check_type(learning_rate, "learning_rate", (float, int), "ParamAttr")
check_type(trainable, "trainable", (bool), "ParamAttr") check_type(trainable, "trainable", (bool), "ParamAttr")
check_type(do_model_average, "do_model_average", (bool), "ParamAttr") check_type(do_model_average, "do_model_average", (bool), "ParamAttr")
check_type(initializer, "initializer", (Initializer, type(None)),
"ParamAttr")
check_type(regularizer, "regularizer",
(WeightDecayRegularizer, type(None)), "ParamAttr")
self.name = name self.name = name
if self.name == "": if self.name == "":
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册