当前位置: 首页>>代码示例>>Python>>正文


Python data_utils.generate_feed_dict方法代码示例

本文整理汇总了Python中data_utils.generate_feed_dict方法的典型用法代码示例。如果您正苦于以下问题:Python data_utils.generate_feed_dict方法的具体用法?Python data_utils.generate_feed_dict怎么用?Python data_utils.generate_feed_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在data_utils的用法示例。


在下文中一共展示了data_utils.generate_feed_dict方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: evaluate

# 需要导入模块: import data_utils [as 别名]
# 或者: from data_utils import generate_feed_dict [as 别名]
def evaluate(sess, data, batch_size, graph, i):
  #computes accuracy
  num_examples = 0.0
  gc = 0.0
  for j in range(0, len(data) - batch_size + 1, batch_size):
    [ct] = sess.run([graph.final_correct],
                    feed_dict=data_utils.generate_feed_dict(data, j, batch_size,
                                                            graph))
    gc += ct * batch_size
    num_examples += batch_size
  print "dev set accuracy   after ", i, " : ", gc / num_examples
  print num_examples, len(data)
  print "--------" 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:15,代码来源:neural_programmer.py

示例2: Train

# 需要导入模块: import data_utils [as 别名]
# 或者: from data_utils import generate_feed_dict [as 别名]
def Train(graph, utility, batch_size, train_data, sess, model_dir,
          saver):
  #performs training
  curr = 0
  train_set_loss = 0.0
  utility.random.shuffle(train_data)
  start = time.time()
  for i in range(utility.FLAGS.train_steps):
    curr_step = i
    if (i > 0 and i % FLAGS.write_every == 0):
      model_file = model_dir + "/model_" + str(i)
      saver.save(sess, model_file)
    if curr + batch_size >= len(train_data):
      curr = 0
      utility.random.shuffle(train_data)
    step, cost_value = sess.run(
        [graph.step, graph.total_cost],
        feed_dict=data_utils.generate_feed_dict(
            train_data, curr, batch_size, graph, train=True, utility=utility))
    curr = curr + batch_size
    train_set_loss += cost_value
    if (i > 0 and i % FLAGS.eval_cycle == 0):
      end = time.time()
      time_taken = end - start
      print "step ", i, " ", time_taken, " seconds "
      start = end
      print " printing train set loss: ", train_set_loss / utility.FLAGS.eval_cycle
      train_set_loss = 0.0 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:30,代码来源:neural_programmer.py

示例3: evaluate

# 需要导入模块: import data_utils [as 别名]
# 或者: from data_utils import generate_feed_dict [as 别名]
def evaluate(sess, data, batch_size, graph, i):
  #computes accuracy
  num_examples = 0.0
  gc = 0.0
  for j in range(0, len(data) - batch_size + 1, batch_size):
    [ct] = sess.run([graph.final_correct],
                    feed_dict=data_utils.generate_feed_dict(data, j, batch_size,
                                                            graph))
    gc += ct * batch_size
    num_examples += batch_size
  print("dev set accuracy   after ", i, " : ", gc / num_examples)
  print(num_examples, len(data))
  print("--------") 
开发者ID:itsamitgoel,项目名称:Gun-Detector,代码行数:15,代码来源:neural_programmer.py

示例4: Train

# 需要导入模块: import data_utils [as 别名]
# 或者: from data_utils import generate_feed_dict [as 别名]
def Train(graph, utility, batch_size, train_data, sess, model_dir,
          saver):
  #performs training
  curr = 0
  train_set_loss = 0.0
  utility.random.shuffle(train_data)
  start = time.time()
  for i in range(utility.FLAGS.train_steps):
    curr_step = i
    if (i > 0 and i % FLAGS.write_every == 0):
      model_file = model_dir + "/model_" + str(i)
      saver.save(sess, model_file)
    if curr + batch_size >= len(train_data):
      curr = 0
      utility.random.shuffle(train_data)
    step, cost_value = sess.run(
        [graph.step, graph.total_cost],
        feed_dict=data_utils.generate_feed_dict(
            train_data, curr, batch_size, graph, train=True, utility=utility))
    curr = curr + batch_size
    train_set_loss += cost_value
    if (i > 0 and i % FLAGS.eval_cycle == 0):
      end = time.time()
      time_taken = end - start
      print("step ", i, " ", time_taken, " seconds ")
      start = end
      print(" printing train set loss: ", train_set_loss / utility.FLAGS.eval_cycle)
      train_set_loss = 0.0 
开发者ID:itsamitgoel,项目名称:Gun-Detector,代码行数:30,代码来源:neural_programmer.py


注:本文中的data_utils.generate_feed_dict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。