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

Create a matrix in the network as shown in the figure below
%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20180620093314
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