def remove_ops(self, ops_to_remove: List[Operation]):
        """
        Remove ops in `ops_to_remove`.

        Args: ops_to_remove: List[Operation]. All ops in this list must be pre-existing in the
        block. It allows duplicated ops, but duplicated ops will only be removed once.

        Raises:
            ValueError if any `op` in `ops_to_remove` meets any of following conditions:
              - `op` is not found in the block
              - any other op in the block uses output Vars of `op`
              - the output var is block's output
        """
        self.validate()

        # Dedup ops because each op can only be deleted once.
        ops_to_remove_set = set(ops_to_remove)
        ops_to_remove = list(ops_to_remove_set)

        for op in ops_to_remove:
            for i, v in enumerate(op.outputs):
                # Check that the output Var isn't block's output
                if v in self._outputs:
                    raise ValueError(
                        f"cannot delete op {op.name} with output {i}: {v.name} that's block {self.name}'s output."
                    )

            for b in op.blocks:
                b.set_outputs([])
                b.remove_ops(b.operations)

            self.operations.remove(op)

            op.enclosing_block = None

            for v in op.get_flattened_inputs():
                v.remove_child_op(op)

            # Remove InternalVar from self._internal_vars
            for v in op.internal_inputs.values():
                self._internal_vars.remove(v)

        # In the end, we check no ops depend on removed op's outputs
        for op in ops_to_remove:
            for i, v in enumerate(op.outputs):
                if len(v.child_ops) > 0:
                    child_op_names = [s.name for s in v.child_ops]
                    raise ValueError(
                        f"Cannot delete op '{op.name}' with active output at id {i}: '{v.name}' used by ops {child_op_names}."
                    )

        Remove ops in `ops_to_remove`.

        Args: ops_to_remove: List[Operation]. All ops in this list must be pre-existing in the
        block. It allows duplicated ops, but duplicated ops will only be removed once.

        Raises:
            ValueError if any `op` in `ops_to_remove` meets any of following conditions:
              - `op` is not found in the block
              - any other op in the block uses output Vars of `op`
              - the output var is block's output
        
coremltools/converters/mil/mil/block.py