class_docstr: Implements Google-style Weave Graph Convolutions
  
  This model implements the Weave style graph convolutions
  from [1]_.
  
  The biggest difference between WeaveModel style convolutions
  and GraphConvModel style convolutions is that Weave
  convolutions model bond features explicitly. This has the
  side effect that it needs to construct a NxN matrix
  explicitly to model bond interactions. This may cause
  scaling issues, but may possibly allow for better modeling
  of subtle bond effects.
  
  Note that [1]_ introduces a whole variety of different architectures for
  Weave models. The default settings in this class correspond to the W2N2
  variant from [1]_ which is the most commonly used variant..
  
  Examples
  --------
  
  Here's an example of how to fit a `WeaveModel` on a tiny sample dataset.
  
  >>> import numpy as np
  >>> import deepchem as dc
  >>> featurizer = dc.feat.WeaveFeaturizer()
  >>> X = featurizer(["C", "CC"])
  >>> y = np.array([1, 0])
  >>> dataset = dc.data.NumpyDataset(X, y)
  >>> model = dc.models.WeaveModel(n_tasks=1, n_weave=2, fully_connected_layer_sizes=[2000, 1000], mode="classification")
  >>> loss = model.fit(dataset)
  
  Note
  ----
  In general, the use of batch normalization can cause issues with NaNs. If
  you're having trouble with NaNs while using this model, consider setting
  `batch_normalize_kwargs={"trainable": False}` or turning off batch
  normalization entirely with `batch_normalize=False`.
  
  References
  ----------
  .. [1] Kearnes, Steven, et al. "Molecular graph convolutions: moving beyond
      fingerprints." Journal of computer-aided molecular design 30.8 (2016):
      595-608.
class_docstr_tok: ["Implements","Google-style","Weave","Graph","Convolutions","This","model","implements","the","Weave","style","graph","convolutions","from","[","1","]","_",".","The","biggest","difference","between","WeaveModel","style","convolutions","and","GraphConvModel","style","convolutions","is","that","Weave","convolutions","model","bond","features","explicitly",".","This","has","the","side","effect","that","it","needs","to","construct","a","NxN","matrix","explicitly","to","model","bond","interactions",".","This","may","cause","scaling","issues",",","but","may","possibly","allow","for","better","modeling","of","subtle","bond","effects",".","Note","that","[","1","]","_","introduces","a","whole","variety","of","different","architectures","for","Weave","models",".","The","default","settings","in","this","class","correspond","to","the","W2N2","variant","from","[","1","]","_","which","is","the","most","commonly","used","variant","..","Examples","--","--","--","--","Here","'s","an","example","of","how","to","fit","a","`","WeaveModel","`","on","a","tiny","sample","dataset",".",">",">",">","import","numpy","as","np",">",">",">","import","deepchem","as","dc",">",">",">","featurizer","=","dc.feat.WeaveFeaturizer","(",")",">",">",">","X","=","featurizer","(","[","``","C","''",",","``","CC","''","]",")",">",">",">","y","=","np.array","(","[","1",",","0","]",")",">",">",">","dataset","=","dc.data.NumpyDataset","(","X",",","y",")",">",">",">","model","=","dc.models.WeaveModel","(","n_tasks=1",",","n_weave=2",",","fully_connected_layer_sizes=","[","2000",",","1000","]",",","mode=","''","classification","''",")",">",">",">","loss","=","model.fit","(","dataset",")","Note","--","--","In","general",",","the","use","of","batch","normalization","can","cause","issues","with","NaNs",".","If","you","'re","having","trouble","with","NaNs","while","using","this","model",",","consider","setting","`","batch_normalize_kwargs=","{","``","trainable","''",":","False","}","`","or","turning","off","batch","normalization","entirely","with","`","batch_normalize=False","`",".","References","--","--","--","--","--","..","[","1","]","Kearnes",",","Steven",",","et","al",".","``","Molecular","graph","convolutions",":","moving","beyond","fingerprints",".","''","Journal","of","computer-aided","molecular","design","30.8","(","2016",")",":","595-608","."]
docstr: Convert a dataset into the tensors needed for learning.
  
  Parameters
  ----------
  dataset: `dc.data.Dataset`
      Dataset to convert
  epochs: int, optional (Default 1)
      Number of times to walk over `dataset`
  mode: str, optional (Default 'fit')
      Ignored in this implementation.
  deterministic: bool, optional (Default True)
      Whether the dataset should be walked in a deterministic fashion
  pad_batches: bool, optional (Default True)
      If true, each returned batch will have size `self.batch_size`.
  
  Returns
  -------
  Iterator which walks over the batches
docstr_tok: ["Convert","a","dataset","into","the","tensors","needed","for","learning",".","Parameters","--","--","--","--","--","dataset",":","`","dc.data.Dataset","`","Dataset","to","convert","epochs",":","int",",","optional","(","Default","1",")","Number","of","times","to","walk","over","`","dataset","`","mode",":","str",",","optional","(","Default","'fit","'",")","Ignored","in","this","implementation",".","deterministic",":","bool",",","optional","(","Default","True",")","Whether","the","dataset","should","be","walked","in","a","deterministic","fashion","pad_batches",":","bool",",","optional","(","Default","True",")","If","true",",","each","returned","batch","will","have","size","`","self.batch_size","`",".","Returns","--","--","--","-","Iterator","which","walks","over","the","batches"]
code: def default_generator(
      self,
      dataset: Dataset,
      epochs: int = 1,
      mode: str = "fit",
      deterministic: bool = True,
      pad_batches: bool = True,
  ) -> Iterable[Tuple[List, List, List]]:
      """Convert a dataset into the tensors needed for learning.
  
      Parameters
      ----------
      dataset: `dc.data.Dataset`
          Dataset to convert
      epochs: int, optional (Default 1)
          Number of times to walk over `dataset`
      mode: str, optional (Default 'fit')
          Ignored in this implementation.
      deterministic: bool, optional (Default True)
          Whether the dataset should be walked in a deterministic fashion
      pad_batches: bool, optional (Default True)
          If true, each returned batch will have size `self.batch_size`.
  
      Returns
      -------
      Iterator which walks over the batches
      """
  
      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 y_b is not None:
                  if self.mode == "classification":
                      y_b = to_one_hot(
                          y_b.flatten(), self.n_classes
                      ).reshape(-1, self.n_tasks, self.n_classes)
              inputs = self.compute_features_on_batch(X_b)
              yield (inputs, [y_b], [w_b])
  
imports: from collections.abc import Sequence
  import deepchem
  import numpy
  import tensorflow
  from typing import List, Union, Tuple, Iterable, Dict, Optional
  from deepchem.utils.typing import OneOrMany, LossFn, ActivationFn
  from deepchem.data import Dataset, pad_features
  from deepchem.feat.mol_graphs import ConvMol
  from deepchem.metrics import to_one_hot
  from deepchem.models import KerasModel, layers
  from deepchem.models.losses import L2Loss, SoftmaxCrossEntropy, Loss
  from tensorflow.keras.layers import Input, Dense, Reshape, Softmax, Dropout, Activation, BatchNormalization
  import warnings
label_desc: Use image node_id 3 for calling the WeaveModel obj's underlying member method code with example usage: obj.default_generator(dataset, epochs, mode, deterministic, pad_batches) without return types