def find_constexprs(blocks: List[Block]) -> Dict[Var, List[Var]]:
        """
        Given a list of blocks, return all constexpr in the blocks in such a format:
            {unique_var_0: [duplicated_var_0_0, duplicated_var_0_1, ...],
             unique_var_1: [duplicated_var_1_0, duplicated_var_1_1, ...],
             ...
            }
        """
        hashkey_2_duplicates: Dict[Tuple, List[Var]] = {}
        for block in blocks:
            for op in list(block.operations):
                if not op.op_type.startswith("constexpr_"):
                    continue
                if hasattr(op, "weight_key"):
                    hash_key = [op.op_type, op.weight_key]
                else:
                    hash_key = [op.op_type]
                for v in op.inputs.values():
                    hash_key.append(v.dtype)
                    if v.val is None or const_deduplication.should_be_deduplicated(v.val):
                        hash_key.append(v)
                    else:
                        hash_key.append(str(v.val))
                hash_key = tuple(hash_key)
                if hash_key not in hashkey_2_duplicates:
                    hashkey_2_duplicates[hash_key] = [op.outputs[0]]
                else:
                    hashkey_2_duplicates[hash_key].append(op.outputs[0])

        return {v[0]: v[1:] for v in hashkey_2_duplicates.values()}

        Given a list of blocks, return all constexpr in the blocks in such a format:
            {unique_var_0: [duplicated_var_0_0, duplicated_var_0_1, ...],
             unique_var_1: [duplicated_var_1_0, duplicated_var_1_1, ...],
             ...
            }
        
coremltools/converters/mil/mil/passes/defs/cleanup/const_deduplication.py