Update configuration to str for tensorboard.
This commit is contained in:
parent
b3817f84fe
commit
e3493163f3
|
@ -74,15 +74,15 @@ class TrainConfig:
|
|||
|
||||
def class_to_dict(obj):
|
||||
if isinstance(obj, (int, float, str, bool, type(None))):
|
||||
return obj
|
||||
return str(obj)
|
||||
elif isinstance(obj, dict):
|
||||
return {k: class_to_dict(v) for k, v in obj.items()}
|
||||
elif isinstance(obj, list):
|
||||
return {str(index): value for index, value in enumerate(obj)}
|
||||
return {str(index): str(value) for index, value in enumerate(obj)}
|
||||
elif hasattr(obj, "__dict__"):
|
||||
return {k: class_to_dict(v) for k, v in obj.__dict__.items()}
|
||||
else:
|
||||
return obj
|
||||
return str(obj)
|
||||
|
||||
|
||||
# train_config = TrainConfig()
|
||||
|
|
Loading…
Reference in New Issue