class_docstr: Reshape a tensor to an output shape specified by some or all dimensions of a tuple of reference tensors ``ref_tensors``.
  
  Parameters
  ----------
  x: tensor<\*?, T> (Required)
      * The input tensor to be reshaped.
  
  ref_tensors: Tuple[tensor<\*?, R>] (Required)
      * A tuple of tensors that define the output shape.
  
  begins: Tuple[const<int32>] (Required)
      * A tuple of integers specifying the begin index into the shape vector of the corresponding ``ref_tensor``.
  
  ends: Tuple[const<int32>] (Required)
      * A tuple of integers specifying the end index into the shape vector of the corresponding ``ref_tensor``.
  
  end_masks: Tuple[const<bool>] (Required)
      * If ``True``, select all axes from the begin index until the end of the corresponding ``ref_tensor``, as in
        ``ref_tensors[i].shape[begins[i]:]``.
  
  Notes
  -----
  The output shape is computed as follows:
  
  .. sourcecode:: python
  
      output_shape = []
      num_of_refs = len(begins)
      for i in range(num_of_refs):
          if end_masks[i]:
              output_shape.append(ref_tensor_i.shape[begins[i]:])
          else:
              output_shape.append(ref_tensor_i.shape[begins[i]:ends[i]])
      output_shape = np.concat(output_shape, axis=0)
  
  The following is an example:
  
  .. sourcecode:: python
  
      ref_tensors=[tensor[2, 3, 4], tensor[1, 5, 6]]
      begins=[0, 1]
      ends=[2, 0]
      end_masks=[False, True]
  
  The output shape would be ``(2, 3, 5, 6)``.
  
  Returns
  -------
  tensor<\*?, T>
      * Same type as input tensor ``x``.
      * Output shape is computed by ``ref_tensors``, ``begins``, ``ends``, and ``end_masks``.
  
  Attributes
  ----------
  T: fp16, fp32, i32, bool
  R: fp16, fp32, i32, bool
code: def type_inference(self):
      # Validation the inputs
      ref_number = len(self.ref_tensors)
      if (
          len(self.begins) != ref_number
          or len(self.ends) != ref_number
          or len(self.end_masks) != ref_number
      ):
          msg = (
              "Op reshape_like {}'s ref_tensors, begins, ends and end_masks must have exactly the same length. "
              "Got {}, {}, {} and {}."
          ).format(
              self.name,
              ref_number,
              len(self.begins),
              len(self.ends),
              len(self.end_masks),
          )
  
      self._check_is_const_tuple_with_scalar(
          self.begins, types.int32, "begins"
      )
      self._check_is_const_tuple_with_scalar(
          self.ends, types.int32, "ends"
      )
      self._check_is_const_tuple_with_scalar(
          self.end_masks, types.bool, "end_masks"
      )
  
      # Compute the output shape
      out_shape = ()
      for ref_tensor, begin, end, end_mask in zip(
          self.ref_tensors, self.begins, self.ends, self.end_masks
      ):
          shape = ref_tensor.shape
          begin, end, end_mask = begin.val, end.val, end_mask.val
          ref_shape = (
              shape[begin:end] if not end_mask else shape[begin:]
          )
          out_shape += tuple(ref_shape)
  
      # Output shape must be known at compile time
      if any_symbolic(out_shape):
          msg = "Output shape of a reshape_like op {} must not be symbolic. Got {}".format(
              self.name, out_shape
          )
          raise ValueError(msg)
  
      # Output shape must be consistent with the input shape
      if not any_symbolic(self.x.shape):
          if np.prod(self.x.shape) != np.prod(out_shape):
              msg = "At reshape_like op {}, input shape {} not consistent with the output shape {}.".format(
                  self.name, self.x.shape, out_shape
              )
              raise ValueError(msg)
  
      return types.tensor(self.x.dtype, out_shape)
  
file_path: coremltools/coremltools/converters/mil/mil/ops/defs/iOS16/tensor_transformation.py
imports: import numpy
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.input_type import InputSpec, TensorInputType, TupleInputType
  from coremltools.converters.mil.mil.operation import Operation
  from coremltools.converters.mil.mil.ops.defs._op_reqs import register_op
  from coremltools.converters.mil.mil.ops.defs.iOS16 import _IOS16_TARGET
  from coremltools.converters.mil.mil.types.symbolic import any_symbolic
label_desc: Use image node_id 2 for calling the reshape_like obj's underlying member method code with example usage: obj.type_inference() and returns: types