class_docstr: The major differences between this version and the iOS 16 :py:class:`~.iOS16.image_resizing.crop_resize`
  are as follows:
  
  - The input ``ROI`` is replaced by ``boxes`` and ``box_indices``.
  - The dtype domain of input ``x``, ``boxes``, and ``box_indices`` are independent.
  - The output no longer has the ``B`` dim. The output is ``[N, C, target_height, target_width]``
    rather than the ``[N, B, C, target_height, target_width]`` in iOS 16.
  
  Parameters
  ----------
  x: tensor<[B, C, H, W], T> (Required)
      * The input, from which patches (regions of interest) are extracted
        and resized using bilinear interpolation.
      * Rank ``4``.
  
  boxes: tensor<[N, 4], BOX_T> (Required)
      * Coordinates of ``N`` boxes.
      * The convention to express coordinates depends on the value of ``box_coordinate_mode``.
      * If ``normalized_coordinates`` is True, only fp16 and fp32 dtypes are allowed.
  
  box_indices: tensor<[N], BOX_INDEX_T> (Optional)
      * Default is ``arange(N)``, or ``[0, 1, ..., N-1]``.
      * If ``box_indices[i]=j``, this means that ``boxes[i]`` will be applied to the ``j``-th image.
        Therefore, it is invalid for ``box_indices[i]`` to be greater than ``B``.
  
  target_height: const<i32> (Optional, Default=1)
      * Target height for resizing each patch.
  
  target_width: const<i32> (Optional, Default=1)
      * Target width for resizing each patch.
  
  normalized_coordinates : const<bool> (Optional, default=False)
      * If ``True``, the bounding box coordinates must be in the
        interval ``[0, 1]``. Scaling is based on the input spatial
        dimensions: ``(H_in - 1)`` for height and ``(W_in - 1)`` for width.
      * If ``False``, the bounding box coordinates must be in the interval
        ``[0, H_in - 1]`` for height dimensions and ``[0, W_in - 1]`` for
        width dimensions.
  
  spatial_scale : const<fp32> (Optional, default=1.0)
      * Additional spatial scale that multiplies the bounding box coordinates.
      * You would use this to implement the RoI Align layer, which typically
        uses unnormalized RoI coordinates along with a spatial scale that is
        less than or equal to ``1``.
  
  box_coordinate_mode: const<str> (Optional, default="CORNERS_HEIGHT_FIRST")
      * Specifies the convention for specifying the four bounding box
        coordinates for an image of size ``(Height, Width)``. The ``(0,0)``
        coordinate corresponds to the top-left corner of the image.
      * This parameter can take one of four values:
  
        ``"CORNERS_HEIGHT_FIRST"``: ``[h_start, w_start, h_end, w_end]``
  
        ``"CORNERS_WIDTH_FIRST"``: ``[w_start, h_start, w_end, h_end]``
  
        ``"CENTER_SIZE_HEIGHT_FIRST"``: ``[h_center, w_center, box_height, box_width]``
  
        ``"CENTER_SIZE_WIDTH_FIRST"``: ``[w_center, h_center, box_width, box_height]``
  
  sampling_mode : const<str> (Optional, default="DEFAULT")
      * This parameter can take ``"STRICT_ALIGN_CORNERS"``,
        ``"ALIGN_CORNERS"``, ``"DEFAULT"``, ``"OFFSET_CORNERS"`` or
        ``UNALIGN_CORNERS`` as values.
      * This is the same convention used by the :py:class:`~.iOS15.image_resizing.resize_bilinear` op.
  
  pad_value : const<T> (Optional, default=0.0)
      * If the box indexes go beyond the input boundary, the input image is padded with ``pad_value``.
      * Defaults to ``0``.
      * It is the same as ``extrapolation_value`` in `tf.image.crop_and_resize <https://www.tensorflow.org/api_docs/python/tf/image/crop_and_resize>`_.
  
  Returns
  -------
  tensor<[N, C, target_height, target_width], T>
  
  Attributes
  ----------
  T: fp16, fp32
  BOX_T: fp16, fp32, uint16
  BOX_INDEX_T: uint16, int32
class_docstr_tok: ["The","major","differences","between","this","version","and","the","iOS","16",":","py",":","class",":","`","~.iOS16.image_resizing.crop_resize","`","are","as","follows",":","-","The","input","``","ROI","``","is","replaced","by","``","boxes","``","and","``","box_indices","``",".","-","The","dtype","domain","of","input","``","x","``",",","``","boxes","``",",","and","``","box_indices","``","are","independent",".","-","The","output","no","longer","has","the","``","B","``","dim",".","The","output","is","``","[","N",",","C",",","target_height",",","target_width","]","``","rather","than","the","``","[","N",",","B",",","C",",","target_height",",","target_width","]","``","in","iOS","16",".","Parameters","--","--","--","--","--","x",":","tensor","<","[","B",",","C",",","H",",","W","]",",","T",">","(","Required",")","*","The","input",",","from","which","patches","(","regions","of","interest",")","are","extracted","and","resized","using","bilinear","interpolation",".","*","Rank","``","4","``",".","boxes",":","tensor","<","[","N",",","4","]",",","BOX_T",">","(","Required",")","*","Coordinates","of","``","N","``","boxes",".","*","The","convention","to","express","coordinates","depends","on","the","value","of","``","box_coordinate_mode","``",".","*","If","``","normalized_coordinates","``","is","True",",","only","fp16","and","fp32","dtypes","are","allowed",".","box_indices",":","tensor","<","[","N","]",",","BOX_INDEX_T",">","(","Optional",")","*","Default","is","``","arange","(","N",")","``",",","or","``","[","0",",","1",",","...",",","N-1","]","``",".","*","If","``","box_indices","[","i","]","=j","``",",","this","means","that","``","boxes","[","i","]","``","will","be","applied","to","the","``","j","``","-th","image",".","Therefore",",","it","is","invalid","for","``","box_indices","[","i","]","``","to","be","greater","than","``","B","``",".","target_height",":","const","<","i32",">","(","Optional",",","Default=1",")","*","Target","height","for","resizing","each","patch",".","target_width",":","const","<","i32",">","(","Optional",",","Default=1",")","*","Target","width","for","resizing","each","patch",".","normalized_coordinates",":","const","<","bool",">","(","Optional",",","default=False",")","*","If","``","True","``",",","the","bounding","box","coordinates","must","be","in","the","interval","``","[","0",",","1","]","``",".","Scaling","is","based","on","the","input","spatial","dimensions",":","``","(","H_in","-","1",")","``","for","height","and","``","(","W_in","-","1",")","``","for","width",".","*","If","``","False","``",",","the","bounding","box","coordinates","must","be","in","the","interval","``","[","0",",","H_in","-","1","]","``","for","height","dimensions","and","``","[","0",",","W_in","-","1","]","``","for","width","dimensions",".","spatial_scale",":","const","<","fp32",">","(","Optional",",","default=1.0",")","*","Additional","spatial","scale","that","multiplies","the","bounding","box","coordinates",".","*","You","would","use","this","to","implement","the","RoI","Align","layer",",","which","typically","uses","unnormalized","RoI","coordinates","along","with","a","spatial","scale","that","is","less","than","or","equal","to","``","1","``",".","box_coordinate_mode",":","const","<","str",">","(","Optional",",","default=","''","CORNERS_HEIGHT_FIRST","''",")","*","Specifies","the","convention","for","specifying","the","four","bounding","box","coordinates","for","an","image","of","size","``","(","Height",",","Width",")","``",".","The","``","(","0,0",")","``","coordinate","corresponds","to","the","top-left","corner","of","the","image",".","*","This","parameter","can","take","one","of","four","values",":","``","``","CORNERS_HEIGHT_FIRST","''","``",":","``","[","h_start",",","w_start",",","h_end",",","w_end","]","``","``","``","CORNERS_WIDTH_FIRST","''","``",":","``","[","w_start",",","h_start",",","w_end",",","h_end","]","``","``","``","CENTER_SIZE_HEIGHT_FIRST","''","``",":","``","[","h_center",",","w_center",",","box_height",",","box_width","]","``","``","``","CENTER_SIZE_WIDTH_FIRST","''","``",":","``","[","w_center",",","h_center",",","box_width",",","box_height","]","``","sampling_mode",":","const","<","str",">","(","Optional",",","default=","''","DEFAULT","''",")","*","This","parameter","can","take","``","``","STRICT_ALIGN_CORNERS","''","``",",","``","``","ALIGN_CORNERS","''","``",",","``","``","DEFAULT","''","``",",","``","``","OFFSET_CORNERS","''","``","or","``","UNALIGN_CORNERS","``","as","values",".","*","This","is","the","same","convention","used","by","the",":","py",":","class",":","`","~.iOS15.image_resizing.resize_bilinear","`","op",".","pad_value",":","const","<","T",">","(","Optional",",","default=0.0",")","*","If","the","box","indexes","go","beyond","the","input","boundary",",","the","input","image","is","padded","with","``","pad_value","``",".","*","Defaults","to","``","0","``",".","*","It","is","the","same","as","``","extrapolation_value","``","in","`","tf.image.crop_and_resize","<","https",":","\/\/www.tensorflow.org\/api_docs\/python\/tf\/image\/crop_and_resize",">","`","_",".","Returns","--","--","--","-","tensor","<","[","N",",","C",",","target_height",",","target_width","]",",","T",">","Attributes","--","--","--","--","--","T",":","fp16",",","fp32","BOX_T",":","fp16",",","fp32",",","uint16","BOX_INDEX_T",":","uint16",",","int32"]
code: def type_inference(self):
      self._validate_input()
      # Output shape is [N, C, h_out, w_out].
      ret_shape = [
          self.boxes.shape[0],
          self.x.shape[1],
          self.target_height.val,
          self.target_width.val,
      ]
      return types.tensor(self.x.dtype, ret_shape)
  
file_path: coremltools/coremltools/converters/mil/mil/ops/defs/iOS17/image_resizing.py
imports: import numpy
  from coremltools.converters.mil.mil import Operation, get_new_symbol, types
  from coremltools.converters.mil.mil.input_type import DefaultInputs, InputSpec, TensorInputType
  from coremltools.converters.mil.mil.ops.defs._op_reqs import register_op
  from coremltools.converters.mil.mil.ops.defs.iOS16.image_resizing import crop_resize
  from coremltools.converters.mil.mil.ops.defs.iOS16.image_resizing import resample
  from coremltools.converters.mil.mil.ops.defs.iOS17 import _IOS17_TARGET
label_desc: Use image node_id 3 for calling the crop_resize obj's underlying member method code with example usage: obj.type_inference() and returns: types