osc.viz.embeds.viz_positional_embedding

viz_positional_embedding(embed, num_patches, target_patches=None, side_inch=1.0)[source]

Visualize 2D positional embedding, possibly resized to a different grid size.

Parameters
  • embed (Tensor) – embedding of shape [HW D]

  • num_patches (Tuple[int, int]) – the H and W shapes of embed

  • target_patches (Optional[Tuple[int, int]]) – optionally, a target H and W

  • side_inch – height of one square in the resulting figure

Return type

Figure

Returns

A figure containing HxW heatmaps.