class_docstr: Resize the spatial dimensions (last two dimensions) of the first input
  according to the bounding boxes specified in the second input, using
  bilinear interpolation.
  
  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``.
  
  roi: tensor<[N,1,4,1,1], T> or tensor<[N,1,5,1,1], T> (Required)
      * Regions of interest, or coordinates of the boxes. The above input
        represents coordinates of ``N`` boxes.
      * The convention to express coordinates  depends on the value of the
        input ``box_coordinate_mode``.
      * Rank ``5``.
      * If ``tensor<[N,1,4,1,1], T>``: Resized images are computed for all
        ``B`` input images.
      * If ``tensor<[N,1,5,1,1], T>``: The first element from ``axis=-3``
        to be resized is an index. It must be within range ``[0, 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 same convention is used by the ``resize_bilinear`` op (see
        that op for details).
  
  See Also
  --------
  resize_bilinear
  
  Returns
  -------
  tensor<[N, B, C, target_height, target_width],T> or tensor<[N, 1, C, target_height, target_width],T>
      * Tensor with same type as the input.
      * If ``roi : tensor<[N,1,4,1,1], T>``, the output is
        ``tensor<[N, B, C, target_height, target_width],T>``.
        Total crops = ``N*B``; that is, ``N`` crops for each input in the batch.
      * If ``roi : tensor<[N,1,5,1,1], T>``, the output is
        ``tensor<[N, 1, C, target_height, target_width],T>``.
        Total crops = ``N``; that is, 1 crop for given input image index
        in the batch.
  
  Attributes
  ----------
  T: fp16, fp32
class_docstr_tok: ["Resize","the","spatial","dimensions","(","last","two","dimensions",")","of","the","first","input","according","to","the","bounding","boxes","specified","in","the","second","input",",","using","bilinear","interpolation",".","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","``",".","roi",":","tensor","<","[","N,1,4,1,1","]",",","T",">","or","tensor","<","[","N,1,5,1,1","]",",","T",">","(","Required",")","*","Regions","of","interest",",","or","coordinates","of","the","boxes",".","The","above","input","represents","coordinates","of","``","N","``","boxes",".","*","The","convention","to","express","coordinates","depends","on","the","value","of","the","input","``","box_coordinate_mode","``",".","*","Rank","``","5","``",".","*","If","``","tensor","<","[","N,1,4,1,1","]",",","T",">","``",":","Resized","images","are","computed","for","all","``","B","``","input","images",".","*","If","``","tensor","<","[","N,1,5,1,1","]",",","T",">","``",":","The","first","element","from","``","axis=-3","``","to","be","resized","is","an","index",".","It","must","be","within","range","``","[","0",",","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","same","convention","is","used","by","the","``","resize_bilinear","``","op","(","see","that","op","for","details",")",".","See","Also","--","--","--","--","resize_bilinear","Returns","--","--","--","-","tensor","<","[","N",",","B",",","C",",","target_height",",","target_width","]",",","T",">","or","tensor","<","[","N",",","1",",","C",",","target_height",",","target_width","]",",","T",">","*","Tensor","with","same","type","as","the","input",".","*","If","``","roi",":","tensor","<","[","N,1,4,1,1","]",",","T",">","``",",","the","output","is","``","tensor","<","[","N",",","B",",","C",",","target_height",",","target_width","]",",","T",">","``",".","Total","crops","=","``","N","*","B","``",";","that","is",",","``","N","``","crops","for","each","input","in","the","batch",".","*","If","``","roi",":","tensor","<","[","N,1,5,1,1","]",",","T",">","``",",","the","output","is","``","tensor","<","[","N",",","1",",","C",",","target_height",",","target_width","]",",","T",">","``",".","Total","crops","=","``","N","``",";","that","is",",","1","crop","for","given","input","image","index","in","the","batch",".","Attributes","--","--","--","--","--","T",":","fp16",",","fp32"]
code: def type_inference(self):
      self._validate_input()
      # ret_shape: [N] + [B, C, h_out, w_out]
      N, B, C = self.roi.shape[0], self.x.shape[0], self.x.shape[1]
      ret_shape = [
          N,
          B,
          C,
          self.target_height.val,
          self.target_width.val,
      ]
      return types.tensor(self.x.dtype, ret_shape)
  
imports: import numpy
  from coremltools.converters.mil.mil import DefaultInputs, InputSpec, Operation, TensorInputType, get_new_symbol, types
  from coremltools.converters.mil.mil.ops.defs._op_reqs import register_op
  from coremltools.converters.mil.mil.ops.defs.iOS15 import _IOS15_TARGET
  from coremltools.converters.mil.mil.types.symbolic import is_symbolic
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