Example #1
0
realstate = tf.placeholder(tf.float32, shape=([num_processing_steps,batch_size_tr*grounding_size,1]))
action_filled = tf.placeholder(tf.float32, shape=([num_processing_steps,batch_size_tr,dimension]))
action_filled_test = tf.placeholder(tf.float32, shape=([num_processing_steps,1,dimension]))



# get graphs
first_action = np.random.uniform(-6 / np.sqrt(dimension), 6 / np.sqrt(dimension), dimension)
first_action = np.array(first_action, dtype='float32')

nodes = [1] * ((grounding_size + 1) * dimension)
nodes = np.reshape(nodes, (grounding_size + 1,dimension))
nodes = np.array(nodes, dtype='float32')
graph_place = []
for temp_index in range(batch_size_tr):
    graph_place.append(base_graph(np.ones(grounding_size), grounding_size, first_action, dimension, nodes))
graphs_tuple_ph = utils_tf.placeholders_from_data_dicts(graph_place)

graphs_tuple_test = utils_tf.placeholders_from_data_dicts([base_graph(np.ones(grounding_size), grounding_size, first_action, dimension, nodes)])






model = new_model.GraphProcess(edge_output_size=1, dimension=dimension)
output_ops_tr, sta_vecs = model(graphs_tuple_ph, action_filled, num_processing_steps)

output_ops_test, sta_vecs_test = model(graphs_tuple_test, action_filled_test, num_processing_steps)

# Training Loss
Example #2
0
action_filled_index = tf.placeholder(
    tf.int32, shape=([num_processing_steps, batch_size_tr]))
action_filled_plan_onestep = tf.placeholder(tf.float32, shape=([1, dimension]))

# get graphs
first_action = np.random.uniform(-6 / np.sqrt(dimension),
                                 6 / np.sqrt(dimension), dimension)
first_action = np.array(first_action, dtype='float32')

nodes = [1] * ((grounding_size + 1) * dimension)
nodes = np.reshape(nodes, (grounding_size + 1, dimension))
nodes = np.array(nodes, dtype='float32')
graph_place = []
for temp_index in range(batch_size_tr):
    graph_place.append(
        base_graph(np.ones(grounding_size), grounding_size, first_action,
                   dimension, nodes))
graphs_tuple_ph = utils_tf.placeholders_from_data_dicts(graph_place)

graphs_tuple_goal = utils_tf.placeholders_from_data_dicts(graph_place)

model = new_model.GraphProcess(edge_output_size=1, dimension=dimension)
output_ops_tr, sta_vecs = model(graphs_tuple_ph, action_filled,
                                num_processing_steps)

action_size = len(action_dict) + 1
correct_action_output = tf.one_hot(indices=action_filled_index,
                                   depth=action_size)

goal_graph = model.getInitialVecForState(graphs_tuple_goal)
training_input, training_output = datas.getTrainData(sta_vecs, goal_graph,
                                                     correct_action_output,