class_docstr: Transformer Encoder.
  
  **This is same as vit.Encoder(), but without adding positional embedding.**
  
  Attributes:
    num_layers: Number of layers.
    mlp_dim: Dimension of the mlp on top of attention block.
    inputs_positions: Input subsequence positions for packed examples.
    dropout_rate: Dropout rate.
    stochastic_depth: probability of dropping a layer linearly grows from 0 to
      the provided value. Our implementation of stochastic depth follows timm
      library, which does per-example layer dropping and uses independent
      dropping patterns for each skip-connection.
    dtype: Dtype of activations.
class_docstr_tok: ["Transformer","Encoder",".","*","*","This","is","same","as","vit.Encoder","(",")",",","but","without","adding","positional","embedding",".","*","*","Attributes",":","num_layers",":","Number","of","layers",".","mlp_dim",":","Dimension","of","the","mlp","on","top","of","attention","block",".","inputs_positions",":","Input","subsequence","positions","for","packed","examples",".","dropout_rate",":","Dropout","rate",".","stochastic_depth",":","probability","of","dropping","a","layer","linearly","grows","from","0","to","the","provided","value",".","Our","implementation","of","stochastic","depth","follows","timm","library",",","which","does","per-example","layer","dropping","and","uses","independent","dropping","patterns","for","each","skip-connection",".","dtype",":","Dtype","of","activations","."]
docstr: Applies Transformer model on the inputs.
docstr_tok: ["Applies","Transformer","model","on","the","inputs","."]
code: def __call__(self, x: jnp.ndarray, *, train: bool = False):
      """Applies Transformer model on the inputs."""
      assert x.ndim == 3  # Shape is `[batch, len, emb]`.
      dtype = jax.dtypes.canonicalize_dtype(self.dtype)
  
      # Input Encoder.
      for lyr in range(self.num_layers):
          x = vit.Encoder1DBlock(
              mlp_dim=self.mlp_dim,
              num_heads=self.num_heads,
              dropout_rate=self.dropout_rate,
              attention_dropout_rate=self.attention_dropout_rate,
              stochastic_depth=(lyr / max(self.num_layers - 1, 1))
              * self.stochastic_depth,
              name=f"encoderblock_{lyr}",
              dtype=dtype,
          )(x, deterministic=not train)
      encoded = nn.LayerNorm(name="encoder_norm")(x)
      return encoded
  
file_path: scenic/scenic/projects/tasseo/duplex_vit.py
imports: from typing import Any
  import flax.linen
  import jax
  import jax.numpy
  import ml_collections
  from scenic.model_lib.base_models.classification_model import ClassificationModel
  from scenic.model_lib.layers import nn_layers
  from scenic.projects.baselines import vit
label_desc: Use image node_id 1 for calling the Encoder obj's underlying member method code with example usage: obj.__call__(x) and returns: encoded