def register_func(self, func=None, torch_alias=None, override=False):
        """
        Given an op name and its alias, put the translation function (callable)
        into the registry.
        """
        f_name = func.__name__
        all_f_names = [f_name]
        if torch_alias is not None:
            all_f_names.extend(torch_alias)

        for name in all_f_names:
            if name.endswith("_"):
                raise Exception(
                    f'Attempting to register "{name}" op. Do not register inplace ops. (inplace torch ops'
                    f' end in a "_"). Instead register the normal op version: "{name[:-1]}". The inplace'
                    f" version will be supported automatically."
                )
            if not override and name in self.name_to_func_mapping:
                raise ValueError(f"Torch op {name} already registered.")
            self.set_func_by_name(func, name)

        Given an op name and its alias, put the translation function (callable)
        into the registry.
        
coremltools/converters/mil/frontend/torch/torch_op_registry.py