class_docstr: InfographStar is a semi-supervised graph convolutional network for predicting molecular properties.
  It aims to maximize the mutual information between the graph-level representation and the
  representations of substructures of different scales. It does this by producing graph-level
  encodings and substructure encodings, and then using a discriminator to classify if they
  are from the same molecule or not.
  
  Supervised training is done by using the graph-level encodings to predict the target property. Semi-supervised training is done by adding a loss term that maximizes the mutual information between the graph-level encodings and the substructure encodings to the supervised loss.
  These modes can be chosen by setting the training_mode parameter.
  
  To conduct training in unsupervised mode, use InfoGraphModel.
  
  References
  ----------
  .. [1] F.-Y. Sun, J. Hoffmann, V. Verma, and J. Tang, “InfoGraph: Unsupervised and Semi-supervised Graph-Level Representation Learning via Mutual Maximization.” arXiv, Jan. 17, 2020. http://arxiv.org/abs/1908.01000
  
  Parameters
  ----------
  num_features: int
      Number of node features for each input
  edge_features: int
      Number of edge features for each input
  embedding_dim: int
      Dimension of the embedding
  training_mode: str
      The mode to use for training. Options are 'supervised', 'semisupervised'. For unsupervised training, use InfoGraphModel.
  measure: str
      The divergence measure to use for the unsupervised loss. Options are 'GAN', 'JSD',
      'KL', 'RKL', 'X2', 'DV', 'H2', or 'W1'.
  average_loss: bool
      Whether to average the loss over the batch
  
  Examples
  --------
  >>> from deepchem.models.torch_models import InfoGraphStarModel
  >>> from deepchem.feat import MolGraphConvFeaturizer
  >>> from deepchem.data import NumpyDataset
  >>> import torch
  >>> smiles = ["C1CCC1", "C1=CC=CN=C1"]
  >>> featurizer = MolGraphConvFeaturizer(use_edges=True)
  >>> X = featurizer.featurize(smiles)
  >>> y = torch.randint(0, 2, size=(2, 1)).float()
  >>> w = torch.ones(size=(2, 1)).float()
  >>> ds = NumpyDataset(X, y, w)
  >>> num_feat = max([ds.X[i].num_node_features for i in range(len(ds))])
  >>> edge_dim = max([ds.X[i].num_edge_features for i in range(len(ds))])
  >>> model = InfoGraphStarModel(num_feat, edge_dim, 15, training_mode='semisupervised')
  >>> loss = model.fit(ds, nb_epoch=1)
code: def default_generator(
      self,
      dataset: dc.data.Dataset,
      epochs: int = 1,
      mode: str = "fit",
      deterministic: bool = True,
      pad_batches: bool = True,
  ) -> Iterable[Tuple[List, List, List]]:
      for epoch in range(epochs):
          for X_b, y_b, w_b, ids_b in dataset.iterbatches(
              batch_size=self.batch_size,
              deterministic=deterministic,
              pad_batches=pad_batches,
          ):
              if self.mode == "classification" and y_b is not None:
                  y_b = to_one_hot(
                      y_b.flatten(), self.num_classes
                  ).reshape(-1, self.num_tasks, self.num_classes)
              yield ([X_b], [y_b], [w_b])
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch.nn import GRU, Linear, ReLU, Sequential
  from typing import Iterable, List, Tuple, Optional, Dict, Literal
  from deepchem.metrics import to_one_hot
  import deepchem
  from deepchem.models.losses import SoftmaxCrossEntropy
  from deepchem.feat.graph_data import BatchGraphData
  from deepchem.models.losses import GlobalMutualInformationLoss, LocalMutualInformationLoss
  from deepchem.models.torch_models.layers import MultilayerPerceptron
  from deepchem.models.torch_models.modular import ModularTorchModel
label_desc: Use image node_id 9 for calling the InfoGraphStarModel obj's underlying member method code with example usage: obj.default_generator(dataset, epochs, mode, deterministic, pad_batches) without return types