sorry, can’t find the correct topic for issue described.
please see attached image
what would be the proper way to store new attributes with torch.parameter? Let me be specific, i need to create new attribute to pytorch parameters, and store into pickle.
EDIT:
import torch
import pickle
test_param = torch.nn.Parameter(torch.rand(2, 2))
test_param._new_param = 10
print(f'{test_param._new_param = }') # this prints 'test_param.new_param = 10'
pickle.dump(test_param, open('test.pickle', 'wb'))
new_param = pickle.load(open('test.pickle', 'rb'))
print(f'{hasattr(new_param, "_new_param") = }') # this prints 'hasattr(new_param, "new_param") = False'
print(f'{new_param._new_param = }') # this bugs with attribute error
# what would be the correct way to store new attributes into torch.Parameter
# and be able to access it when loading from pickle file?