def __make_train_placeholders()

in Models/exprsynth/nagdecoder.py [0:0]


    def __make_train_placeholders(self):
        eg_edge_type_num = len(self.__expansion_labeled_edge_types) + len(self.__expansion_unlabeled_edge_types)
        # Initial nodes I: Node IDs that will have no (active) incoming edges.
        self.placeholders['eg_initial_node_ids'] = \
            tf.placeholder(dtype=tf.int32, shape=[None], name="eg_initial_node_ids")

        # Sending nodes S_{s,e}: Source node ids of edges of type e propagating in step s.
        # Restrictions: If v in S_{s,e}, then v in R_{s'} for s' < s or v in I.
        self.placeholders['eg_sending_node_ids'] = \
            [[tf.placeholder(dtype=tf.int32,
                             shape=[None],
                             name="eg_sending_node_ids_step%i_edgetyp%i" % (step, edge_typ))
              for edge_typ in range(eg_edge_type_num)]
             for step in range(self.hyperparameters['eg_propagation_substeps'])]

        # Normalised edge target nodes T_{s}: Targets of edges propagating in step s, normalised to a
        # continuous range starting from 0. This is used for aggregating messages from the sending nodes.
        self.placeholders['eg_msg_target_node_ids'] = \
            [tf.placeholder(dtype=tf.int32,
                            shape=[None],
                            name="eg_msg_targets_nodes_step%i" % (step,))
             for step in range(self.hyperparameters['eg_propagation_substeps'])]

        # Receiving nodes R_{s}: Target node ids of aggregated messages in propagation step s.
        # Restrictions: If v in R_{s}, v not in R_{s'} for all s' != s and v not in I
        self.placeholders['eg_receiving_node_ids'] = \
            [tf.placeholder(dtype=tf.int32,
                            shape=[None],
                            name="eg_receiving_nodes_step%i" % (step,))
             for step in range(self.hyperparameters['eg_propagation_substeps'])]

        # Number of receiving nodes N_{s}
        # Restrictions: N_{s} = len(R_{s})
        self.placeholders['eg_receiving_node_nums'] = \
            tf.placeholder(dtype=tf.int32,
                           shape=[self.hyperparameters['eg_propagation_substeps']],
                           name="eg_receiving_nodes_nums")

        self.placeholders['eg_production_nodes'] = \
            tf.placeholder(dtype=tf.int32, shape=[None], name="eg_production_nodes")

        if self.hyperparameters['eg_use_vars_for_production_choice']:
            self.placeholders['eg_production_var_last_use_node_ids'] = \
                tf.placeholder(dtype=tf.int32,
                               shape=[None],
                               name="eg_production_var_last_use_node_ids")
            self.placeholders['eg_production_var_last_use_node_ids_target_ids'] = \
                tf.placeholder(dtype=tf.int32,
                               shape=[None],
                               name="eg_production_var_last_use_node_ids_target_ids")

        self.placeholders['eg_production_node_choices'] = \
            tf.placeholder(dtype=tf.int32, shape=[None], name="eg_production_node_choices")

        if self.hyperparameters['eg_use_context_attention']:
            self.placeholders['eg_production_to_context_id'] = \
                tf.placeholder(dtype=tf.int32, shape=[None], name="eg_production_to_context_id")

        self.placeholders['eg_varproduction_nodes'] = \
            tf.placeholder(dtype=tf.int32, shape=[None], name='eg_varproduction_nodes')

        self.placeholders['eg_varproduction_options_nodes'] = \
            tf.placeholder(dtype=tf.int32,
                           shape=[None, self.hyperparameters['eg_max_variable_choices']],
                           name='eg_varproduction_options_nodes')
        self.placeholders['eg_varproduction_options_mask'] = \
            tf.placeholder(dtype=tf.float32,
                           shape=[None, self.hyperparameters['eg_max_variable_choices']],
                           name='eg_varproduction_options_mask')
        self.placeholders['eg_varproduction_node_choices'] = \
            tf.placeholder(dtype=tf.int32,
                           shape=[None],
                           name='eg_varproduction_node_choices')
        self.placeholders['eg_litproduction_nodes'] = {}
        self.placeholders['eg_litproduction_node_choices'] = {}
        self.placeholders['eg_litproduction_to_context_id'] = {}
        self.placeholders['eg_litproduction_choice_normalizer'] = {}
        for literal_kind in LITERAL_NONTERMINALS:
            self.placeholders['eg_litproduction_nodes'][literal_kind] = \
                tf.placeholder(dtype=tf.int32,
                               shape=[None],
                               name="eg_litproduction_nodes_%s" % literal_kind)
            self.placeholders['eg_litproduction_node_choices'][literal_kind] = \
                tf.placeholder(dtype=tf.int32,
                               shape=[None],
                               name="eg_litproduction_node_choices_%s" % literal_kind)
            if self.hyperparameters['eg_use_literal_copying']:
                self.placeholders['eg_litproduction_to_context_id'][literal_kind] = \
                    tf.placeholder(dtype=tf.int32,
                                   shape=[None],
                                   name="eg_litproduction_to_context_id_%s" % literal_kind)
                self.placeholders['eg_litproduction_choice_normalizer'][literal_kind] = \
                    tf.placeholder(dtype=tf.int32,
                                   shape=[None],
                                   name="eg_litproduction_choice_normalizer_%s" % literal_kind)