MultiDense doesn't work with Tensorflow 2.16 / py3.12

Created by: scarlehoff

The layer type MultiDense is not compatible with tensorflow 2.16 (which is the only version supporting 3.12 at the moment https://github.com/tensorflow/tensorflow/releases/tag/v2.16.0-rc0)

https://github.com/NNPDF/nnpdf/actions/runs/8109403926/job/22164511598#step:6:1653

I'm not sure which one of the breaking changes is triggering that. I tried installing tf-keras 2.16 and using TF_USE_LEGACY_KERAS=1 but that triggered a different error, so I think it is better to make it compatible with keras 3 anyway (in case that's the problem).

Copying the error here in case the log from the test is cleared:

self = <MultiDense name=multi_dense_12, built=False>, input_shape = (1, None, 2)

    def build(self, input_shape):
        input_dim = input_shape[-1]
>       self.kernel = self.add_weight(
            name="kernel",
            shape=(self.replicas, input_dim, self.units),
            initializer=self.kernel_initializer,
            regularizer=self.kernel_regularizer,
            constraint=self.kernel_constraint,
        )
E       AttributeError: property 'kernel' of 'MultiDense' object has no setter