IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Python function

fbcache_conditional_execution

fbcache_conditional_execution()

max.pipelines.diffusion.fbcache_conditional_execution(first_block_residual, prev_residual, prev_output, residual_threshold, run_remaining_blocks, run_remaining_kwargs, run_postamble, temb, output_types)

source

Handle FBCache F.cond branching pattern shared across DiT models.

The caller provides atomic DiT methods:

  • run_remaining_blocks: runs blocks 1..N + single-stream blocks, returns pre-tail hidden states.
  • run_postamble: applies final norm + projection.

The residual_threshold is a scalar Tensor (float32, shape=[]) passed as a graph input so it can be changed at runtime without recompilation.

Returns:

(first_block_residual, output) tensors.

Parameters:

Return type:

tuple[Tensor, Tensor]