Skip to content

Commit

Permalink
Update layouts.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-camuto committed Oct 31, 2024
1 parent fce9673 commit 4aa775d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/circuit/ops/layouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4546,11 +4546,10 @@ pub fn round<F: PrimeField + TensorType + PartialOrd + std::hash::Hash>(
) -> Result<ValTensor<F>, CircuitError> {
// decompose with base scale and then set the last element to zero
let decomposition = decompose(config, region, values, &(scale.0 as usize), &legs)?;
// set the last element to zero and then recompose
let zero = create_constant_tensor(F::ZERO, 1);
// set the last element to zero and then recompose, we don't actually need to assign here
// as this will automatically be assigned in the recompose function and uses the constant caching of RegionCtx
let zero = ValType::Constant(F::ZERO);

let assigned_zero = region.assign(&config.custom_gates.inputs[0], &zero)?;
let assigned_zero = assigned_zero.get_inner_tensor()?[0].clone();
let one = create_constant_tensor(integer_rep_to_felt(1), 1);
let assigned_one = region.assign(&config.custom_gates.inputs[1], &one)?;
let negative_one = create_constant_tensor(integer_rep_to_felt(-1), 1);
Expand Down Expand Up @@ -4637,7 +4636,7 @@ pub fn round<F: PrimeField + TensorType + PartialOrd + std::hash::Hash>(
incremented_elem.get_inner_tensor()?.clone()[0].clone();

// set the last elem to zero
inner_tensor[sliced_input.len() - 1] = assigned_zero.clone();
inner_tensor[sliced_input.len() - 1] = zero.clone();

Ok(inner_tensor.clone())
};
Expand Down

0 comments on commit 4aa775d

Please sign in to comment.