-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattack.py
More file actions
30 lines (25 loc) · 928 Bytes
/
attack.py
File metadata and controls
30 lines (25 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import sys
import torch
from config.config import get_config
from utils.hyperattack import RandomAttack_hyperedges
def main():
cfg=get_config()
print(f"==================================================")
print(f" HGNN-Shield Attack Generator")
print(f"==================================================")
print(f"Dataset: {cfg.data.dataset}")
print(f"DataRoot: {cfg.data.root}")
print(f"Mode: {cfg.attack.mode}")
print(f"Rate: {cfg.attack.rate}")
print(f"Device: {cfg.data.device}")
print(f"--------------------------------------------------")
try:
result = RandomAttack_hyperedges(cfg, cfg.data.dataset)
print(f"[Success] Attack generation completed.")
except Exception as e:
print(f"[Error] Attack generation failed: {e}")
import traceback
traceback.print_exc()
if __name__ == '__main__':
main()