Skip to main content

deserialize_dshape

Function deserialize_dshape 

Source
pub fn deserialize_dshape<'de, D>(
    deserializer: D,
) -> Result<Vec<(DimName, usize)>, D::Error>
where D: Deserializer<'de>,
Expand description

Deserialize dshape from either array-of-tuples or array-of-single-key-dicts.

The metadata spec produces [{"batch": 1}, {"num_features": 84}] (dict format), while serde’s default Vec<(A, B)> expects [["batch", 1]] (tuple format). This deserializer accepts both.