Skip to content

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

@ricardoV94

Description

@ricardoV94

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions