How to define a "quasi-dense" layer

I want to build a layer with Keras that densely connects n lower units to n upper units except for connexions (i,i) (lower unit i to upper unit i). My first idea was to define a dense layer and thereafter set the specific weights to 0 and set them non trainable. Is it possible with Keras?

Hi @geantbrun.
Could tf.keras.layers.Masking be what your looking for?