AI4Finance-Foundation / AI4Finance-Foundation/RLSolver

🐛 contract in some orders on a circuit with ring struction may get incorrect multiplication counts.

Aperta
#99 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
discussion help wanted
Lingua principale
Python
Stelle
169
Fork
36
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

收缩 sycamore 以及 tensor grid ,tensor ring 这种有环状结构的电路,会有bug,导致乘法次数计算错误
(刚好我们测试的 tensor train,tensor tree 没有环状结构)

需要有环状结构,且按某个顺序收缩张量节点,才会触发

下面的代码,在一个小规模的 sycamore 电路 NodesSycamoreN12M14 上得到,然后逐行检查发现了这个bug
```
num_nodes 51
num_edges 99
ban_edges 0
```

先粗略记录一下。

这是print代码

```
'''calculate the multiple and avoid repeat'''
contract_dims = node_dims_arys[node_i0] + node_dims_arys[node_i1] # 计算收缩后的node 的邻接张量的维度 以及来源
contract_bool = node_bool_arys[node_i0] | node_bool_arys[node_i1] # 计算收缩后的node 由哪些原初node 合成
# assert contract_dims.shape == (num_nodes, )
# assert contract_bool.shape == (num_nodes, )

print(';;;', i, node_i0, node_i1)
print(node_dims_arys[node_i0].numpy().astype(int))
print(node_dims_arys[node_i1].numpy().astype(int))
print(contract_dims.numpy().astype(int))
print(contract_bool.numpy().astype(int))
```

这是print内容。可以看到,对已经收缩的节点竟然进行了不可能的收缩,并且产生了多余的乘法次数。
```
;;; 52 tensor(3) tensor(9)
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 352 0 0 0 0 96 0 0 0 128 0 0 0 0 320 0 128 0 0 0 64 0 64 64 0 0 0 0 192 0 64 64 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 352 0 0 0 0 96 0 0 0 128 0 0 0 0 320 0 128 0 0 0 64 0 64 64 0 0 0 0 192 0 64 64 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 704 0 0 0 0 192 0 0 0 256 0 0 0 0 640 0 256 0 0 0 128 0 128 128 0 0 0 0 384 0 128 128 0]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 0 1 0 1 0 1 0 1 0 0 1 1 0 0 0 1 0 0 1]
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start with the contraction-counting code shown in the issue and reproduce it on the NodesSycamoreN12M14 circuit using the reported 51 nodes, 99 edges, and contraction-order conditions. Trace the node dimension and boolean arrays around the printed duplicate contraction. Done means cyclic circuits no longer contract an already-combined node or add duplicate multiplication counts.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
backend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.