code: def load_external_data_for_tensor(
      tensor: TensorProto, base_dir: str
  ) -> None:
      """Loads data from an external file for tensor.
      Ideally TensorProto should not hold any raw data but if it does it will be ignored.
  
      Arguments:
          tensor: a TensorProto object.
          base_dir: directory that contains the external data.
      """
      info = ExternalDataInfo(tensor)
      file_location = _sanitize_path(info.location)
      external_data_file_path = os.path.join(base_dir, file_location)
  
      with open(external_data_file_path, "rb") as data_file:
          if info.offset:
              data_file.seek(info.offset)
  
          if info.length:
              tensor.raw_data = data_file.read(info.length)
          else:
              tensor.raw_data = data_file.read()
  
imports: import os
  import re
  import sys
  import uuid
  from itertools import chain
  from typing import Callable, Iterable, Optional
  from onnx.onnx_pb import AttributeProto, GraphProto, ModelProto, TensorProto
label_desc: Use image node_id 1 for calling a global function with example usage: load_external_data_for_tensor(tensor, base_dir) without return types