This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dkostecki
Recipients dkostecki
Date 2020-12-02.06:23:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606890196.44.0.812849435025.issue42530@roundup.psfhosted.org>
In-reply-to
Content
torch.nn.functional.nll_loss returns Tensor objects which contain a loss value as well as a grad_fn object. Pickle does not throw an exception when serializing (dumps) the Tensor object. When loading (loads) the serialized data, the grad_fn object is lost and it becomes a requires_grad object. 

However, if one attempts to serialize the grad_fn object encapsulated in the Tensor object, Pickle then throws a TypeError (TypeError: cannot pickle 'NllLossBackward' object). This behavior seems inconsistent. Perhaps serialization of NllLossBackward objects should be supported or their encapsulating Tensors should also throw a TypeError.

This behavior should be easily reproducible.
History
Date User Action Args
2020-12-02 06:23:16dkosteckisetrecipients: + dkostecki
2020-12-02 06:23:16dkosteckisetmessageid: <1606890196.44.0.812849435025.issue42530@roundup.psfhosted.org>
2020-12-02 06:23:16dkosteckilinkissue42530 messages
2020-12-02 06:23:16dkosteckicreate