pygmtools.utils.inner_prod_aff_fn

pygmtools.utils.inner_prod_aff_fn(feat1, feat2, backend=None)[source]

Inner product affinity function. The affinity is defined as

\[\mathbf{f}_1^\top \cdot \mathbf{f}_2\]
Parameters
  • feat1\((b\times n_1 \times f)\) the feature vectors \(\mathbf{f}_1\)

  • feat2\((b\times n_2 \times f)\) the feature vectors \(\mathbf{f}_2\)

  • backend – (default: pygmtools.BACKEND variable) the backend for computation.

Returns

\((b\times n_1\times n_2)\) element-wise inner product affinity matrix