def METHOD_NAME(self, src_tokens, src_lengths, return_all_hiddens=False):
    """
    Args:
        src_tokens: Input source tokens Tensor of shape B X T X C
        src_lengths: Lengths Tensor corresponding to input source tokens
        return_all_hiddens: If true will append the self attention states to the encoder states
    Returns:
        encoder_out: Tensor of shape B X T X C
        encoder_padding_mask: Optional Tensor with mask
        encoder_embedding: Optional Tensor. Always empty here
        encoder_states: List of Optional Tensors wih self attention states
        src_tokens: Optional Tensor. Always empty here
        src_lengths: Optional Tensor. Always empty here
    """
    x, input_lengths = self.subsample(src_tokens, src_lengths)  # returns T X B X C
    encoder_padding_mask = lengths_to_padding_mask(input_lengths)
    x = self.embed_scale * x
    if self.pos_enc_type == "rel_pos":
        positions = self.embed_positions(x)
    elif self.pos_enc_type == "rope":
        positions = None
    else:
        positions = self.embed_positions(encoder_padding_mask).transpose(0, 1)
        x += positions
        positions = None
    x = self.linear(x)
    x = self.dropout(x)
    encoder_states = []
    # x is T X B X C
    for layer in self.conformer_layers:
        x, _ = layer(x, encoder_padding_mask, positions)
        if return_all_hiddens:
            encoder_states.append(x)
    return {
        "encoder_out": [x],  # T x B x C
        "encoder_padding_mask": [encoder_padding_mask]
        if encoder_padding_mask.any()
        else [],  # B x T
        "encoder_embedding": [],  # B x T x C
        "encoder_states": encoder_states,  # List[T x B x C]
        "src_tokens": [],
        "src_lengths": [],
    }