code: def train():
      total_loss = total_examples = 0
      for data in train_loader:
          data = data.to(device)
          optimizer.zero_grad()
          out = model(
              data.x, data.edge_index, data.edge_attr, data.batch
          )
          loss = F.mse_loss(out, data.y)
          loss.backward()
          optimizer.step()
          total_loss += float(loss) * data.num_graphs
          total_examples += data.num_graphs
      return sqrt(total_loss / total_examples)
  
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 1 for calling a global function with example usage: train() and returns: sqrt