提交 0f753517 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!417 fix parse_columns help format error in web

Merge pull request !417 from anzhengqi/fix-commit-format-error
......@@ -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):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册