returnn.frontend.graph

Graph utils.

They might be just available for graph-based frameworks, but not necessarily.

returnn.frontend.graph.get_tensor_dependencies(x: Tensor) Sequence[Tensor][source]
Parameters:

x – tensor

Returns:

list of tensors which are inputs to x

returnn.frontend.graph.get_tensor_consumers(x: Tensor) Sequence[Tensor][source]
Parameters:

x – tensor

Returns:

list of tensors which consume x

returnn.frontend.graph.walk_tensor_consumers(seed: Tensor | Sequence[Tensor], *, filter_outputs: Callable[[Tensor], bool] | None = None, ending_condition: Callable[[Tensor], bool] | None = None) List[Tensor][source]
Parameters:
  • seed – tensor

  • filter_outputs – if given, this function will be called with each tensor, and if it returns False, the tensor will be skipped.

  • ending_condition – if given, this function will be called with each tensor, and if it returns True, we return.

Returns:

yields all tensors which consume seed, and their consumers, recursively