ConfigDict()とは
This is a container for configurations. It behaves similarly to Lua tables.
Specifically:
- it has dot-based access as well as dict-style key access,
- it is type safe (once a value is set one cannot change its type).
Lua tables?
使ったことないからわからない。
簡単に辞書が作れるイメージで返り値はyamlっぽいやつ
from ml_collections import config_dict
dict_name = config_dict.ConfigDict()
dict_name.key = value
dict_name.new_dict = config_dict.ConfigDict()
dict_name.new_dict.new_key = new_value
dict_name.tuple = (0, 1)
print(dict_name)
# key: value
# new_dict:
# new_key: new_value
# tuple: !!python/tuple [0, 1]
# Pythonのdictでそれっぽく示すと以下の感じ
# dict_name = {'key': value,
# 'new_dict': {new_key: new_value}
# 'tuple': (0, 1)}
参考