pyyaml
pyyaml copied to clipboard
yaml.dump(torch.float32) produces a ValueError from Representer.represent_object
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.