Dealing with potentially sparse trainable weights

I’m wondering what’s the Tensorflow way of storing and performing Tensor manipulation (i.e. Tensor multiplication, apply_gradient) of trainable weights in a custom layer that could potentially be sparse based on user specification. I’ve looked into

https://www.tensorflow.org/api_docs/python/tf/boolean_mask

and

https://www.tensorflow.org/api_docs/python/tf/RaggedTensor

but I’m not sure if it’s possible to apply these as ways to store and update trainable weights.

Have you already take a look at: