Parameter with constraints

Hello,

I was figuring out a way to define parameters with certain constraints. For example, a matrix with some values being zero: A = [B, 0].

If I were to use A myself, say y = Ax, I can just define B instead and do y = Bx_1, and forward / backward on B gives the right thing. But if, say, I’d like to use A as the transition matrix of an RNN, then I have to pass in the full A, and specify that only the B block is trainable. Is there a way to achieve that?

Thanks!