本文整理汇总了Python中tfcode.tf_utils.setup_inputs方法的典型用法代码示例。如果您正苦于以下问题:Python tf_utils.setup_inputs方法的具体用法?Python tf_utils.setup_inputs怎么用?Python tf_utils.setup_inputs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tfcode.tf_utils
的用法示例。
在下文中一共展示了tf_utils.setup_inputs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _inputs
# 需要导入模块: from tfcode import tf_utils [as 别名]
# 或者: from tfcode.tf_utils import setup_inputs [as 别名]
def _inputs(problem, lstm_states, lstm_state_dims):
# Set up inputs.
with tf.name_scope('inputs'):
n_views = problem.n_views
inputs = []
inputs.append(('orig_maps', tf.float32,
(problem.batch_size, 1, None, None, 1)))
inputs.append(('goal_loc', tf.float32,
(problem.batch_size, problem.num_goals, 2)))
# For initing LSTM.
inputs.append(('rel_goal_loc_at_start', tf.float32,
(problem.batch_size, problem.num_goals,
problem.rel_goal_loc_dim)))
common_input_data, _ = tf_utils.setup_inputs(inputs)
inputs = []
inputs.append(('imgs', tf.float32, (problem.batch_size, None, n_views,
problem.img_height, problem.img_width,
problem.img_channels)))
# Goal location as a tuple of delta location and delta theta.
inputs.append(('rel_goal_loc', tf.float32, (problem.batch_size, None,
problem.rel_goal_loc_dim)))
if problem.outputs.visit_count:
inputs.append(('visit_count', tf.int32, (problem.batch_size, None, 1)))
inputs.append(('last_visit', tf.int32, (problem.batch_size, None, 1)))
for i, (state, dim) in enumerate(zip(lstm_states, lstm_state_dims)):
inputs.append((state, tf.float32, (problem.batch_size, 1, dim)))
if problem.outputs.egomotion:
inputs.append(('incremental_locs', tf.float32,
(problem.batch_size, None, 2)))
inputs.append(('incremental_thetas', tf.float32,
(problem.batch_size, None, 1)))
inputs.append(('step_number', tf.int32, (1, None, 1)))
inputs.append(('node_ids', tf.int32, (problem.batch_size, None,
problem.node_ids_dim)))
inputs.append(('perturbs', tf.float32, (problem.batch_size, None,
problem.perturbs_dim)))
# For plotting result plots
inputs.append(('loc_on_map', tf.float32, (problem.batch_size, None, 2)))
inputs.append(('gt_dist_to_goal', tf.float32, (problem.batch_size, None, 1)))
step_input_data, _ = tf_utils.setup_inputs(inputs)
inputs = []
inputs.append(('executed_actions', tf.int32, (problem.batch_size, None)))
inputs.append(('rewards', tf.float32, (problem.batch_size, None)))
inputs.append(('action_sample_wts', tf.float32, (problem.batch_size, None)))
inputs.append(('action', tf.int32, (problem.batch_size, None,
problem.num_actions)))
train_data, _ = tf_utils.setup_inputs(inputs)
train_data.update(step_input_data)
train_data.update(common_input_data)
return common_input_data, step_input_data, train_data