docstr: Register custom source that is not part of the backend's templates.
  
  Args:
      source_file (str or Path): Absolute path to the source file.
      destination_dir (str, optional): The sub-directory of the output project to write the source file to.
          Defaults to 'nnet_utils'.
  
  Raises:
      Exception: If the source file is not a str or Path, or if the path is not absolute
docstr_tok: ["Register","custom","source","that","is","not","part","of","the","backend","'s","templates",".","Args",":","source_file","(","str","or","Path",")",":","Absolute","path","to","the","source","file",".","destination_dir","(","str",",","optional",")",":","The","sub-directory","of","the","output","project","to","write","the","source","file","to",".","Defaults","to","'nnet_utils","'",".","Raises",":","Exception",":","If","the","source","file","is","not","a","str","or","Path",",","or","if","the","path","is","not","absolute"]
code: def register_source(self, source_file, destination_dir="nnet_utils"):
      """Register custom source that is not part of the backend's templates.
  
      Args:
          source_file (str or Path): Absolute path to the source file.
          destination_dir (str, optional): The sub-directory of the output project to write the source file to.
              Defaults to 'nnet_utils'.
  
      Raises:
          Exception: If the source file is not a str or Path, or if the path is not absolute
      """
      if isinstance(source_file, str):
          if not os.path.isabs(source_file):
              raise Exception(
                  f'Expected absolute path to custom source file, got: "{source_file}"'
              )
          source_path = Path(source_file)
      elif isinstance(source_file, Path):
          source_path = source_file
      else:
          raise Exception(
              f'Expected string or Path, got: "{type(source_file)}"'
          )
  
      self.custom_source[
          destination_dir + os.path.sep + source_path.name
      ] = source_path
  
imports: import inspect
  import os
  from pathlib import Path
  from hls4ml.backends.template import Template
  from hls4ml.model.flow import get_backend_flows, update_flow
  from hls4ml.model.optimizer import LayerOptimizerPass, extract_optimizers_from_object, extract_optimizers_from_path, get_backend_passes, get_optimizer, register_pass
label_desc: Use image node_id 12 for calling the Backend obj's underlying member method code with example usage: obj.register_source(source_file, destination_dir) without return types