flux_pos_embed

Compute FLUX rotary frequencies from position ids

Description

Per-axis 1D rotary frequencies (interleaved-real convention), computed in float64 on CPU and concatenated over the axes. Reference: FluxPosEmbed with get_1d_rotary_pos_embed(repeat_interleave_real=TRUE, use_real=TRUE, freqs_dtype=float64).

Usage

flux_pos_embed(ids, axes_dim = c(16L, 56L, 56L), theta = 10000)

Arguments

  • ids: Tensor of shape [S, 3]: concatenated text ids (all zero) and image ids from flux_prepare_latent_image_ids.
  • axes_dim: Integer vector of per-axis rotary dims; must sum to the attention head dim. FLUX uses c(16, 56, 56).
  • theta: Numeric. RoPE base frequency.

Value

List of two tensors (cos, sin), each [S, sum(axes_dim)], float32, on the device of ids.