code: def test_ensemble_eval(self):
      simple_model2 = td.Model()
      y2, sess2 = self.get("simple2", "y", "sess")
      simple_model2.add(y2, tf_sess=sess2)
  
      simple_model2.get("input_1").name = "input:0"
      simple_model2.get("output_1").name = "output:0"
      simple_model2.get("keep_prob_1").name = "keep_prob:0"
  
      simple_ensemble = td.Ensemble()
      simple_ensemble.models = [self.simple_model, simple_model2]
  
      inp, outp, kp = simple_ensemble.get(
          "input", "output", "keep_prob"
      )
  
      # create an input batch
      examples = np.random.rand(1000, 10).astype("float32")
  
      # eval both models manually and build the mean
      x1, y1, keep_prob1 = self.simple_model.get(
          "input", "output", "keep_prob"
      )
      r1 = y1.eval({x1: examples, keep_prob1: 1.0})
      x2, y2, keep_prob2 = simple_model2.get(
          "input", "output", "keep_prob"
      )
      r2 = y2.eval({x2: examples, keep_prob2: 1.0})
      rm = np.add(r1, r2) / 2.0
  
      # then, eval the ensemble
      re = outp.eval({inp: examples, kp: 1.0})
  
      # no element in the diff array should be larger than 1e-7
      maxdiff = np.max(np.abs(re - rm))
      self.assertLess(maxdiff, 1e-7)
  
file_path: tfdeploy/tests/core.py
imports: import numpy
  from .base import TestCase, td
label_desc: Use image node_id 5 for calling the CoreTestCase obj's underlying member method code with example usage: obj.test_ensemble_eval() without return types