code: def byte_swap_tensor_content(tensor, from_endiness, to_endiness):
      """Byte swaps.
  
      Args:
        tensor: Target tensor to change endiness.
        from_endiness: The original endianness format. "big" or "little"
        to_endiness: The target endianness format. "big" or "little"
      """
      if tensor.dtype in byte_swappable:
          tshape = tensor.tensor_shape.dim
          tensor_bytes = tensor.tensor_content
          if tensor_bytes:
              tensor_size = 1
              for sz in tshape:
                  if sz.size != 0:
                      tensor_size = tensor_size * sz.size
              chunksize = int(len(tensor_bytes) / tensor_size)
              # Split tensor_data into chunks for byte swapping.
              to_swap = [
                  tensor_bytes[i : i + chunksize]
                  for i in range(0, len(tensor_bytes), chunksize)
              ]
              # Swap and replace tensor_content.
              tensor.tensor_content = b"".join(
                  [
                      int.from_bytes(byteswap, from_endiness).to_bytes(
                          chunksize, to_endiness
                      )
                      for byteswap in to_swap
                  ]
              )
  
imports: from tensorflow.core.framework import graph_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.python.framework import dtypes
label_desc: Use image node_id 1 for calling a global function with example usage: byte_swap_tensor_content(tensor, from_endiness, to_endiness) without return types