Clarification on Classification Token
github.comhuggingface/transformers/blob/0a7af19f4dc868bafc82f35eb7e8d13bac87a594/src/transformers/models/layoutlmv3/modeling_layoutlmv3.py#L1349position_ids=position_ids,head_mask=head_mask,inputs_embeds=inputs_embeds,output_attentions=output_attentions,output_hidden_states=output_hidden_states,return_dict=return_dict,bbox=bbox,pixel_values=pixel_values,)sequence_output = outputs[0][:, 0, :]logits = self.classifier(sequence_output)loss = Noneif labels is not None:if self.config.problem_type is None:if self.num_labels == 1:self.config.problem_type = "regression"elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):self.config.problem_type = "single_label_classification"else:@nielsrIn the above line the first token from the output of transformer is used to do classification logit computation. I am confused because in the source code the learnable classification token is not at the zeroth index. The cls_token is concatenated at the start of image patch tokensvisual_tokens = torch.cat([cls_token, visual_path_embeddings])and to create transformer input the text+bbox inuputs and image tokens are concatenated as follows,transformer_inp = torch.cat([text_embeddings, visual_embedding])this means that my classification is at index 512 considering that we put limit of 512 tokens on text inputs.This is just for clarification, using first token for classification also does a fine job.Thanks