code: def evaluate(args, net, dataset, segment="valid"):
      possible_rating_values = dataset.possible_rating_values
      nd_possible_rating_values = th.FloatTensor(
          possible_rating_values
      ).to(args.device)
  
      if segment == "valid":
          rating_values = dataset.valid_truths
          enc_graph = dataset.valid_enc_graph
          dec_graph = dataset.valid_dec_graph
      elif segment == "test":
          rating_values = dataset.test_truths
          enc_graph = dataset.test_enc_graph
          dec_graph = dataset.test_dec_graph
      else:
          raise NotImplementedError
  
      # Evaluate RMSE
      net.eval()
      with th.no_grad():
          pred_ratings = net(
              enc_graph,
              dec_graph,
              dataset.user_feature,
              dataset.movie_feature,
          )
      real_pred_ratings = (
          th.softmax(pred_ratings, dim=1)
          * nd_possible_rating_values.view(1, -1)
      ).sum(dim=1)
      rmse = ((real_pred_ratings - rating_values) ** 2.0).mean().item()
      rmse = np.sqrt(rmse)
      return rmse
  
file_path: dgl/examples/pytorch/gcmc/train.py
imports: import argparse
  import logging
  import os
  import random
  import string
  import time
  import numpy
  import torch
  import torch.nn
  from data import MovieLens
  from model import BiDecoder, GCMCLayer
  from utils import get_activation, get_optimizer, MetricLogger, torch_net_info, torch_total_param_num
label_desc: Use image node_id 1 for calling a global function with example usage: evaluate(args, net, dataset, segment) and returns: rmse