def _set_nonreplaceable_vars_upstream(self):
        """
        A utility function to set the value of the "nonreplaceable_vars_upstream" property.
        If self is a non-replaceable var, then "nonreplaceable_vars_upstream" is a single element set, containing self.
        Otherwise, it is a union of the "nonreplaceable_vars_upstream" sets of all the input vars of its parent ops.
        """
        op = self.op
        if op is None:
            return
        if op.op_type == "shape":
            # For the meta data ops, like shape, we stop propogate the nonreplaceable_vars.
            self.nonreplaceable_vars_upstream = set()
            return
        if Var._is_nonreplaceable_var(self):
            self.nonreplaceable_vars_upstream = set([self])
        else:
            flattened_inputs = op.get_flattened_inputs()
            inputs_nonreplaceable_vars_upstream = [p.nonreplaceable_vars_upstream for p in flattened_inputs]
            if len(inputs_nonreplaceable_vars_upstream) > 0:
                self.nonreplaceable_vars_upstream = set.union(*inputs_nonreplaceable_vars_upstream)

        A utility function to set the value of the "nonreplaceable_vars_upstream" property.
        If self is a non-replaceable var, then "nonreplaceable_vars_upstream" is a single element set, containing self.
        Otherwise, it is a union of the "nonreplaceable_vars_upstream" sets of all the input vars of its parent ops.
        
coremltools/converters/mil/mil/var.py