code: def get_sample_medium_random_var_size(
      cls, blank_first: bool, device=torch.device("cpu")
  ) -> "RnntLossSampleData":
      vocab_size = 32
      blank_id = 0 if blank_first else vocab_size - 1
      num_frames = 32
      text_len = 27
      min_symbol = 1 if blank_first else 0
      max_symbol = vocab_size if blank_first else vocab_size - 1
      batch_size = 4
  
      rs = np.random.RandomState(2021)
      text = rs.randint(
          min_symbol, max_symbol, size=(batch_size, text_len)
      )
      targets = torch.from_numpy(text).to(device)
  
      logits = torch.rand(
          [batch_size, num_frames, text_len + 1, vocab_size],
          requires_grad=True,
          device=device,
      )
      input_lengths = torch.tensor(
          [num_frames, num_frames // 2, text_len, text_len // 2],
          device=device,
      ).long()
      target_lengths = torch.tensor(
          [text_len, text_len - 1, text_len - 3, text_len - 10],
          device=device,
      )
      return RnntLossSampleData(
          vocab_size=vocab_size,
          blank_id=blank_id,
          logits=logits,
          targets=targets,
          input_lengths=input_lengths,
          target_lengths=target_lengths,
      )
  
file_path: NeMo/tests/collections/asr/conftest.py
imports: from dataclasses import dataclass
  from typing import Optional, Type
  import numpy
  import pytest
  import torch
label_desc: Use image node_id 5 for calling the RnntLossSampleData obj's underlying member method code with example usage: obj.get_sample_medium_random_var_size(cls, blank_first, device) and returns: RnntLossSampleData