• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020-2021 Huawei Technologies Co., Ltd
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ============================================================================
15"""Summary's enumeration file."""
16from enum import Enum
17
18
19class BaseEnum(Enum):
20    """The base enum class."""
21
22    @classmethod
23    def to_list(cls):
24        """Converts the enumeration into a list."""
25        return [member.value for member in cls.__members__.values()]
26
27
28class PluginEnum(BaseEnum):
29    """The list of plugins currently supported by the summary."""
30    GRAPH = 'graph'
31    SCALAR = 'scalar'
32    IMAGE = 'image'
33    TENSOR = 'tensor'
34    HISTOGRAM = 'histogram'
35    TRAIN_LINEAGE = 'train_lineage'
36    EVAL_LINEAGE = 'eval_lineage'
37    CUSTOM_LINEAGE_DATA = 'custom_lineage_data'
38    DATASET_GRAPH = 'dataset_graph'
39    EXPLAINER = 'explainer'
40
41
42class WriterPluginEnum(Enum):
43    """The list of extra plugins."""
44    EXPORTER = 'exporter'
45    EXPLAINER = 'explainer'
46    SUMMARY = 'summary'
47    LINEAGE = 'lineage'
48
49
50class ModeEnum(BaseEnum):
51    """The modes currently supported by the summary."""
52    TRAIN = 'train'
53    EVAL = 'eval'
54