code: def evaluate_model(sess, model, data_set):
      """Returns the average weighted cost, reconstruction cost and KL cost."""
      total_cost = 0.0
      total_r_cost = 0.0
      total_kl_cost = 0.0
      for batch in range(data_set.num_batches):
          unused_orig_x, x, s = data_set.get_batch(batch)
          feed = {model.input_data: x, model.sequence_lengths: s}
          (cost, r_cost, kl_cost) = sess.run(
              [model.cost, model.r_cost, model.kl_cost], feed
          )
          total_cost += cost
          total_r_cost += r_cost
          total_kl_cost += kl_cost
  
      total_cost /= data_set.num_batches
      total_r_cost /= data_set.num_batches
      total_kl_cost /= data_set.num_batches
      return (total_cost, total_r_cost, total_kl_cost)
  
imports: import json
  import os
  import time
  import zipfile
  from magenta.models.sketch_rnn import model
  from magenta.models.sketch_rnn import utils
  import numpy
  import requests
  import six
  from six.moves.urllib.request import urlretrieve
  import tensorflow.compat.v1
label_desc: Use image node_id 6 for calling a global function with example usage: evaluate_model(sess, model, data_set) and returns: total_cost,  total_r_cost,  total_kl_cost