code: def prepare_inputs(
      bs,
      idim,
      odim,
      maxin_len,
      maxout_len,
      spk_embed_dim=None,
      spc_dim=None,
      device=torch.device("cpu"),
  ):
      ilens = np.sort(np.random.randint(1, maxin_len, bs))[
          ::-1
      ].tolist()
      olens = np.sort(np.random.randint(3, maxout_len, bs))[
          ::-1
      ].tolist()
      xs = [np.random.randn(lg, idim) for lg in ilens]
      ys = [np.random.randn(lg, odim) for lg in olens]
      ilens = torch.LongTensor(ilens).to(device)
      olens = torch.LongTensor(olens).to(device)
      xs = pad_list([torch.from_numpy(x).float() for x in xs], 0).to(
          device
      )
      ys = pad_list([torch.from_numpy(y).float() for y in ys], 0).to(
          device
      )
      labels = ys.new_zeros(ys.size(0), ys.size(1))
      for i, lg in enumerate(olens):
          labels[i, lg - 1 :] = 1
  
      batch = {
          "xs": xs,
          "ilens": ilens,
          "ys": ys,
          "labels": labels,
          "olens": olens,
      }
  
      if spk_embed_dim is not None:
          spembs = (
              torch.from_numpy(np.random.randn(bs, spk_embed_dim))
              .float()
              .to(device)
          )
          batch["spembs"] = spembs
      if spc_dim is not None:
          spcs = [np.random.randn(lg, spc_dim) for lg in olens]
          spcs = pad_list(
              [torch.from_numpy(spc).float() for spc in spcs], 0
          ).to(device)
          batch["extras"] = spcs
  
      return batch
  
file_path: espnet/test/test_e2e_vc_tacotron2.py
imports: from __future__ import division, print_function
  from argparse import Namespace
  import numpy
  import pytest
  import torch
  from espnet.nets.pytorch_backend.e2e_vc_tacotron2 import Tacotron2
  from espnet.nets.pytorch_backend.nets_utils import pad_list
label_desc: Use image node_id 3 for calling a global function with example usage: prepare_inputs(bs, idim, odim, maxin_len, maxout_len, spk_embed_dim, spc_dim, device) and returns: batch