class_docstr: A Convolutional neural network on smiles strings
  
  Reimplementation of the discriminator module in ORGAN [1]_ .
  Originated from [2]_.
  
  This model applies multiple 1D convolutional filters to
  the padded strings, then max-over-time pooling is applied on
  all filters, extracting one feature per filter.  All
  features are concatenated and transformed through several
  hidden layers to form predictions.
  
  This model is initially developed for sentence-level
  classification tasks, with words represented as vectors. In
  this implementation, SMILES strings are dissected into
  characters and transformed to one-hot vectors in a similar
  way. The model can be used for general molecular-level
  classification or regression tasks. It is also used in the
  ORGAN model as discriminator.
  
  Training of the model only requires SMILES strings input,
  all featurized datasets that include SMILES in the `ids`
  attribute are accepted. PDBbind, QM7 and QM7b are not
  supported. To use the model, `build_char_dict` should be
  called first before defining the model to build character
  dict of input dataset, example can be found in
  examples/delaney/delaney_textcnn.py
  
  References
  ----------
  .. [1]  Guimaraes, Gabriel Lima, et al. "Objective-reinforced generative adversarial networks (ORGAN) for sequence generation models." arXiv preprint arXiv:1705.10843 (2017).
  .. [2] Kim, Yoon. "Convolutional neural networks for sentence classification." arXiv preprint arXiv:1408.5882 (2014).
class_docstr_tok: ["A","Convolutional","neural","network","on","smiles","strings","Reimplementation","of","the","discriminator","module","in","ORGAN","[","1","]","_",".","Originated","from","[","2","]","_",".","This","model","applies","multiple","1D","convolutional","filters","to","the","padded","strings",",","then","max-over-time","pooling","is","applied","on","all","filters",",","extracting","one","feature","per","filter",".","All","features","are","concatenated","and","transformed","through","several","hidden","layers","to","form","predictions",".","This","model","is","initially","developed","for","sentence-level","classification","tasks",",","with","words","represented","as","vectors",".","In","this","implementation",",","SMILES","strings","are","dissected","into","characters","and","transformed","to","one-hot","vectors","in","a","similar","way",".","The","model","can","be","used","for","general","molecular-level","classification","or","regression","tasks",".","It","is","also","used","in","the","ORGAN","model","as","discriminator",".","Training","of","the","model","only","requires","SMILES","strings","input",",","all","featurized","datasets","that","include","SMILES","in","the","`","ids","`","attribute","are","accepted",".","PDBbind",",","QM7","and","QM7b","are","not","supported",".","To","use","the","model",",","`","build_char_dict","`","should","be","called","first","before","defining","the","model","to","build","character","dict","of","input","dataset",",","example","can","be","found","in","examples\/delaney\/delaney_textcnn.py","References","--","--","--","--","--","..","[","1","]","Guimaraes",",","Gabriel","Lima",",","et","al",".","``","Objective-reinforced","generative","adversarial","networks","(","ORGAN",")","for","sequence","generation","models",".","''","arXiv","preprint","arXiv:1705.10843","(","2017",")",".","..","[","2","]","Kim",",","Yoon",".","``","Convolutional","neural","networks","for","sentence","classification",".","''","arXiv","preprint","arXiv:1408.5882","(","2014",")","."]
docstr: Converts SMILES strings to np.array sequence.
  
  A tf.py_func wrapper is written around this when creating the input_fn for make_estimator
docstr_tok: ["Converts","SMILES","strings","to","np.array","sequence",".","A","tf.py_func","wrapper","is","written","around","this","when","creating","the","input_fn","for","make_estimator"]
code: def smiles_to_seq_batch(self, ids_b):
      """Converts SMILES strings to np.array sequence.
  
      A tf.py_func wrapper is written around this when creating the input_fn for make_estimator
      """
      if (
          isinstance(ids_b[0], bytes) and sys.version_info[0] != 2
      ):  # Python 2.7 bytes and string are analogous
          ids_b = [
              TextCNNModel.convert_bytes_to_char(smiles)
              for smiles in ids_b
          ]
      smiles_seqs = [self.smiles_to_seq(smiles) for smiles in ids_b]
      smiles_seqs = np.vstack(smiles_seqs)
      return smiles_seqs
  
file_path: deepchem/deepchem/models/text_cnn.py
imports: import numpy
  import tensorflow
  import copy
  import sys
  from deepchem.metrics import to_one_hot
  from deepchem.models import KerasModel, layers
  from deepchem.models.losses import L2Loss, SoftmaxCrossEntropy
  from tensorflow.keras.layers import Input, Dense, Reshape, Softmax, Dropout, Conv1D, Concatenate, Lambda
  import warnings
label_desc: Use image node_id 4 for calling the TextCNNModel obj's underlying member method code with example usage: obj.smiles_to_seq_batch(ids_b) and returns: smiles_seqs