示例#1
0
    def local_initialize_train(self):
        vertex_feature_dimension = self.entity_count if self.onehot_input else self.shape[
            0]
        type_matrix_shape = (self.relation_count, self.n_coefficients)
        vertex_matrix_shape = (vertex_feature_dimension, self.n_coefficients,
                               self.shape[1])
        self_matrix_shape = (vertex_feature_dimension, self.shape[1])

        glorot_var_combined = glorot_variance(
            [vertex_matrix_shape[0], vertex_matrix_shape[2]])
        self.W_forward = make_tf_variable(0, glorot_var_combined,
                                          vertex_matrix_shape)
        self.W_backward = make_tf_variable(0, glorot_var_combined,
                                           vertex_matrix_shape)
        self.W_self = make_tf_variable(0, glorot_var_combined,
                                       self_matrix_shape)

        type_init_var = 1
        self.C_forward = make_tf_variable(0, type_init_var, type_matrix_shape)
        self.C_backward = make_tf_variable(0, type_init_var, type_matrix_shape)

        self.b = make_tf_bias(self.shape[1])

        self.cached_vertex_embeddings = tf.Variable(
            np.zeros(self_matrix_shape, dtype=np.float32))
        self.cached_messages_f = tf.Variable(
            np.zeros((self.edge_count, self.shape[1]), dtype=np.float32))
        self.cached_messages_b = tf.Variable(
            np.zeros((self.edge_count, self.shape[1]), dtype=np.float32))

        self.I = tf.placeholder(tf.int32, shape=[None], name="batch_indices")
    def local_initialize_train(self):
        vertex_feature_dimension = self.entity_count if self.onehot_input else self.submatrix_d
        vertex_matrix_shape = (self.relation_count, self.n_coefficients, vertex_feature_dimension, self.submatrix_d)
        self_matrix_shape = self.shape

        glorot_var_combined = glorot_variance([vertex_matrix_shape[0], vertex_matrix_shape[2]])
        self.W_forward = make_tf_variable(0, glorot_var_combined, vertex_matrix_shape)
        self.W_backward = make_tf_variable(0, glorot_var_combined, vertex_matrix_shape)
        self.W_self = make_tf_variable(0, glorot_var_combined, self_matrix_shape)

        self.b = make_tf_bias(self.shape[1])
示例#3
0
    def local_initialize_train(self):
        type_matrix_shape = (self.relation_count, self.shape[1])
        vertex_matrix_shape = self.shape

        glorot_var_self = glorot_variance(vertex_matrix_shape)
        self.W_self = make_tf_variable(0, glorot_var_self, vertex_matrix_shape)

        type_init_var = 1
        self.D_types_forward = make_tf_variable(0, type_init_var,
                                                type_matrix_shape)
        self.D_types_backward = make_tf_variable(0, type_init_var,
                                                 type_matrix_shape)

        self.b = make_tf_bias(self.shape[1])
示例#4
0
    def local_initialize_train(self):
        variance = glorot_variance(self.shape)

        self.W = make_tf_variable(0, variance, self.shape)
        self.b = make_tf_bias(self.shape[1], init=1)
    def local_initialize_train(self):
        relation_tensor_shape = (self.relation_count, self.relation_dim)
        relation_var = glorot_variance(relation_tensor_shape)

        self.G_sender = make_tf_variable(0, relation_var, relation_tensor_shape)
        self.G_receiver = make_tf_variable(0, relation_var, relation_tensor_shape)