code: def get_npy_dim(npy_path):
      """Get the dim of numpy file."""
      with open(npy_path, "rb") as f:
          # For the read_array_header API provided by numpy will only read the
          # length of the header, it will cause parsing failure and error if
          # first 8 bytes which contains magin string and version are not read
          # ahead of time. So, we need to make sure we have skipped these 8
          # bytes.
          f.seek(8, 0)
          try:
              shape, _, _ = read_array_header_1_0(f)
          except ValueError:
              try:
                  shape, _, _ = read_array_header_2_0(f)
              except ValueError:
                  raise ValueError("Invalid file format")
  
          return len(shape)
  
file_path: dgl/python/dgl/graphbolt/internal/utils.py
imports: import hashlib
  import json
  import os
  import shutil
  from typing import List, Union
  import numpy
  import pandas
  import torch
  from numpy.lib.format import read_array_header_1_0, read_array_header_2_0
label_desc: Use image node_id 5 for calling a global function with example usage: get_npy_dim(npy_path) and returns: len