code: def write_tensor_to_disk(dir, name, t, fmt="torch"):
      if fmt == "torch":
          torch.save(t, os.path.join(dir, name + ".pt"))
      elif fmt == "numpy":
          t = t.numpy()
          np.save(os.path.join(dir, name + ".npy"), t)
      else:
          raise ValueError(f"Unsupported format: {fmt}")
  
imports: import os
  import tempfile
  import unittest
  from functools import reduce
  from operator import mul
  import backend
  import numpy
  import pydantic
  import pytest
  import torch
  from dgl import graphbolt
label_desc: Use image node_id 8 for calling a global function with example usage: write_tensor_to_disk(dir, name, t, fmt) without return types