GNNSCVulDetector
GNNSCVulDetector copied to clipboard
The code implementation seems to be inconsistent with the formulas in the paper.
In the Readout phase of your paper, formulas (7) to (10) are described as follows:
These formulas are implemented in lines 239 to 245 of GNNSCModel.py as follows:
gate_input = tf.concat([last_h, self.placeholders['initial_node_representation']], axis=-1) # [v x 2h]
gated_outputs = tf.nn.sigmoid(regression_gate(gate_input)) * regression_transform(last_h) # [v x 1] new_last_h
# Sum up all nodes per graph
graph_representations = tf.unsorted_segment_sum(data=gated_outputs,
segment_ids=self.placeholders['graph_nodes_list'],
num_segments=self.placeholders['num_graphs']) # [g x 1]
According to the above,
the variable last_h
corresponds to the symbol (h_i)^T
in formulas (7),
the variable self.placeholders['initial_node_representation']
corresponds to the symbol (h_i)^0
in formulas (7),
the variable gate_input
corresponds to the symbol s_i
in formulas (7),
the variable regression_gate(gate_input)
corresponds to the symbol g_i
in formulas (8),
the variable regression_transform(last_h)
corresponds to the symbol o_i
in formulas (9),
the variable gated_ouputs
should corresponds to Sigmoid(o_i * g_i)
in formulas (10)
However, both formulas (8) and (9) take s_i
as input, whereas the function regression_gate
and regression_transform
takes gate_input
and last_h
as input respectively, and the sigmod function has regression_gate(gate_input)
->o_i
as input instead of o_i * g_i
.
Is this a typo in the code implementation?
@Messi-Q