if else #685
Replies: 2 comments 2 replies
-
Every circuit is a Go program. So, technically you may be able to define a circuit with if-clause, but the control flow may not be as you expect. In this case, you perform check A correct way to rewrite this code is approximately: postrelu[i] = api.Select(biassum[i], biassum[i], 0)
temp_act_code[i] = api.Select(biassum[i], biassum[i], 1, 0) |
Beta Was this translation helpful? Give feedback.
-
Hi Ivo, I changed my code to what you suggested
The signature of AddVecf function is as follows :
After adding api.Println statements, I see the following
and type of biassum is I am running a for loop three times. For the first 2, I see unsolved for all 0-23. but for the last one I see some unsolved and some zeros. Cannot figure out what is going wrong. |
Beta Was this translation helpful? Give feedback.
-
Hi there,
I use the following code in my circuit.
temp_act_code := []frontend.Variable{}
var postrelu [24]frontend.Variable
if api.Cmp(biassum[i], 0) != -1 {
postrelu[i] = biassum[i]
temp_act_code = append(temp_act_code, 1)
} else {
postrelu[i] = 0
temp_act_code = append(temp_act_code, 0)
}
where biassum is a [24]frontend.Variable.
I thought if else statements are not allowed in circuits.. But the circuit complies and gets verified without error. How is that possible?
Beta Was this translation helpful? Give feedback.
All reactions