code: def categorical(logits, num_samples, dtype="int32", seed=None):
      logits = convert_to_tensor(logits)
      dtype = to_torch_dtype(dtype)
      probs = torch.softmax(logits, dim=-1)
      # Do not use generator during symbolic execution.
      if get_device() == "meta":
          return torch.multinomial(
              probs,
              num_samples,
              replacement=True,
          ).type(dtype)
      generator = torch_seed_generator(seed)
      return torch.multinomial(
          probs,
          num_samples,
          replacement=True,
          generator=generator,
      ).type(dtype)
  
imports: import torch
  import torch._dynamo
  import torch.nn.functional
  from keras.backend.config import floatx
  from keras.backend.torch.core import convert_to_tensor
  from keras.backend.torch.core import get_device
  from keras.backend.torch.core import to_torch_dtype
  from keras.random.seed_generator import SeedGenerator
  from keras.random.seed_generator import draw_seed
  from keras.random.seed_generator import make_default_seed
label_desc: Use image node_id 3 for calling a global function with example usage: categorical(logits, num_samples, dtype, seed) and returns: torch, torch