!28636 fix landscape warning

Merge pull request !28636 from Songyuanwei/landscape
This commit is contained in:
i-robot 2022-01-06 11:27:19 +00:00 committed by Gitee
commit 64bbece74c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
# Copyright 2021 Huawei Technologies Co., Ltd
# Copyright 2021-2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -764,6 +764,13 @@ class SummaryLandscape:
metrics[key] = value.eval()
return metrics
@staticmethod
def _check_unit(unit):
"""Check unit type and value."""
check_value_type('unit', unit, str)
if unit not in ["step", "epoch"]:
raise ValueError(f'Unit should be step or epoch, but got the: {unit}')
@staticmethod
def _check_landscape_size(landscape_size):
"""Check landscape size type and value."""
@ -772,13 +779,6 @@ class SummaryLandscape:
if landscape_size < 3 or landscape_size > 256:
raise ValueError(f'Landscape size should be between 3 and 256, but got the: {landscape_size}')
@staticmethod
def _check_unit(unit):
"""Check unit type and value."""
check_value_type('unit', unit, str)
if unit not in ["step", "epoch"]:
raise ValueError(f'Unit should be step or epoch, but got the: {unit}')
@staticmethod
def _check_create_landscape(create_landscape):
"""Check create landscape type and value."""

View File

@ -372,7 +372,7 @@ class SummaryCollector(Callback):
f'but got the: {landscape_size}')
@staticmethod
def _check_unit(unit):
def _check_unit(unit):
"""Check unit type and value."""
check_value_type('unit', unit, str)
if unit not in ["step", "epoch"]: