Thanks @Emre_Yalcinoglu for the reply.
I have one more confusion.
Say we have a Tensor-B of shape 12x12. (Which we can imagine, is divided in small matrices of 4x4 both row and columnwise.) And initially B contains only 1s and 2s.
Now, I want to replace all the entries of main diagonal+(5th ,6th ,7th ,9th ,10th ,11th) upper and lower diagonals, by 3s. I don’t know what would be a faster way.