code: def show_observation_stack(
      stack,
      channels_last=True,
      show=True,
      force_num_rows=None,
      row_to_update=0,
  ):
      if isinstance(stack, LazyStack):
          stack = np.array(stack)
      if isinstance(stack, list):  # is list
          stack_size = len(stack)
      elif len(stack.shape) == 3:
          stack_size = stack.shape[0]  # is numpy array
      elif len(stack.shape) == 4:
          stack_size = stack.shape[1]  # ignore batch dimension
          stack = stack[0]
      else:
          raise ValueError(
              "The observation stack must be a list, a numpy array or a LazyStack object"
          )
  
      if channels_last:
          stack = np.transpose(stack, (2, 0, 1))
          stack_size = stack.shape[0]
  
      max_cols = 10
      if force_num_rows:
          rows = force_num_rows
      else:
          rows = math.ceil(stack_size / max_cols)
      cols = max_cols if stack_size > max_cols else stack_size
  
      for i in range(stack_size):
          plt.subplot(rows, cols, row_to_update * cols + i + 1)
          plt.imshow(stack[i], cmap="gray")
  
      if show:
          plt.show()
  
file_path: coach/rl_coach/debug_utils.py
imports: import math
  import matplotlib.pyplot
  import numpy
  from rl_coach.filters.observation.observation_stacking_filter import LazyStack
label_desc: Use image node_id 1 for calling a global function with example usage: show_observation_stack(stack, channels_last, show, force_num_rows, row_to_update) without return types