I made a vectorized implementation on Gist: block_diag.py at https://gist.github.com/yulkang/2e4fc3061b45403f455d7f4c316ab168 43
For an up-to-date version, check block_diag() in numpytorch.py in my pylabyk library: https://github.com/yulkang/pylabyk/blob/master/numpytorch.py 46