class_docstr: Class merges data from several dataset iterators. When used for batch generation batches from
  merged dataset iterators are united into one batch. If sizes of merged datasets are different
  smaller datasets are repeated until their size becomes equal to the largest dataset.
  
  Args:
      data: dictionary which keys are task names and values are dictionaries with fields
          ``"train", "valid", "test"``.
      num_train_epochs: number of training epochs
      tasks: dictionary which keys are task names and values are init params of dataset iterators. If task has
          key-value pair ``'use_task_defaults': False`` task_defaults for this task dataset iterator will be ignored.
      batch_size: batch_size
      sampling_mode: mode of sampling we use. It can be plain, uniform or anneal.
      gradient_accumulation_steps: number of gradient accumulation steps. Default is 1
      steps_per_epoch: number of steps per epoch. Nesessary if gradient_accumulation_steps > 1
      iterator_class_name: name of iterator class.
      use_label_name, seed, features - parameters for the iterator class
      one_element_tuples: if True, tuple of x consisting of one element is returned in this element. Default: True
      task_defaults: default task parameters.
      seed - random seed for sampling
  
  Attributes:
      data: dictionary of data with fields "train", "valid" and "test" (or some of them)
class_docstr_tok: ["Class","merges","data","from","several","dataset","iterators",".","When","used","for","batch","generation","batches","from","merged","dataset","iterators","are","united","into","one","batch",".","If","sizes","of","merged","datasets","are","different","smaller","datasets","are","repeated","until","their","size","becomes","equal","to","the","largest","dataset",".","Args",":","data",":","dictionary","which","keys","are","task","names","and","values","are","dictionaries","with","fields","``","``","train","''",",","``","valid","''",",","``","test","''","``",".","num_train_epochs",":","number","of","training","epochs","tasks",":","dictionary","which","keys","are","task","names","and","values","are","init","params","of","dataset","iterators",".","If","task","has","key-value","pair","``","'use_task_defaults","'",":","False","``","task_defaults","for","this","task","dataset","iterator","will","be","ignored",".","batch_size",":","batch_size","sampling_mode",":","mode","of","sampling","we","use",".","It","can","be","plain",",","uniform","or","anneal",".","gradient_accumulation_steps",":","number","of","gradient","accumulation","steps",".","Default","is","1","steps_per_epoch",":","number","of","steps","per","epoch",".","Nesessary","if","gradient_accumulation_steps",">","1","iterator_class_name",":","name","of","iterator","class",".","use_label_name",",","seed",",","features","-","parameters","for","the","iterator","class","one_element_tuples",":","if","True",",","tuple","of","x","consisting","of","one","element","is","returned","in","this","element",".","Default",":","True","task_defaults",":","default","task","parameters",".","seed","-","random","seed","for","sampling","Attributes",":","data",":","dictionary","of","data","with","fields","``","train","''",",","``","valid","''","and","``","test","''","(","or","some","of","them",")"]
docstr: Returns a tuple of inputs and outputs from all datasets. Lengths of
  and outputs are equal to the size of the largest dataset. Smaller
  datasets are padded with Nones until their sizes are equal to the size of the
  largest dataset.
  Args:
      data_type: can be either 'train', 'test', or 'valid'
  Returns:
      A tuple of all inputs for a data type and all expected outputs
      for a data type.
docstr_tok: ["Returns","a","tuple","of","inputs","and","outputs","from","all","datasets",".","Lengths","of","and","outputs","are","equal","to","the","size","of","the","largest","dataset",".","Smaller","datasets","are","padded","with","Nones","until","their","sizes","are","equal","to","the","size","of","the","largest","dataset",".","Args",":","data_type",":","can","be","either","'train","'",",","'test","'",",","or","'valid'","Returns",":","A","tuple","of","all","inputs","for","a","data","type","and","all","expected","outputs","for","a","data","type","."]
code: def get_instances(self, data_type: str = "train"):
      """
      Returns a tuple of inputs and outputs from all datasets. Lengths of
      and outputs are equal to the size of the largest dataset. Smaller
      datasets are padded with Nones until their sizes are equal to the size of the
      largest dataset.
      Args:
          data_type: can be either 'train', 'test', or 'valid'
      Returns:
          A tuple of all inputs for a data type and all expected outputs
          for a data type.
      """
  
      max_task_data_len = max(
          [
              len(iter_.get_instances(data_type)[0])
              for iter_ in self.task_iterators.values()
          ]
      )
      x_instances = []
      y_instances = []
      for task_name, iter_ in self.task_iterators.items():
          x, y = iter_.get_instances(data_type)
          n_repeats = math.ceil(max_task_data_len / len(x))
          x *= n_repeats
          y *= n_repeats
          x_instances.append(x[:max_task_data_len])
          y_instances.append(y[:max_task_data_len])
      error_msg = f"Len of x_instances {len(x_instances)} and y_instances {len(y_instances)} dont match"
      if len(x_instances) != len(y_instances):
          raise Exception(error_msg)
      instances = (tuple(zip(*x_instances)), tuple(zip(*y_instances)))
      return instances
  
imports: import copy
  import math
  import random
  from logging import getLogger
  from typing import Iterator, Optional, Tuple, Union
  import numpy
  from deeppavlov.core.common.errors import ConfigError
  from deeppavlov.core.common.params import from_params
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.data.data_learning_iterator import DataLearningIterator
label_desc: Use image node_id 7 for calling the MultiTaskIterator obj's underlying member method code with example usage: obj.get_instances(data_type) and returns: instances