Skip to main content

relpos_encoding

Function relpos_encoding 

Source
pub fn relpos_encoding(
    residue_indices: &Tensor,
    n_bins: usize,
) -> Result<Tensor>
Expand description

Relative-residue-index one-hot encoding for every (i,j) pair.

For each pair: d = clip(j - i, -n_bins, n_bins), shifted to [0, 2*n_bins], then one-hot encoded.

§Arguments

  • residue_indices[B, N] integer residue positions (any integer dtype)
  • n_bins — half-width of the window (config: 32)

§Returns

[B, N, N, 2*n_bins+1] float32