From af5d23892c701b858799a698bfadac746ac31ac7 Mon Sep 17 00:00:00 2001 From: EnricoTrizio Date: Thu, 14 Nov 2024 09:54:13 +0100 Subject: [PATCH] Fixed metadata initialization --- mlcolvar/data/dataset.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mlcolvar/data/dataset.py b/mlcolvar/data/dataset.py index 72b7692..1fa1bdc 100644 --- a/mlcolvar/data/dataset.py +++ b/mlcolvar/data/dataset.py @@ -45,6 +45,10 @@ def __init__(self, dictionary: dict=None, feature_names = None, metadata: dict = if len(dictionary) == 0: raise ValueError("Empty datasets are not supported") + # initialize metadata as dict + if metadata is None: + metadata = {} + # convert to torch.Tensors for key, val in dictionary.items(): if not isinstance(val, torch.Tensor):