def should_cast_parameter(self, op: Operation, param_name: str) -> bool:
        """
        Determine if a parameter should be cast or not.
        If should be cast, determine whether to use int16 or uint16.
        """
        _INT16_MAX = np.iinfo(np.int16).max
        _INT16_MIN = np.iinfo(np.int16).min
        _UINT16_MAX = np.iinfo(np.uint16).max
        _UINT16_MIN = np.iinfo(np.uint16).min

        input_var = op.inputs[param_name]
        # input may be a string that specifies the dtype,
        # so if it is "int32" then we would like to replace with "int16"
        if input_var.dtype == types.str:
            return input_var.val == "int32"
        # otherwise only int32 tensor / scalar should get cast to int16
        elif not input_var.is_tensor_or_scalar_of(dtype="int32"):
            return False

        input_op = input_var.op
        if input_op is not None and input_op.op_type == "const":
            if (
                input_op.outputs[0].val.min() >= _UINT16_MIN
                and input_op.outputs[0].val.max() <= _UINT16_MAX
            ):
                self._target_dtype = "uint16"
            elif (
                input_op.outputs[0].val.min() >= _INT16_MIN
                and input_op.outputs[0].val.max() <= _INT16_MAX
            ):
                self._target_dtype = "int16"
            else:
                return False

        # In `gather` and `gather_along_axis`, if the dim size of x is larger than int16
        # upperbound, the dynamic indices could overflow, so it shouldn't be cast.
        if op.op_type in {"gather", "gather_along_axis"} and param_name == "indices":
            if op.indices.val is None and op.x.shape is not None:
                dim_size = op.x.shape[op.axis.val]
                if not is_symbolic(dim_size) and dim_size > _INT16_MAX:
                    return False

        if not super().should_cast_parameter(op, param_name):
            return False

        return True

        Determine if a parameter should be cast or not.
        If should be cast, determine whether to use int16 or uint16.
        
coremltools/converters/mil/mil/passes/defs/quantization.py