code: def test():
      lbls = []
      imgs = []
      for lbl, img in test_data:
          lbls.append(lbl)
          imgs.append(img)
      dy.renew_cg()
      losses = network.create_network_return_loss(
          imgs, lbls, dropout=False
      )
      loss = dy.mean_batches(losses)
      predicts = network.create_network_return_best(imgs, dropout=False)
      correct = np.sum(lbls == predicts[0])
      print(
          "\nTest set: Average loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)\n".format(
              loss.value(),
              correct,
              len(test_data),
              100.0 * correct / len(test_data),
          )
      )
  
file_path: dynet/examples/mnist/basic-mnist-benchmarks/mnist_dynet_minibatch.py
imports: from __future__ import division
  import os
  import struct
  import argparse
  import random
  import time
  import numpy
  import dynet
label_desc: Use image node_id 3 for calling a global function with example usage: test() without return types