Gradient of a Theano custom operator returning a matrix

Is your grad operation performed on matrix? I am a bit confuse - why not take gradient of each input directly?