Hello All,
I am trying to use the conditional ending of the scan function in PyTensor as mentioned in the pytensor docs. The code I am running (below) is exactly same as mentioned in the PyTensor docs. But I am getting the error “‘function’ object has no attribute ‘utils’”. Please suggest how may I fix the error.
Code:
import pytensor
import pytensor.tensor as atdef power_of_2(previous_power, max_value):
return previous_power * 2, pytensor.scan.utils.until(previous_power * 2 > max_value)max_value = at.scalar()
values, _ = pytensor.scan(power_of_2,
outputs_info = at.constant(1.),
non_sequences = max_value,
n_steps = 1024)f = pytensor.function([max_value], values)
print(f(45))
The error I get is
Python version - 3.10.9
Pytensor version - 2.8.11
Thanks for all the help!