未验证 提交 1ed1a97b 编写于 作者: S sneaxiy 提交者: GitHub

Fix cv2 import error and some issues for lamb (#41500)

* fix image cv2 import

* fix lamb
上级 0cd577cf
...@@ -54,7 +54,10 @@ if six.PY3: ...@@ -54,7 +54,10 @@ if six.PY3:
if retcode != 0: if retcode != 0:
cv2 = None cv2 = None
else: else:
import cv2 try:
import cv2
except ImportError:
cv2 = None
else: else:
try: try:
import cv2 import cv2
......
...@@ -17,7 +17,7 @@ from paddle.fluid.framework import Variable ...@@ -17,7 +17,7 @@ from paddle.fluid.framework import Variable
from paddle.fluid.clip import ClipGradByGlobalNorm from paddle.fluid.clip import ClipGradByGlobalNorm
from paddle.fluid.initializer import Constant from paddle.fluid.initializer import Constant
from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.layer_helper import LayerHelper
from paddle.optimizer import Optimizer from paddle.fluid.optimizer import Optimizer
from paddle.distributed import get_rank, get_world_size from paddle.distributed import get_rank, get_world_size
from paddle.fluid.executor import global_scope from paddle.fluid.executor import global_scope
from paddle.fluid.framework import name_scope from paddle.fluid.framework import name_scope
...@@ -42,11 +42,7 @@ class DistributedFusedLamb(Optimizer): ...@@ -42,11 +42,7 @@ class DistributedFusedLamb(Optimizer):
assert not framework._non_static_mode( assert not framework._non_static_mode(
), "DistributedFusedLamb does not support dygraph mode" ), "DistributedFusedLamb does not support dygraph mode"
super(DistributedFusedLamb, self).__init__( super(DistributedFusedLamb, self).__init__(
learning_rate=learning_rate, learning_rate=learning_rate, grad_clip=None, name=name)
parameters=parameters,
weight_decay=None,
grad_clip=None,
name=name)
self._beta1 = beta1 self._beta1 = beta1
self._beta2 = beta2 self._beta2 = beta2
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册