code: def _extract_tensor_metadata(result: torch.Tensor) -> TensorMetadata:
      """
      Extract a TensorMetadata NamedTuple describing `result`.
      """
      shape = result.shape
      dtype = result.dtype
      requires_grad = result.requires_grad
      stride = result.stride()
      numel = result.numel()
      is_tensor = True
  
      return TensorMetadata(
          shape, dtype, requires_grad, stride, numel, is_tensor
      )
  
imports: from dataclasses import asdict
  from typing import Any, Dict, List, NamedTuple, Tuple
  import torch
  import torch.fx
  from torch.fx.node import Argument, Node, Target
  from torch.utils._pytree import tree_map
  from colossalai.fx._compatibility import compatibility, is_compatible_with_meta
  from colossalai.fx.profiler import GraphInfo, activation_size, calculate_fwd_in, calculate_fwd_out, calculate_fwd_tmp, profile_function, profile_method, profile_module
label_desc: Use image node_id 1 for calling a global function with example usage: _extract_tensor_metadata(result) and returns: TensorMetadata