utils – Utilities functions operating on the graph#
- class pytensor.graph.utils.AssocList#
An associative list.
This class is like a
dictthat accepts unhashable keys by using an assoc list for internal use only
- exception pytensor.graph.utils.InconsistencyError#
This exception should be thrown by listeners to FunctionGraph when the graph’s state is invalid.
- class pytensor.graph.utils.MetaType(name, bases, dct)#
- exception pytensor.graph.utils.MethodNotDefined#
To be raised by functions defined as part of an interface.
When the user sees such an error, it is because an important interface function has been left out of an implementation class.
- exception pytensor.graph.utils.MissingInputError(*args, **kwargs)#
A symbolic input needed to compute the outputs is missing.
- exception pytensor.graph.utils.TestValueError#
Base exception class for all test value errors.
- class pytensor.graph.utils.ValidatingScratchpad(attr, attr_filter)#
Scratchpadvalidates attribute values.
- pytensor.graph.utils.add_tag_trace(thing: T, user_line: Optional[int] = None) T #
Add tag.trace to a node or variable.
The argument is returned after being affected (inplace).
thing – The object where we add .tag.trace.
user_line – The max number of user line to keep.
We also use config.traceback__limit for the maximum number of stack level we look.
- pytensor.graph.utils.simple_extract_stack(f=None, limit: Optional[int] = None, skips: Optional[Sequence[str]] = None) List[Tuple[Optional[str], int, str, Optional[str]]] #
This is traceback.extract_stack from python 2.7 with this change:
Comment the update of the cache.
Skip internal stack trace level.
The update of the cache call os.stat to verify is the cache is up to date. This take too much time on cluster.
limit - The number of stack level we want to return. If None, mean all what we can.
- skips - partial path of stack level we don’t want to keep and count.
When we find one level that isn’t skipped, we stop skipping.