# variable_summaries(W_interaction) A_B = tf.map_fn(lambda W: h_A_4 @ W, w_tensor, dtype=tf.float32) A_B = tf.transpose(A_B, [1, 0, 2]) A_B = A_B @ tf.expand_dims(h_B_4, -1) A_B = tf.reduce_sum(A_B, axis=2) A_B = tf.concat([A_B, tf.matmul(tf.concat([h_A_4, h_B_4], 1), W_interaction) + b_tensor], axis=-1) fully_size = 2 * tensor_size if pairwise_node_comparison: with tf.name_scope('pairwise_node_comparison'): # def sgm(x): # return 1/(1+np.exp(-x)) def hist(a,b): return tf.histogram_fixed_width(tf.nn.sigmoid([email protected](b)), [0.0,1.0], nbins=n_bins) atomA=tf.dynamic_partition(outputA,graphA_topology.get_membership_placeholder(),batch_size) atomB=tf.dynamic_partition(outputB,graphB_topology.get_membership_placeholder(),batch_size) res=[] for i in range(batch_size): res.append(hist(atomA[i],atomB[i])) res=tf.to_float(tf.convert_to_tensor(res)) res=tf.stop_gradient(res) A_B=tf.concat([A_B,res],-1) fully_size+=n_bins # A_B_interaction = h_A_4 + h_B_4 # A_B_interaction = tf.concat([h_A_3, h_B_3], 1) # A_B = tf.nn.dropout(A_B, 1 - dropout3 * training) # interaction_size = 2 * Dense_size # interaction_size = Dense_size*Dense_size # interaction_size = (conv_size+Dense_size)*2
b_tensor ], axis=-1) fully_size = 2 * tensor_size if pairwise_node_comparison: with tf.name_scope('pairwise_node_comparison'): # def sgm(x): # return 1/(1+np.exp(-x)) def hist(a, b): return tf.histogram_fixed_width(tf.nn.sigmoid( a @ tf.transpose(b)), [0.0, 1.0], nbins=n_bins) atomA = tf.dynamic_partition( outputA, graphA_topology.get_membership_placeholder(), batch_size) atomB = tf.dynamic_partition( outputB, graphB_topology.get_membership_placeholder(), batch_size) res = [] for i in range(batch_size): res.append(hist(atomA[i], atomB[i])) res = tf.to_float(tf.convert_to_tensor(res)) res = tf.stop_gradient(res) A_B = tf.concat([A_B, res], -1) fully_size += n_bins # A_B_interaction = h_A_4 + h_B_4 # A_B_interaction = tf.concat([h_A_3, h_B_3], 1) # A_B = tf.nn.dropout(A_B, 1 - dropout3 * training)