From 34298e21358b7eca2995d3643fc55288b709733e Mon Sep 17 00:00:00 2001 From: anzhengqi Date: Fri, 17 Apr 2020 12:04:50 +0800 Subject: [PATCH] fix commit format error --- mindspore/dataset/engine/datasets.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mindspore/dataset/engine/datasets.py b/mindspore/dataset/engine/datasets.py index 1c6ac634f2..4cff9c57b9 100644 --- a/mindspore/dataset/engine/datasets.py +++ b/mindspore/dataset/engine/datasets.py @@ -2597,19 +2597,24 @@ class Schema: Args: columns (dict or list[dict]): dataset attribution information, decoded from schema file. - if list: columns element must be dict, 'name' and 'type' must be in keys, 'shape' optional. - if dict: columns.keys() as name, element in columns.values() is dict, and 'type' inside, 'shape' optional. - example 1) - [{'name': 'image', 'type': 'int8', 'shape': [3, 3]}, - {'name': 'label', 'type': 'int8', 'shape': [1]}] - example 2) - {'image': {'shape': [3, 3], 'type': 'int8'}, 'label': {'shape': [1], 'type': 'int8'}} + + - list[dict], 'name' and 'type' must be in keys, 'shape' optional. + + - dict, columns.keys() as name, columns.values() is dict, and 'type' inside, 'shape' optional. Raises: RuntimeError: If failed to parse columns. RuntimeError: If unknown items in columns. RuntimeError: If column's name field is missing. RuntimeError: If column's type field is missing. + + Example: + >>> schema = Schema() + >>> columns1 = [{'name': 'image', 'type': 'int8', 'shape': [3, 3]}, + >>> {'name': 'label', 'type': 'int8', 'shape': [1]}] + >>> schema.parse_columns(columns1) + >>> columns2 = {'image': {'shape': [3, 3], 'type': 'int8'}, 'label': {'shape': [1], 'type': 'int8'}} + >>> schema.parse_columns(columns2) """ self.columns = [] if isinstance(columns, list):