Added method to get the number of dimensions of the input.