If you slice a matrix in the ParallelRange matmul does not detect the change in dimension and fails:
res = af.constant(0,20,20,1000 )
left = af.constant(0, 20, 40)
right = af.constant(0, 40,20, 1000)
af.matmul(left, right[:,:,0]) # this works
for ii in af.ParallelRange(10):
res[:,:,ii] = af.matmul(left, right[:,:,ii]) #will fail