How to create a specific form of parameter matrix in the network

Create a matrix in the network as shown in the figure below
In the matrix, only the diagonal line and its two sides have parameters, and all other positions are zero. In the training phase, only the position of the parameter is adjusted, and the value of zero remains unchanged.The same symbol represents the same parameter