code: def _normalized_flow_to_image(
      normalized_flow: torch.Tensor,
  ) -> torch.Tensor:
      """
      Converts a batch of normalized flow to an RGB image.
  
      Args:
          normalized_flow (torch.Tensor): Normalized flow tensor of shape (N, 2, H, W)
      Returns:
         img (Tensor(N, 3, H, W)): Flow visualization image of dtype uint8.
      """
  
      N, _, H, W = normalized_flow.shape
      device = normalized_flow.device
      flow_image = torch.zeros(
          (N, 3, H, W), dtype=torch.uint8, device=device
      )
      colorwheel = _make_colorwheel().to(device)  # shape [55x3]
      num_cols = colorwheel.shape[0]
      norm = torch.sum(normalized_flow**2, dim=1).sqrt()
      a = (
          torch.atan2(
              -normalized_flow[:, 1, :, :], -normalized_flow[:, 0, :, :]
          )
          / torch.pi
      )
      fk = (a + 1) / 2 * (num_cols - 1)
      k0 = torch.floor(fk).to(torch.long)
      k1 = k0 + 1
      k1[k1 == num_cols] = 0
      f = fk - k0
  
      for c in range(colorwheel.shape[1]):
          tmp = colorwheel[:, c]
          col0 = tmp[k0] / 255.0
          col1 = tmp[k1] / 255.0
          col = (1 - f) * col0 + f * col1
          col = 1 - norm * (1 - col)
          flow_image[:, c, :, :] = torch.floor(255 * col)
      return flow_image
  
imports: import collections
  import math
  import pathlib
  import warnings
  from itertools import repeat
  from types import FunctionType
  from typing import Any, BinaryIO, List, Optional, Tuple, Union
  import numpy
  import torch
  from PIL import Image, ImageColor, ImageDraw, ImageFont
label_desc: Use image node_id 7 for calling a global function with example usage: _normalized_flow_to_image(normalized_flow) and returns: flow_image