class_docstr: Keras compatible data generator that wraps a :class:`.Generator` and provides corrupted data for
  training Deep Graph Infomax.
  
  .. seealso::
  
     Model using this generator: :class:`.DeepGraphInfomax`.
  
     Examples using this generator:
  
     - `unsupervised representation learning <https://stellargraph.readthedocs.io/en/stable/demos/embeddings/deep-graph-infomax-embeddings.html>`__
     - `semi-supervised node classification <https://stellargraph.readthedocs.io/en/stable/demos/node-classification/gcn-deep-graph-infomax-fine-tuning-node-classification.html>`__
  
     Generators that support corruption natively: :class:`.FullBatchNodeGenerator`, :class:`.RelationalFullBatchNodeGenerator`, :class:`.GraphSAGENodeGenerator`, :class:`.DirectedGraphSAGENodeGenerator`, :class:`.HinSAGENodeGenerator`, :class:`.ClusterNodeGenerator`.
  
  Args:
      base_generator (Generator): the uncorrupted Generator object.
      corrupt_index_groups (list of list of int, optional): an explicit list of which input
          tensors should be shuffled to create the corrupted inputs. This is a list of "groups",
          where each group is a non-empty list of indices into the tensors that the base generator
          yields. The tensors within each group are flattened to be rank-2 (preserving the last
          dimension, of node features), concatenated, shuffled and split back to their original
          shapes, to compute new corrupted values for each tensors within that group. Each group
          has this operation done independently. Each index can appear in at most one
          group. (This parameter is only optional if ``base_generator`` provides a default via
          ``default_corrupt_input_index_groups``. Otherwise, this parameter must be specified.)
class_docstr_tok: ["Keras","compatible","data","generator","that","wraps","a",":","class",":","`",".Generator","`","and","provides","corrupted","data","for","training","Deep","Graph","Infomax",".","..","seealso",":",":","Model","using","this","generator",":",":","class",":","`",".DeepGraphInfomax","`",".","Examples","using","this","generator",":","-","`","unsupervised","representation","learning","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/embeddings\/deep-graph-infomax-embeddings.html",">","`","__","-","`","semi-supervised","node","classification","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/node-classification\/gcn-deep-graph-infomax-fine-tuning-node-classification.html",">","`","__","Generators","that","support","corruption","natively",":",":","class",":","`",".FullBatchNodeGenerator","`",",",":","class",":","`",".RelationalFullBatchNodeGenerator","`",",",":","class",":","`",".GraphSAGENodeGenerator","`",",",":","class",":","`",".DirectedGraphSAGENodeGenerator","`",",",":","class",":","`",".HinSAGENodeGenerator","`",",",":","class",":","`",".ClusterNodeGenerator","`",".","Args",":","base_generator","(","Generator",")",":","the","uncorrupted","Generator","object",".","corrupt_index_groups","(","list","of","list","of","int",",","optional",")",":","an","explicit","list","of","which","input","tensors","should","be","shuffled","to","create","the","corrupted","inputs",".","This","is","a","list","of","``","groups","''",",","where","each","group","is","a","non-empty","list","of","indices","into","the","tensors","that","the","base","generator","yields",".","The","tensors","within","each","group","are","flattened","to","be","rank-2","(","preserving","the","last","dimension",",","of","node","features",")",",","concatenated",",","shuffled","and","split","back","to","their","original","shapes",",","to","compute","new","corrupted","values","for","each","tensors","within","that","group",".","Each","group","has","this","operation","done","independently",".","Each","index","can","appear","in","at","most","one","group",".","(","This","parameter","is","only","optional","if","``","base_generator","``","provides","a","default","via","``","default_corrupt_input_index_groups","``",".","Otherwise",",","this","parameter","must","be","specified",".",")"]
code: def __init__(self, base_generator, *, corrupt_index_groups=None):
      if not isinstance(base_generator, Generator):
          raise TypeError(
              f"base_generator: expected a Generator subclass, found {type(base_generator).__name__}"
          )
  
      if corrupt_index_groups is None:
          # check that this generator has a notion of default corruption support
          corrupt_index_groups = (
              base_generator.default_corrupt_input_index_groups()
          )
          if corrupt_index_groups is None:
              # this is a TypeError because most cases of this will be types that _statically_ don't
              # support corruption, not ones that sometimes support corruption and sometimes don't
              raise TypeError(
                  f"base_generator: expected a Generator that supports corruption if 'corrupt_index_groups' is not passed, found {type(base_generator).__name__}"
              )
  
      _validate_indices(corrupt_index_groups)
  
      self.base_generator = base_generator
      self.corrupt_index_groups = corrupt_index_groups
  
file_path: stellargraph/stellargraph/mapper/corrupted.py
imports: import numpy
  from tensorflow.keras.utils import Sequence
  from .None import Generator
  from ..core.validation import comma_sep
label_desc: Use image node_id 1 to create a new CorruptedGenerator object from inherited base classes: Generator with example: obj = CorruptedGenerator(base_generator)