class_docstr: Featurizer for MolGAN de-novo molecular generation [1]_.
  The default representation is in form of GraphMatrix object.
  It is wrapper for two matrices containing atom and bond type information.
  The class also provides reverse capabilities.
  
  Examples
  --------
  >>> import deepchem as dc
  >>> from rdkit import Chem
  >>> rdkit_mol, smiles_mol = Chem.MolFromSmiles('CCC'), 'C1=CC=CC=C1'
  >>> molecules = [rdkit_mol, smiles_mol]
  >>> featurizer = dc.feat.MolGanFeaturizer()
  >>> features = featurizer.featurize(molecules)
  >>> len(features) # 2 molecules
  2
  >>> type(features[0])
  <class 'deepchem.feat.molecule_featurizers.molgan_featurizer.GraphMatrix'>
  >>> molecules = featurizer.defeaturize(features) # defeaturization
  >>> type(molecules[0])
  <class 'rdkit.Chem.rdchem.Mol'>
docstr: Calculates molecules from corresponding GraphMatrix objects.
  
  Parameters
  ----------
  graphs: GraphMatrix / iterable
      GraphMatrix object or corresponding iterable
  log_every_n: int, default 1000
      Logging messages reported every `log_every_n` samples.
  
  Returns
  -------
  features: np.ndarray
      A numpy array containing RDKitMol objext.
docstr_tok: ["Calculates","molecules","from","corresponding","GraphMatrix","objects",".","Parameters","--","--","--","--","--","graphs",":","GraphMatrix","\/","iterable","GraphMatrix","object","or","corresponding","iterable","log_every_n",":","int",",","default","1000","Logging","messages","reported","every","`","log_every_n","`","samples",".","Returns","--","--","--","-","features",":","np.ndarray","A","numpy","array","containing","RDKitMol","objext","."]
code: def defeaturize(
      self, graphs: OneOrMany[GraphMatrix], log_every_n: int = 1000
  ) -> np.ndarray:
      """
      Calculates molecules from corresponding GraphMatrix objects.
  
      Parameters
      ----------
      graphs: GraphMatrix / iterable
          GraphMatrix object or corresponding iterable
      log_every_n: int, default 1000
          Logging messages reported every `log_every_n` samples.
  
      Returns
      -------
      features: np.ndarray
          A numpy array containing RDKitMol objext.
  
      """
  
      # Special case handling of single molecule
      if isinstance(graphs, GraphMatrix):
          graphs = [graphs]
      else:
          # Convert iterables to list
          graphs = list(graphs)
  
      molecules = []
      for i, gr in enumerate(graphs):
          if i % log_every_n == 0:
              logger.info("Featurizing datapoint %i" % i)
  
          try:
              molecules.append(self._defeaturize(gr))
          except Exception as e:
              logger.warning(
                  "Failed to defeaturize datapoint %d, %s. Appending empty array",
                  i,
                  gr,
              )
              logger.warning("Exception message: {}".format(e))
              molecules.append(np.array([]))
  
      return np.asarray(molecules)
  
file_path: deepchem/deepchem/feat/molecule_featurizers/molgan_featurizer.py
imports: import logging
  import numpy
  from deepchem.utils.typing import RDKitBond, RDKitMol, List
  from deepchem.feat.base_classes import MolecularFeaturizer
  from deepchem.utils.typing import OneOrMany
  from typing import Optional
label_desc: Use image node_id 4 for calling the MolGanFeaturizer obj's underlying member method code with example usage: obj.defeaturize(graphs, log_every_n) and returns: np