class_docstr: Model for de-novo generation of small molecules based on work of Nicola De Cao et al. [1]_.
  It uses a GAN directly on graph data and a reinforcement learning objective to induce the network to generate molecules with certain chemical properties.
  Utilizes WGAN infrastructure; uses adjacency matrix and node features as inputs.
  Inputs need to be one-hot representation.
  
  Examples
  --------
  >>>
  >> import deepchem as dc
  >> from deepchem.models import BasicMolGANModel as MolGAN
  >> from deepchem.models.optimizers import ExponentialDecay
  >> from tensorflow import one_hot
  >> smiles = ['CCC', 'C1=CC=CC=C1', 'CNC' ]
  >> # create featurizer
  >> feat = dc.feat.MolGanFeaturizer()
  >> # featurize molecules
  >> features = feat.featurize(smiles)
  >> # Remove empty objects
  >> features = list(filter(lambda x: x is not None, features))
  >> # create model
  >> gan = MolGAN(learning_rate=ExponentialDecay(0.001, 0.9, 5000))
  >> dataset = dc.data.NumpyDataset([x.adjacency_matrix for x in features],[x.node_features for x in features])
  >> def iterbatches(epochs):
  >>     for i in range(epochs):
  >>         for batch in dataset.iterbatches(batch_size=gan.batch_size, pad_batches=True):
  >>             adjacency_tensor = one_hot(batch[0], gan.edges)
  >>             node_tensor = one_hot(batch[1], gan.nodes)
  >>             yield {gan.data_inputs[0]: adjacency_tensor, gan.data_inputs[1]:node_tensor}
  >> gan.fit_gan(iterbatches(8), generator_steps=0.2, checkpoint_interval=5000)
  >> generated_data = gan.predict_gan_generator(1000)
  >> # convert graphs to RDKitmolecules
  >> nmols = feat.defeaturize(generated_data)
  >> print("{} molecules generated".format(len(nmols)))
  >> # remove invalid moles
  >> nmols = list(filter(lambda x: x is not None, nmols))
  >> # currently training is unstable so 0 is a common outcome
  >> print ("{} valid molecules".format(len(nmols)))
  
  References
  ----------
  .. [1] Nicola De Cao et al. "MolGAN: An implicit generative model
      for small molecular graphs", https://arxiv.org/abs/1805.11973
class_docstr_tok: ["Model","for","de-novo","generation","of","small","molecules","based","on","work","of","Nicola","De","Cao","et","al",".","[","1","]","_",".","It","uses","a","GAN","directly","on","graph","data","and","a","reinforcement","learning","objective","to","induce","the","network","to","generate","molecules","with","certain","chemical","properties",".","Utilizes","WGAN","infrastructure",";","uses","adjacency","matrix","and","node","features","as","inputs",".","Inputs","need","to","be","one-hot","representation",".","Examples","--","--","--","--",">",">",">",">",">","import","deepchem","as","dc",">",">","from","deepchem.models","import","BasicMolGANModel","as","MolGAN",">",">","from","deepchem.models.optimizers","import","ExponentialDecay",">",">","from","tensorflow","import","one_hot",">",">","smiles","=","[","'CCC","'",",","'C1=CC=CC=C1","'",",","'CNC","'","]",">",">","#","create","featurizer",">",">","feat","=","dc.feat.MolGanFeaturizer","(",")",">",">","#","featurize","molecules",">",">","features","=","feat.featurize","(","smiles",")",">",">","#","Remove","empty","objects",">",">","features","=","list","(","filter","(","lambda","x",":","x","is","not","None",",","features",")",")",">",">","#","create","model",">",">","gan","=","MolGAN","(","learning_rate=ExponentialDecay","(","0.001",",","0.9",",","5000",")",")",">",">","dataset","=","dc.data.NumpyDataset","(","[","x.adjacency_matrix","for","x","in","features","]",",","[","x.node_features","for","x","in","features","]",")",">",">","def","iterbatches","(","epochs",")",":",">",">","for","i","in","range","(","epochs",")",":",">",">","for","batch","in","dataset.iterbatches","(","batch_size=gan.batch_size",",","pad_batches=True",")",":",">",">","adjacency_tensor","=","one_hot","(","batch","[","0","]",",","gan.edges",")",">",">","node_tensor","=","one_hot","(","batch","[","1","]",",","gan.nodes",")",">",">","yield","{","gan.data_inputs","[","0","]",":","adjacency_tensor",",","gan.data_inputs","[","1","]",":","node_tensor","}",">",">","gan.fit_gan","(","iterbatches","(","8",")",",","generator_steps=0.2",",","checkpoint_interval=5000",")",">",">","generated_data","=","gan.predict_gan_generator","(","1000",")",">",">","#","convert","graphs","to","RDKitmolecules",">",">","nmols","=","feat.defeaturize","(","generated_data",")",">",">","print","(","``","{","}","molecules","generated","''",".format","(","len","(","nmols",")",")",")",">",">","#","remove","invalid","moles",">",">","nmols","=","list","(","filter","(","lambda","x",":","x","is","not","None",",","nmols",")",")",">",">","#","currently","training","is","unstable","so","0","is","a","common","outcome",">",">","print","(","``","{","}","valid","molecules","''",".format","(","len","(","nmols",")",")",")","References","--","--","--","--","--","..","[","1","]","Nicola","De","Cao","et","al",".","``","MolGAN",":","An","implicit","generative","model","for","small","molecular","graphs","''",",","https",":","\/\/arxiv.org\/abs\/1805.11973"]
docstr: Return input shape of the discriminator
  
  Returns
  -------
  List
      List of shapes used as an input for distriminator.
docstr_tok: ["Return","input","shape","of","the","discriminator","Returns","--","--","--","-","List","List","of","shapes","used","as","an","input","for","distriminator","."]
code: def get_data_input_shapes(self) -> List:
      """
      Return input shape of the discriminator
  
      Returns
      -------
      List
          List of shapes used as an input for distriminator.
      """
      return [
          (self.vertices, self.vertices, self.edges),
          (self.vertices, self.nodes),
      ]
  
file_path: deepchem/deepchem/models/molgan.py
imports: from typing import Optional, List, Tuple, Any
  import tensorflow
  from deepchem.feat.molecule_featurizers.molgan_featurizer import GraphMatrix
  from deepchem.models import WGAN
  from deepchem.models.layers import MolGANEncoderLayer
  from tensorflow import keras
  from tensorflow.keras import layers
label_desc: Use image node_id 3 for calling the BasicMolGANModel obj's underlying member method code with example usage: obj.get_data_input_shapes() and returns: list