class_docstr: Properties used to create :class:`Tensor` 
code: def __setstate__(
      self,
      state,
  ):
      (
          self.dtype,
          self.layout,
          self.requires_grad,
          mem_format_encoding,
          self.pin_memory,
      ) = state
  
      if (
          mem_format_encoding
          == MEM_FORMAT_ENCODING.TORCH_CONTIGUOUS_FORMAT
      ):
          memory_format = torch.contiguous_format
      elif (
          mem_format_encoding == MEM_FORMAT_ENCODING.TORCH_CHANNELS_LAST
      ):
          memory_format = torch.channels_last
      elif (
          mem_format_encoding
          == MEM_FORMAT_ENCODING.TORCH_PRESERVE_FORMAT
      ):
          memory_format = torch.preserve_format
      else:
          raise RuntimeError(
              f"Invalid torch.memory_format encoding: {mem_format_encoding}"
          )
  
      self.memory_format = memory_format
  
file_path: pytorch/torch/distributed/_shard/sharded_tensor/metadata.py
imports: from dataclasses import dataclass, field
  from enum import Enum
  from typing import List
  import torch
  from torch.distributed._shard.metadata import ShardMetadata
label_desc: Use image node_id 2 for calling the TensorProperties obj's underlying member method code with example usage: obj.__setstate__(state) without return types