class_docstr: Tests and benchmarks for interacting with the `tf.compat.v1.Session`.
class_docstr_tok: ["Tests","and","benchmarks","for","interacting","with","the","`","tf.compat.v1.Session","`","."]
docstr: Runs a microbenchmark to measure the cost of feeding a tensor.
  
  Reports the median cost of feeding a tensor of `size` * `sizeof(float)`
  bytes.
  
  Args:
    name: A human-readable name for logging the output.
    target: The session target to use for the benchmark.
    size: The number of floating-point numbers to be feed.
    iters: The number of iterations to perform.
docstr_tok: ["Runs","a","microbenchmark","to","measure","the","cost","of","feeding","a","tensor",".","Reports","the","median","cost","of","feeding","a","tensor","of","`","size","`","*","`","sizeof","(","float",")","`","bytes",".","Args",":","name",":","A","human-readable","name","for","logging","the","output",".","target",":","The","session","target","to","use","for","the","benchmark",".","size",":","The","number","of","floating-point","numbers","to","be","feed",".","iters",":","The","number","of","iterations","to","perform","."]
code: def _benchmarkFeed(self, name, target, size, iters):
      """Runs a microbenchmark to measure the cost of feeding a tensor.
  
      Reports the median cost of feeding a tensor of `size` * `sizeof(float)`
      bytes.
  
      Args:
        name: A human-readable name for logging the output.
        target: The session target to use for the benchmark.
        size: The number of floating-point numbers to be feed.
        iters: The number of iterations to perform.
      """
      feed_val = np.random.rand(size).astype(np.float32)
      times = []
      with ops.Graph().as_default():
          p = array_ops.placeholder(dtypes.float32, shape=[size])
          # Fetch the operation rather than the tensor, to avoid measuring the time
          # to fetch back the value.
          no_op = array_ops.identity(p).op
          with session.Session(target) as sess:
              sess.run(no_op, feed_dict={p: feed_val})  # Warm-up run.
              for _ in range(iters):
                  start_time = time.time()
                  sess.run(no_op, feed_dict={p: feed_val})
                  end_time = time.time()
                  times.append(end_time - start_time)
      print("%s %d %f" % (name, size, np.median(times)))
      self.report_benchmark(
          iters=1, wall_time=np.median(times), name=name
      )
  
file_path: tensorflow/tensorflow/python/client/session_benchmark.py
imports: import time
  import numpy
  from tensorflow.python.client import session
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
  from tensorflow.python.training import server_lib
label_desc: Use image node_id 1 for calling the SessionBenchmark obj's underlying member method code with example usage: obj._benchmarkFeed(name, target, size, iters) without return types