strict (bool): whether to strictly enforce that the keys in
:attr:`state_dict` with :attr:`prefix` match the names of
parameters and buffers in this module
- missing_keys (list of str): if ``strict=False``, add missing keys to
+ missing_keys (list of str): if ``strict=True``, add missing keys to
this list
- unexpected_keys (list of str): if ``strict=False``, add unexpected
+ unexpected_keys (list of str): if ``strict=True``, add unexpected
keys to this list
error_msgs (list of str): error messages should be added to this
list, and will be reported together in
missing_keys.append(key)
if strict:
- for key, input_param in state_dict.items():
+ for key in state_dict.keys():
if key.startswith(prefix):
input_name = key[len(prefix):]
input_name = input_name.split('.', 1)[0] # get the name of param/buffer/child