forked from mindspore-Ecosystem/mindspore
!26950 fix type error when summary collect dataset graph
Merge pull request !26950 from jiangshuqiang/add_none_warning
This commit is contained in:
commit
7605e9f653
|
@ -100,6 +100,10 @@ class DatasetGraph:
|
||||||
operation (dict): Enhancement operation.
|
operation (dict): Enhancement operation.
|
||||||
message (Operation): Enhancement operation proto message.
|
message (Operation): Enhancement operation proto message.
|
||||||
"""
|
"""
|
||||||
|
if operation is None:
|
||||||
|
logger.warning("Summary cannot collect the operation for dataset graph as the operation is none."
|
||||||
|
"it may due to the custom operation cannot be pickled.")
|
||||||
|
return
|
||||||
for key, value in operation.items():
|
for key, value in operation.items():
|
||||||
if isinstance(value, (list, tuple)):
|
if isinstance(value, (list, tuple)):
|
||||||
if all(isinstance(ele, int) for ele in value):
|
if all(isinstance(ele, int) for ele in value):
|
||||||
|
@ -129,7 +133,7 @@ class DatasetGraph:
|
||||||
message.mapDouble[key] = value
|
message.mapDouble[key] = value
|
||||||
elif isinstance(value, (list, tuple)) and key != "operations":
|
elif isinstance(value, (list, tuple)) and key != "operations":
|
||||||
if value:
|
if value:
|
||||||
replace_value_list = list(map(lambda x: "" if x is None else x, value))
|
replace_value_list = list(map(lambda x: "" if x is None else json.dumps(x), value))
|
||||||
message.mapStrList[key].strValue.extend(replace_value_list)
|
message.mapStrList[key].strValue.extend(replace_value_list)
|
||||||
elif isinstance(value, dict):
|
elif isinstance(value, dict):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue