I am trying to load a dataset using the tf.data.Dataset.from_tensor_slices
command.
My input is a list of nested dictionaries in the following format:
a_dict = { 'a' : 'blablabla',
'b' : {
'c': (tf.constant([[0.390, 0.146]])),
'd': (tf.constant([0]))
}
}
b_dict = { 'a' : 'blablabla',
'b' : {
'c': (tf.constant([[0.453, 0.655], [0.345, 0.784]])),
'd': (tf.constant([0, 0]))
}
}
Update:
Deserializing the input won't work, since the command:
(dataset = tf.data.Dataset.from_tensor_slices(pd.DataFrame.from_dict(pd.json_normalize(train_data)).to_dict(orient="list")))
will give an error
"Shapes of all inputs must match:"
Does anyone have an idea how to load data from a list of nested dictionaries with different structure using tf.dataset?
Thank you in advance!