Skip to content

Commit

Permalink
style: opimize code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Reanon committed Mar 26, 2023
1 parent 2d8a483 commit c5be92d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion graph_generator/generate_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def prune_ast(source_ast, filepath):
:return:
"""
# 保存修改之后的节点
source_node = set()
pruned_ast = copy.deepcopy(source_ast)
# 调用 call.value 的 W 函数、调用 W 的 C 函数
call_function, delegate_function = get_call_functions(filepath)
for child in pruned_ast._children:
source_node = set()
if child.nodeType == 'ContractDefinition':
key = 0
contract_node = set()
Expand Down
7 changes: 2 additions & 5 deletions model/GMN.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def message(self, x_i, x_j, edge_index, size, edge_weight=None):
# x_j has shape [E, out_channels]
# Step 3: Normalize node features.
# print(x_i.size(),x_j.size())
if type(edge_weight) == type(None):
if edge_weight is None:
edge_weight = torch.ones(x_i.size(0), x_i.size(1)).to(self.device)
m = F.relu(self.fmessage(torch.cat([x_i, x_j, edge_weight], dim=1)))
else:
Expand Down Expand Up @@ -177,10 +177,7 @@ def forward(self, data, mode='train'):
edge_weight2 = edge_weight2.squeeze(1)
for i in range(self.num_layers):
x1, x2 = self.gmn_layer.forward(x1, x2, edge_index1, edge_index2, edge_weight1, edge_weight2, mode='train')
'''if i==self.num_layers-1:
x1,x2=self.gmnlayer.forward(x1,x2 ,edge_index1, edge_index2,edge_weight1,edge_weight2,mode=mode)
else:
x1, x2 = self.gmnlayer.forward(x1, x2, edge_index1, edge_index2, edge_weight1, edge_weight2, mode='train')'''

batch1 = torch.zeros(x1.size(0), dtype=torch.long).to(self.device) # without batching
batch2 = torch.zeros(x2.size(0), dtype=torch.long).to(self.device)
hg1 = self.pool(x1, batch=batch1)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ py_solc_x==1.1.1
solcast==0.2.1
torch==2.0.0
torch_geometric==2.3.0
tqdm==4.65.0
tqdm==4.65.0
3 changes: 2 additions & 1 deletion test/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
if __name__ == '__main__':
list1 = []
# data = list1[0] if len(list1) else None
solcx.get_available_solc_versions()
ret = solcx.get_compilable_solc_versions()
print(ret)
# solcx.install_solc("0.4.25")
# print(data)

0 comments on commit c5be92d

Please sign in to comment.