MCPcopy
hub / github.com/THUDM/CogDL / attack

Method attack

examples/GRB/attack/modification/dice.py:22–30  ·  view source on GitHub ↗
(self, graph: Graph)

Source from the content-addressed store, hash-verified

20 self.verbose = verbose
21
22 def attack(self, graph: Graph):
23 if graph.test_mask is None or len(graph.test_nid) == 0:
24 print("index_target is None.")
25 exit(1)
26 adj_attack = self.modification(graph.to_scipy_csr(), graph.test_nid.cpu(), graph.y)
27 # graph = copy.deepcopy(graph)
28 # updateGraph(graph, adj_attack, graph.x)
29 # return graph
30 return getGraph(adj_attack, graph.x, graph.y, device=self.device)
31
32 def modification(self, adj, index_target, labels):
33 adj_attack = adj.tolil()

Callers 1

Calls 3

modificationMethod · 0.95
getGraphFunction · 0.90
to_scipy_csrMethod · 0.45

Tested by 1