未验证 提交 56fd2e47 编写于 作者: H hong 提交者: GitHub

Pick dygraph use same name with static mode (#24011)

* change compare op fore_cpu true to false; test=develop

* unitize name in optimizer; test=develop

* remove force_cpu; test=develop
18 合并请求!26907Cherry pick fix eigen in pull sparse; fix hadoop command,!26904Fix/release/2.0 beta,!26184add mock barrier all,!26045Rel18,!25972[cherry-pick]: fix multhead matmul pass's instable bug,!25707[Cherry-pick] Fix DataLoader.generrator using error & Segmentation fault,!25566Cherry pick fix softamx with cross entropy out of bound,!25340Cherry mish op,!24986Fix elementwise div,!24868Cherry pick elementwise bug fix from develop branch,!24867Cherry pick elementwise bug fix from develop branch,!24843Enhance error message,!24667API/OP(sequence_first_step,sequence_last_step,sequence_mask,beam_search,beam_search_decode) error message enhancement ,test=release/1.8,!24470[Cherry pick] Enhance error message of prefetch_op, proximal_adagrad_op, proximal_gd_op,!24381Release/1.8,!24224release/2.0-beta cherry-pick 23797,!24198Cherry pick #24177,!24168[Cherry-Pick] [2.0-beta] error enhancement
...@@ -68,16 +68,13 @@ class Optimizer(object): ...@@ -68,16 +68,13 @@ class Optimizer(object):
grad_clip=None, grad_clip=None,
name=None): name=None):
self._parameter_list = parameter_list self._parameter_list = parameter_list
self._name = name
if framework.in_dygraph_mode(): if framework.in_dygraph_mode():
if not isinstance(learning_rate, float) and \ if not isinstance(learning_rate, float) and \
not isinstance(learning_rate, LearningRateDecay): not isinstance(learning_rate, LearningRateDecay):
raise TypeError( raise TypeError(
"learning rate should be float or LearningRateDecay, got %s here" "learning rate should be float or LearningRateDecay, got %s here"
% type(learning_rate)) % type(learning_rate))
if name is not None:
self._name = unique_name.generate(name)
else:
self._name = unique_name.generate(self.__class__.__name__)
if self._parameter_list is None: if self._parameter_list is None:
raise AttributeError( raise AttributeError(
"parameter_list argument given to the Optimizer should not be None in dygraph mode." "parameter_list argument given to the Optimizer should not be None in dygraph mode."
...@@ -96,7 +93,6 @@ class Optimizer(object): ...@@ -96,7 +93,6 @@ class Optimizer(object):
raise TypeError( raise TypeError(
"learning rate should be float or Variable, got %s here" % "learning rate should be float or Variable, got %s here" %
type(learning_rate)) type(learning_rate))
self._name = name
if grad_clip is not None: if grad_clip is not None:
if not isinstance(grad_clip, GradientClipBase): if not isinstance(grad_clip, GradientClipBase):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部