Skip to content

Extraction of class token #2446

Discussion options

You must be logged in to vote

@vedantdalimkar assuming you're using forward_intermediates(), return_prefix_tokens=True will give you another list of the class tokens beside the spatial tokens

def forward_intermediates(
self,
x: torch.Tensor,
indices: Optional[Union[int, List[int]]] = None,
return_prefix_tokens: bool = False,
norm: bool = False,
stop_early: bool = False,
output_fmt: str = 'NCHW',
intermediates_only: bool = False,
) -> Union[List[torch.Tensor], Tuple[torch.Tensor, List[torch.Tensor]]]:
""" Forward features that returns intermediates.
Args:
x: …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@vedantdalimkar
Comment options

@rwightman
Comment options

Answer selected by vedantdalimkar
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants