MetaModel should have a dictionary interface only
Created by: Zaharid
The meta model class here https://github.com/NNPDF/nnpdf/blob/94b80c35618bd55ae463b5806bf2b5886f6ecad6/n3fit/src/n3fit/backends/keras_backend/MetaModel.py#L83 is supposed to be a thin wrapper over a Keras model, where one of the differences is that it works around the peculiarity of keras where one has to bend over backwards to pass constant tensors to layers (i.e. https://github.com/keras-team/keras/issues/11912).
However the way in which it does it is a bit convoluted. One can pass a dictionary like for a keras model, but then the information of the keys is discarded,
and new keys are added, with some complicated logic
which happens on depend on the keras logic not doing things like
In [1]: import tensorflow as tf
In [2]: name = "I really want this name"
In [3]: print(tf.keras.Input(tensor=tf.constant([1,2,3], name=name), name=name).name)
None
and then more cumbersome logic to recall the proper inputs, like e.g.
which can get tricky both for the class and the caller.
I think a better way would be to mandate that the input argument is only allowed to be a dict, and similarly allow only dict predictions and similar. Then the keys are the users responsibility, and we can easily produce better errors if some input is not given, rather than some hard to decipher message down the line.