def cheb_fc_fn(x, L, output_units, filter_order, num_filters): """ Neural network consisting on 1 convolutional chebyshev layer and one dense layer :param x: input signal :param L: graph laplacian :param output_units: number of output units :param filter_order: order of convolution :param num_filters: number of parallel filters :return: computational graph """ with tf.name_scope("chebyshev_conv"): with tf.name_scope("weights"): Wcheb = _weight_variable([filter_order, num_filters]) _variable_summaries(Wcheb) with tf.name_scope("biases"): bcheb = _bias_variable([num_filters]) _variable_summaries(bcheb) graph_conv = chebyshev_convolution(x, L, Wcheb, bcheb) graph_conv = tf.nn.relu(graph_conv) with tf.name_scope("dropout"): keep_prob = tf.placeholder(tf.float32) dropout = tf.nn.dropout(graph_conv, keep_prob=keep_prob) with tf.name_scope("fc"): fc_input = tf.layers.flatten(dropout) fc = tf.layers.dense(inputs=fc_input, units=output_units, activation=None, use_bias=True) return fc, keep_prob
def _cheb_conv_layer(x, L, vertex_filter_order, num_filters): _, _, _, num_channels = x.get_shape() num_channels = int(num_channels) with tf.name_scope("fir_tv"): with tf.name_scope("weights"): hfir = _weight_variable([vertex_filter_order, num_channels, num_filters]) _variable_summaries(hfir) graph_conv = chebyshev_convolution(x, L, hfir, None) return graph_conv