Dataset: serializer return padd_sample as json str for record

This commit is contained in:
kouzhenzhong 2020-06-17 20:13:24 +08:00
parent fce37a5fbe
commit 98c1f6f876
1 changed files with 3 additions and 0 deletions

View File

@ -156,6 +156,9 @@ def traverse(node):
serialize_operations(node_repr, k, v)
elif k == 'sampler':
serialize_sampler(node_repr, v)
elif k == 'padded_sample' and v:
v1 = {key: value for key, value in v.items() if not isinstance(value, bytes)}
node_repr[k] = json.dumps(v1, indent=2)
# return schema json str if its type is mindspore.dataset.Schema
elif k == 'schema' and isinstance(v, de.Schema):
node_repr[k] = v.to_json()