class_docstr: The method class for GraphDF algorithm proposed in the paper `GraphDF: A Discrete Flow Model for Molecular Graph Generation <https://arxiv.org/abs/2102.01189>`_. This class provides interfaces for running random generation, property
  optimization, and constrained optimization with GraphDF algorithm. Please refer to the `example codes <https://github.com/divelab/DIG/tree/dig-stable/examples/ggraph/GraphDF>`_ for usage examples.
class_docstr_tok: ["The","method","class","for","GraphDF","algorithm","proposed","in","the","paper","`","GraphDF",":","A","Discrete","Flow","Model","for","Molecular","Graph","Generation","<","https",":","\/\/arxiv.org\/abs\/2102.01189",">","`","_",".","This","class","provides","interfaces","for","running","random","generation",",","property","optimization",",","and","constrained","optimization","with","GraphDF","algorithm",".","Please","refer","to","the","`","example","codes","<","https",":","\/\/github.com\/divelab\/DIG\/tree\/dig-stable\/examples\/ggraph\/GraphDF",">","`","_","for","usage","examples","."]
code: def get_model(self, task, model_conf_dict, checkpoint_path=None):
      if model_conf_dict["use_gpu"] and not torch.cuda.is_available():
          model_conf_dict["use_gpu"] = False
      if task == "rand_gen":
          self.model = GraphFlowModel(model_conf_dict)
      elif task == "prop_opt":
          self.model = GraphFlowModel_rl(model_conf_dict)
      elif task == "const_prop_opt":
          self.model = GraphFlowModel_con_rl(model_conf_dict)
      else:
          raise ValueError(
              "Task {} is not supported in GraphDF!".format(task)
          )
      if checkpoint_path is not None:
          self.model.load_state_dict(torch.load(checkpoint_path))
  
file_path: DIG/dig/ggraph/method/GraphDF/graphdf.py
imports: import os
  import torch
  import torch.nn
  from rdkit import Chem
  from dig.ggraph.method import Generator
  from .model import GraphFlowModel, GraphFlowModel_rl, GraphFlowModel_con_rl
  from .train_utils import adjust_learning_rate, DataIterator
label_desc: Use image node_id 2 for calling the GraphDF obj's underlying member method code with example usage: obj.get_model(task, model_conf_dict, checkpoint_path) without return types