code: def __call__(self, data):
      # Generate AttentiveFP features according to Table 1.
      mol = Chem.MolFromSmiles(data.smiles)
  
      xs = []
      for atom in mol.GetAtoms():
          symbol = [0.0] * len(self.symbols)
          symbol[self.symbols.index(atom.GetSymbol())] = 1.0
          degree = [0.0] * 6
          degree[atom.GetDegree()] = 1.0
          formal_charge = atom.GetFormalCharge()
          radical_electrons = atom.GetNumRadicalElectrons()
          hybridization = [0.0] * len(self.hybridizations)
          hybridization[
              self.hybridizations.index(atom.GetHybridization())
          ] = 1.0
          aromaticity = 1.0 if atom.GetIsAromatic() else 0.0
          hydrogens = [0.0] * 5
          hydrogens[atom.GetTotalNumHs()] = 1.0
          chirality = 1.0 if atom.HasProp("_ChiralityPossible") else 0.0
          chirality_type = [0.0] * 2
          if atom.HasProp("_CIPCode"):
              chirality_type[
                  ["R", "S"].index(atom.GetProp("_CIPCode"))
              ] = 1.0
  
          x = torch.tensor(
              symbol
              + degree
              + [formal_charge]
              + [radical_electrons]
              + hybridization
              + [aromaticity]
              + hydrogens
              + [chirality]
              + chirality_type
          )
          xs.append(x)
  
      data.x = torch.stack(xs, dim=0)
  
      edge_indices = []
      edge_attrs = []
      for bond in mol.GetBonds():
          edge_indices += [
              [bond.GetBeginAtomIdx(), bond.GetEndAtomIdx()]
          ]
          edge_indices += [
              [bond.GetEndAtomIdx(), bond.GetBeginAtomIdx()]
          ]
  
          bond_type = bond.GetBondType()
          single = (
              1.0 if bond_type == Chem.rdchem.BondType.SINGLE else 0.0
          )
          double = (
              1.0 if bond_type == Chem.rdchem.BondType.DOUBLE else 0.0
          )
          triple = (
              1.0 if bond_type == Chem.rdchem.BondType.TRIPLE else 0.0
          )
          aromatic = (
              1.0 if bond_type == Chem.rdchem.BondType.AROMATIC else 0.0
          )
          conjugation = 1.0 if bond.GetIsConjugated() else 0.0
          ring = 1.0 if bond.IsInRing() else 0.0
          stereo = [0.0] * 4
          stereo[self.stereos.index(bond.GetStereo())] = 1.0
  
          edge_attr = torch.tensor(
              [single, double, triple, aromatic, conjugation, ring]
              + stereo
          )
  
          edge_attrs += [edge_attr, edge_attr]
  
      if len(edge_attrs) == 0:
          data.edge_index = torch.zeros((2, 0), dtype=torch.long)
          data.edge_attr = torch.zeros((0, 10), dtype=torch.float)
      else:
          data.edge_index = torch.tensor(edge_indices).t().contiguous()
          data.edge_attr = torch.stack(edge_attrs, dim=0)
  
      return data
  
file_path: pytorch_geometric/examples/attentive_fp.py
imports: import os.path
  from math import sqrt
  import torch
  import torch.nn.functional
  from rdkit import Chem
  from torch_geometric.datasets import MoleculeNet
  from torch_geometric.loader import DataLoader
  from torch_geometric.nn.models import AttentiveFP
label_desc: Use image node_id 2 for calling the GenFeatures obj's underlying member method code with example usage: obj.__call__(data) and returns: data