code: def generate_channels_last_available(inputs):
      """
      This function will generate a list of string to decide if the
      elements of input can be converted to
  
      channel_last: "channel_last"
      channel_last_3d: "channel_last_3d"
      no change: "original"
      """
      # try channels_last available
      if inputs is not None:  # to avoid the situation of inputs == None
          if isinstance(inputs, torch.Tensor):
              inputs = tuple(
                  [inputs]
              )  # make it an tuple for later process
          channels_last_available = ["original"] * len(inputs)
          for idx, input in enumerate(inputs):
              try:
                  input.to(memory_format=torch.channels_last)
                  channels_last_available[idx] = "channels_last"
              except Exception as _e:
                  try:
                      input.to(memory_format=torch.channels_last_3d)
                      channels_last_available[idx] = "channels_last_3d"
                  except Exception as _e:
                      pass
      else:
          channels_last_available = []
      return channels_last_available
  
file_path: BigDL/python/nano/src/bigdl/nano/utils/pytorch/channel_last.py
imports: from typing import Optional
  from types import MethodType
  from logging import warning
  import torch
  import pytorch_lightning
label_desc: Use image node_id 1 for calling a global function with example usage: generate_channels_last_available(inputs) and returns: channels_last_available