text: Title: [Feature request] checking an input rank is within a specific range
  Body: ### What is the problem that this feature solves?
  
  Please keep in mind I am new to ONNX. I will be missing context on priorities with the code so this might be useless. 
  
   While looking into extending Microsoft's ORT functionality to accept a 5D input for Grid Sampling, I noticed it might be helpful to have shape inferencing capabilities to check an input's rank is within a range when you know the inputs rank ahead of time. 
  
  Currently `shape_inference.h` has 
  
  ```
  inline void checkInputRank(InferenceContext& ctx, size_t input_index, int expected_rank) {
    // We check the rank only if a rank is known for the input:
    if (hasInputShape(ctx, input_index)) {
      auto rank = getInputShape(ctx, input_index).dim_size();
      if (rank != expected_rank) {
        fail_shape_inference("Input ", input_index, " expected to have rank ", expected_rank, " but has rank ", rank);
      }
    }
  }
  ```
  which will work for only one rank. But if you want to extend an operators functionality to work within a certain range of ranks I believe it would be helpful to have an overload that will accept a range instead.
  
  ### Alternatives considered
  
  downstream code can use their own implementation by reusing functions like `hasInputShape`, `getInputShape` and `fail_shape_inference`. 
  
  ### Describe the feature
  
  if it makes sense for the operator to work with different ranks, downstream code will not need to define their own function.
  
  ### Will this influence the current api (Y/N)?
  
  no
  
  ### Feature Area
  
  shape_inference
  
  ### Are you willing to contribute it (Y/N)
  
  Yes
  
  ### Notes
  
  I understand this is quite small and insignificant. Figured it was a good entry point to get to contributing to ONNX. 