pyyaml icon indicating copy to clipboard operation
pyyaml copied to clipboard

yaml.dump(torch.float32) produces a ValueError from Representer.represent_object

Open vttrifonov opened this issue 1 year ago • 1 comments

import torch
import yaml
yaml.dump(torch.float32)

produces

ValueError: dictionary update sequence element #0 has length 1; 2 is required

The issue is that torch.float32.__reduce_ex__ returns just a string and not a tuple. This is allowed by the pickle API but not handled right by PyYAML.

vttrifonov avatar Aug 25 '24 04:08 vttrifonov