code: def test_multi_gpu_trainable(module):
      m = importlib.import_module(module)
      ngpu = 2
      device_ids = list(range(ngpu))
      args = make_arg()
      model = m.E2E(10, 5, args)
      if "pytorch" in module:
          model = torch.nn.DataParallel(model, device_ids)
          batch = prepare_inputs("pytorch", is_cuda=True)
          model.cuda()
          loss = 1.0 / ngpu * model(*batch)
          loss.backward(loss.new_ones(ngpu))  # trainable
      else:
          import copy
  
          import cupy
  
          losses = []
          for device in device_ids:
              with cupy.cuda.Device(device):
                  batch = prepare_inputs("chainer", is_cuda=True)
                  _model = copy.deepcopy(
                      model
                  )  # Transcribed from training.updaters.ParallelUpdater
                  _model.to_gpu()
                  loss = 1.0 / ngpu * _model(*batch)[0]
                  losses.append(loss)
  
          for loss in losses:
              loss.backward()
  
imports: from __future__ import division
  import argparse
  import importlib
  import os
  import tempfile
  from test.utils_test import make_dummy_json
  import chainer
  import numpy
  import pytest
  import torch
  import espnet.nets.chainer_backend.e2e_asr
  import espnet.nets.pytorch_backend.e2e_asr
  from espnet.asr import asr_utils
  from espnet.nets.pytorch_backend.nets_utils import pad_list
  from espnet.nets.pytorch_backend.streaming.segment import SegmentStreamingE2E
  from espnet.nets.pytorch_backend.streaming.window import WindowStreamingE2E
  from espnet.utils.training.batchfy import make_batchset
label_desc: Use image node_id 21 for calling a global function with example usage: test_multi_gpu_trainable(module) without return types