get_default_serialize_fn_map#

torch_brain.data.get_default_serialize_fn_map()[source]#

Returns the default serialization map used when saving Data to HDF5.

torch_brain.data.Data.to_hdf5() uses this map to serialize attribute values whose types HDF5 cannot store natively. By default it maps:

A fresh copy is returned on every call, so mutating the result never affects the global default. You can extend the returned map to support additional types:

serialize_fn_map = get_default_serialize_fn_map()
serialize_fn_map[MyType] = my_serialize_fn
data.to_hdf5(file, serialize_fn_map=serialize_fn_map)
Return type:

dict[type, Callable]

Returns:

A copy of the default mapping from type to serialization function.