Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically set trust_input=True when function has no inputs #1117

Open
ricardoV94 opened this issue Dec 11, 2024 · 0 comments
Open

Automatically set trust_input=True when function has no inputs #1117

ricardoV94 opened this issue Dec 11, 2024 · 0 comments

Comments

@ricardoV94
Copy link
Member

Description

I still see some tiny overhead even in functions without inputs:

import pytensor
import pytensor.tensor as pt

fn = pytensor.function([], pt.zeros((5)))
%timeit fn()  # 4.76 µs ± 190 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

fn.trust_input=True
%timeit fn()  # 2.39 µs ± 91.9 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

Probably because trust_input avoids entering some loops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant