original_docstring: 
      Runs one inference (evaluation) epoch (all the files in the loader)
      
docstring: Runs one inference (evaluation) epoch (all the files in the loader)
docstring_tokens: Runs one inference ( evaluation ) epoch ( all the files in the loader )
code: def Inference(sess, model):
      """
      Runs one inference (evaluation) epoch (all the files in the loader)
      """
  
      inference_op = model.towers[0].inference
      if FLAGS.labels_list:  # Classification -> assume softmax usage
          # Append a softmax op
          inference_op = tf.nn.softmax(inference_op)
  
      weight_vars = []
      activation_ops = []
      if FLAGS.visualize_inf:
          trainable_weights = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
          # Retrace the origin op of each variable
          for n in tf.get_default_graph().as_graph_def().node:
              for tw in trainable_weights:
                  tw_name_reader = tw.name.split(':')[0] + '/read'
                  if tw_name_reader in n.input:
                      node_op_name = n.name + ':0'  # @TODO(tzaman) this assumes exactly 1 output - allow to be dynamic!
                      weight_vars.append(tw)
                      activation_ops.append(node_op_name)
                      continue
  
      try:
          while not model.queue_coord.should_stop():
              keys, preds, [w], [a] = sess.run([model.dataloader.batch_k,
                                                inference_op,
                                                [weight_vars],
                                                [activation_ops]])
  
              if FLAGS.visualize_inf:
                  save_weight_visualization(weight_vars, activation_ops, w, a)
  
              # @TODO(tzaman): error on no output?
              for i in range(len(keys)):
                  #    for j in range(len(preds)):
                  # We're allowing multiple predictions per image here. DIGITS doesnt support that iirc
  
                  logging.info('Predictions for image ' + str(model.dataloader.get_key_index(keys[i].decode('utf-8'))) +
                               ': ' + json.dumps(preds[i].tolist()))
      except tf.errors.OutOfRangeError:
          print('Done: tf.errors.OutOfRangeError')
code_tokens: def Inference ( sess , model ) : inference_op = model . towers [ 0 ] . inference if FLAGS . labels_list : inference_op = tf . nn . softmax ( inference_op ) weight_vars = [ ] activation_ops = [ ] if FLAGS . visualize_inf : trainable_weights = tf . get_collection ( tf . GraphKeys . TRAINABLE_VARIABLES ) for n in tf . get_default_graph ( ) . as_graph_def ( ) . node : for tw in trainable_weights : tw_name_reader = tw . name . split ( ':' ) [ 0 ] + '/read' if tw_name_reader in n . input : node_op_name = n . name + ':0' weight_vars . append ( tw ) activation_ops . append ( node_op_name ) continue try : while not model . queue_coord . should_stop ( ) : keys , preds , [ w ] , [ a ] = sess . run ( [ model . dataloader . batch_k , inference_op , [ weight_vars ] , [ activation_ops ] ] ) if FLAGS . visualize_inf : save_weight_visualization ( weight_vars , activation_ops , w , a ) for i in range ( len ( keys ) ) : logging . info ( 'Predictions for image ' + str ( model . dataloader . get_key_index ( keys [ i ] . decode ( 'utf-8' ) ) ) + ': ' + json . dumps ( preds [ i ] . tolist ( ) ) ) except tf . errors . OutOfRangeError : print ( 'Done: tf.errors.OutOfRangeError' )
short_docstring: Runs one inference (evaluation) epoch (all the files in the loader)
short_docstring_tokens: Runs one inference ( evaluation ) epoch ( all the files in the loader )
comment: """
      Runs one inference (evaluation) epoch (all the files in the loader)
      """$SEP$# Classification -> assume softmax usage$SEP$# Append a softmax op$SEP$# Retrace the origin op of each variable$SEP$# @TODO(tzaman) this assumes exactly 1 output - allow to be dynamic!$SEP$# @TODO(tzaman): error on no output?$SEP$#    for j in range(len(preds)):$SEP$# We're allowing multiple predictions per image here. DIGITS doesnt support that iirc