class_docstr: Modification of FID (https://arxiv.org/pdf/2007.01282.pdf) model.
  
  Take continous embedding of retrieved document at middle fusion layer
  instead of whole sequence at input.
class_docstr_tok: ["Modification","of","FID","(","https",":","\/\/arxiv.org\/pdf\/2007.01282.pdf",")","model",".","Take","continous","embedding","of","retrieved","document","at","middle","fusion","layer","instead","of","whole","sequence","at","input","."]
code: def encode_query(
      self,
      encoder_input_image,
      encoder_input_tokens,
      train=False,
      frozen_base=True,
  ):
      bsz = encoder_input_image.shape[0]
      base_vals, base_masks, _ = self.get_base_encoded(
          bsz=bsz,
          image=encoder_input_image,
          text_tokens=encoder_input_tokens,
          train=train,
          frozen_base=frozen_base,
      )
      base_vals = self.dropout(
          jnp.concatenate(base_vals, axis=1), deterministic=not train
      )  # B×(I+N)×d
      base_query = self.query_head(
          encoded_emb=base_vals,
          encoder_mask=base_masks,
          use_dropout=train,
      )
      return base_vals, base_masks, base_query
  
imports: from typing import Any, Dict, Optional
  import flax.linen
  import jax
  import jax.numpy
  import ml_collections
  from scenic.model_lib.base_models import base_model
  from scenic.projects.knowledge_visual_language.models import constants
  from scenic.projects.knowledge_visual_language.models import layers
  from scenic.projects.knowledge_visual_language.models import losses
  from scenic.projects.knowledge_visual_language.models import metrics
  from scenic.projects.knowledge_visual_language.models import vit
  from scenic.projects.t5 import layers
  from scenic.projects.t5 import model
label_desc: Use image node_id 5 for calling the FusionInDecoderSoftModule obj's underlying member method code with example usage: obj.encode_query(encoder_input_image, encoder_input_tokens, train, frozen_base) and returns: base_vals,  base_masks,  base_query