未验证 提交 68c1fe8c 编写于 作者: J Jiangxinz 提交者: GitHub

fix undef var (#33692)

上级 49638f25
...@@ -16,6 +16,7 @@ from __future__ import print_function ...@@ -16,6 +16,7 @@ from __future__ import print_function
import paddle import paddle
from paddle.fluid import program_guard, layers, default_main_program from paddle.fluid import program_guard, layers, default_main_program
from paddle.fluid import default_startup_program
from .meta_optimizer_base import MetaOptimizerBase from .meta_optimizer_base import MetaOptimizerBase
from .common import OpRole, OP_ROLE_KEY, CollectiveHelper, is_update_op from .common import OpRole, OP_ROLE_KEY, CollectiveHelper, is_update_op
......
...@@ -120,7 +120,7 @@ def _restore_batch(flat_batch, structure): ...@@ -120,7 +120,7 @@ def _restore_batch(flat_batch, structure):
elif isinstance(field, (Sequence, Mapping)): elif isinstance(field, (Sequence, Mapping)):
field_idx = _restore(structure[k], field_idx) field_idx = _restore(structure[k], field_idx)
else: else:
raise TypeError("wrong flat data type: {}".format(type(batch))) raise TypeError("wrong flat data type: {}".format(type(structure)))
return field_idx return field_idx
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
import sys import sys
from .. import core from .. import core
from . import ps_instance from . import ps_instance
from google.protobuf import text_format
__all__ = ['Fleet'] __all__ = ['Fleet']
......
...@@ -46,7 +46,7 @@ class TestGroupNormOpError(unittest.TestCase): ...@@ -46,7 +46,7 @@ class TestGroupNormOpError(unittest.TestCase):
def test_x_type(): def test_x_type():
input = np.random.random(2, 100, 3, 5).astype('float32') input = np.random.random(2, 100, 3, 5).astype('float32')
goups = 2 groups = 2
fluid.layers.group_norm(input, groups) fluid.layers.group_norm(input, groups)
self.assertRaises(TypeError, test_x_type) self.assertRaises(TypeError, test_x_type)
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import warnings
from .optimizer import Optimizer from .optimizer import Optimizer
from ..fluid import core from ..fluid import core
from ..fluid import framework from ..fluid import framework
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册