makinacorpus / easydict

Access dict values as attributes (works recursively)
GNU Lesser General Public License v3.0
293 stars 48 forks source link

Flatten unflatten easydict #49

Open adonnini opened 4 months ago

adonnini commented 4 months ago

Hi, I am using easydict in my location prediction application. I need to register the EasyDict as a pytree node with register_pytree_node In order to do this I need to supply flatten and unflatten functions for easyDct. Do you have code for flattening/unflattening easyDict. Could you give me an example? Thanks, AlexDonnini

WaterLoran commented 4 months ago

I don't know if you want to convert this easydict back to a regular dictionary. If so, please refer to my issue, I have already resolved it

https://github.com/makinacorpus/easydict/issues/48

adonnini commented 4 months ago

Thanks. No, I don't want to convert easydict to a regular dictionary, I just want functions to flatten and unflatten it as I need them for an app where I need to apply https://github.com/pytorch/pytorch/blob/394ec2da300e8933d8184ba862daed3a115d7fd9/torch/utils/_pytree.py#L163 to easyDict.