Added dimension method to batchgrad